I use postfix so I don't get a UNIX mail command only postfix version of sendmail. Because of this the packaged crontab doesn't work. I rewrote it to check which mail command people have on their box. Tell me what you think. It may be overkill. #!/bin/sh ### Begin Configuration ### # set this to 'yes' to enable ENABLE=no RKHUNTER_EXEC="/usr/bin/rkhunter" RKHUNTER_OPTS="--checkall --cronjob --skip-keypress" # set to 'yes' if you wish the output to be mailed to you SEND_EMAIL=no # NOTE: the rest of these options are only relevant # if you set SEND_EMAIL to 'yes' FQDN=`hostname -f` EMAIL_RECIPIENT=root@$FQDN if [ ! `which mail` == "" ]; then EMAIL_SUBJECT="${HOSTNAME}: rkhunter output" EMAIL_CMD="| mail -s \"${EMAIL_SUBJECT}\" ${EMAIL_RECIPIENT}" else EMAIL_FROM=rkhunter@$FQDN EMAIL_CMD="| sendmail -r \"${EMAIL_SENDER}\" ${EMAIL_RECIPIENT}" if # set to 1 to recieve only warnings & errors # set to 2 to recieve ALL rkhunter output # set to 3 to recieve rkhunter report EMAIL_VERBOSITY=3 ### End Configuration ### if [ "${ENABLE}" = "yes" ]; then CMD="${RKHUNTER_EXEC} ${RKHUNTER_OPTS}" if [ "${SEND_EMAIL}" = "yes" ]; then if [ "${EMAIL_VERBOSITY}" -eq 1 ]; then CMD="${CMD} --quiet ${EMAIL_CMD}" elif [ "${EMAIL_VERBOSITY}" -eq 2 ]; then CMD="${CMD} ${EMAIL_CMD}" else # default to report-mode CMD="${CMD} --report-mode ${EMAIL_CMD}" fi else CMD="${CMD} &>/dev/null" fi eval exec "${CMD}" fi Reproducible: Always Steps to Reproduce: 1. 2. 3.
My script is really broken. My bad. Here's one that works. #!/bin/sh ### Begin Configuration ### # set this to 'yes' to enable ENABLE=yes RKHUNTER_EXEC="/usr/bin/rkhunter" RKHUNTER_OPTS="--checkall --cronjob --skip-keypress" # set to 'yes' if you wish the output to be mailed to you SEND_EMAIL=yes # NOTE: the rest of these options are only relevant # if you set SEND_EMAIL to 'yes' FQDN=`hostname -f` EMAIL_RECIPIENT=root@$FQDN if [ -x /usr/sbin/mail ]; then EMAIL_SUBJECT="${HOSTNAME}: rkhunter output" EMAIL_CMD="| mail -s \"${EMAIL_SUBJECT}\" ${EMAIL_RECIPIENT}" else EMAIL_FROM=rkhunter@$FQDN EMAIL_CMD="| sendmail -r \"${EMAIL_FROM}\" ${EMAIL_RECIPIENT}" fi # set to 1 to recieve only warnings & errors # set to 2 to recieve ALL rkhunter output # set to 3 to recieve rkhunter report EMAIL_VERBOSITY=3 ### End Configuration ### if [ "${ENABLE}" = "yes" ]; then CMD="${RKHUNTER_EXEC} ${RKHUNTER_OPTS}" if [ "${SEND_EMAIL}" = "yes" ]; then if [ "${EMAIL_VERBOSITY}" -eq 1 ]; then CMD="${CMD} --quiet ${EMAIL_CMD}" elif [ "${EMAIL_VERBOSITY}" -eq 2 ]; then CMD="${CMD} ${EMAIL_CMD}" else # default to report-mode CMD="${CMD} --report-mode ${EMAIL_CMD}" fi else CMD="${CMD} &>/dev/null" fi eval exec "${CMD}" fi
Originally, the whole point of adding the EMAIL_CMD variable was so that it was configurable by the user; I'm not sure what the difference is between assuming the mail command exists and your solution (if mail doesn't exists, assume sendmail does). IMO, it's fine as is (it's meant to be changed by the user to the best suitable option). Also, the addition of conditional code to the config section makes it MUCH less readable by someone that doesn't have any experience reading shell scripts. solar, what is your $0.02?
My $00.2 is that you Aaron Walker are the maintainer of rkhunter and I'm your cvs proxy. You have been here from the start and I'm going to CC: you on every bug that comes up for rkhunter from here till the end of time or you become a developer and can take the pkg off my hands. If you feel this is how it should be or not done fine. As you know I was not keen on the crontab stuff in the first place. So shrug..
After reading your explanation I would have to agree with you. Leaving it the way it is for the reasons you suggested is probably the simplist thing to do. It also keeps things like 'if' statements from the config section. --Smutt
ok closing as WONTFIX then.