Hello,
I would really appreciate any help with this as I'm thoroughly stuck.
I've set up rkhunter to run as a cron job and then email any warnings etc using ssmtp via gmail with this script:
Code:
#!/bin/sh
(
/usr/local/bin/rkhunter --versioncheck
/usr/local/bin/rkhunter --update
/usr/local/bin/rkhunter --cronjob --report-warnings-only
) | /bin/mail -v -s 'rkhunter daily run' myemail@gmail.com
It all works ok, except that it sends the output as an attachment rather in the body.
It happens whether it is run via cron or within a normal shell.
I found a similar problem relating to encoding and tried piping it like this
Code:
[rkhunter outpu] | iconv -c -t UTF-8 | /bin/mail -v -s 'rkhunter daily run' myemail@gmail.com
but that didn't fix it either
/etc/environment has locale set to en_US
I tried setting locale within the scrip like this :
Code:
LOC="en_US"
export LC_ALL=$LOC
This sends text as the body in an email like you would expect:
Code:
echo 'some text' | /bin/mail -v -s 'UTF Test' myemail@gmail.com
and displays :
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
while the output from rkhunter shows this when sent:
Content-Type: application/octet-stream
Content-Transfer-Encoding: base64