DTux
/
dtux__sshdetect
Archived
1
0
Fork 0

debug of systemd service and logfile search

This commit is contained in:
Daniel Tartavel 2020-05-18 20:20:30 +02:00
parent 2f03f2fcdd
commit 104539f763
2 changed files with 6 additions and 5 deletions

6
main.c
View File

@ -140,6 +140,7 @@ int readconfig( struct config * cfg )
strcpy(cfg->logfile, "/dev/null");
retval += 2;
}
printf("logfile not found, defaulting to %s\n", cfg->logfile);
}
if (cfg->hostname[0] == 0 )
{
@ -151,16 +152,18 @@ int readconfig( struct config * cfg )
{
strcpy(cfg->hostname, HOSTNAME);
}
printf("hostname not found, defaulting to %s\n", cfg->hostname);
}
if (cfg->commande[0] == 0)
{
if (debug >=1) printf("command not found in config file: no command will be executed\n");
printf("command not found in config file: no command will be executed\n");
retval += 4;
}
return retval;
}
//test if pid is in list of known sshd processus
// return number of pid
int isinarray( int pid, int array[], int n )
{
int x;
@ -174,6 +177,7 @@ int isinarray( int pid, int array[], int n )
return 0;
}
// return date in localized format
char* frtime(const time_t timet)
{
struct tm *date_tm;

View File

@ -4,10 +4,7 @@ After=sshd.service
[Service]
Type=simple
User=daemon
Group=daemon
WorkingDirectory=/root
ExecStart=/usr/bin/sshdetect
Restart=always