From 104539f763b9d5d11ba96bd159ed5c6fbfed81e8 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Mon, 18 May 2020 20:20:30 +0200 Subject: [PATCH] debug of systemd service and logfile search --- main.c | 6 +++++- sshdetect.service | 5 +---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 13cdb55..37e3192 100644 --- a/main.c +++ b/main.c @@ -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; diff --git a/sshdetect.service b/sshdetect.service index 832db1c..9448e89 100644 --- a/sshdetect.service +++ b/sshdetect.service @@ -4,10 +4,7 @@ After=sshd.service [Service] Type=simple - -User=daemon -Group=daemon - +WorkingDirectory=/root ExecStart=/usr/bin/sshdetect Restart=always