Page 2 of 2 FirstFirst 1 2
Results 11 to 17 of 17

Thread: Linux Run Rkhunter And Send Reports Via Email ( Cronjob )

  1. #11
    Junior Member
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Error Rkhunter

    Thanks

    Display this message and nothing happens

    root@server [/etc/cron.daily]# bash rkhunter.sh
    You must specify direct recipients with -s, -c, or -b.

  2. #12
    Contributors jaysunn's Avatar
    Join Date
    Apr 2009
    Location
    NYC - USA
    Posts
    1,023
    Thanks
    164
    Thanked 152 Times in 131 Posts
    Rep Power
    23

    Default

    OK,
    I have installed this on rhel4 and it is working. Call this script exactly from cron.

    Code:
    [root@qatestapp ~]# cat rkhunter.sh 
    #!/bin/sh
    
    ( /usr/local/bin/rkhunter --versioncheck
    /usr/local/bin/rkhunter --update
    /usr/local/bin/rkhunter --cronjob --report-warnings-only
    ) | mail -s "rkhunter output" jralph@domain.com

    This script I found from this site, the only change that I made was the path to the mail executable. I removed it cause it failed.

    http://articles.slicehost.com/2010/3...hunter-updated
    jaysunn
    Last edited by jaysunn; 22nd May 2010 at 05:27 AM.

  3. The Following User Says Thank You to jaysunn For This Useful Post:

    Chelinux (22nd May 2010)

  4. #13
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,374
    Thanks
    17
    Thanked 754 Times in 496 Posts
    Rep Power
    10

    Default

    Jaysunn is right,

    Code:
    #!/bin/bash
    /usr/local/bin/rkhunter --cronjob 2>&1 > /tmp/RKhunter_Scan_Details && mail -s 'Output' my_email < /tmp/RKhunter_Scan_Details
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  5. The Following User Says Thank You to nixcraft For This Useful Post:

    Chelinux (22nd May 2010)

  6. #14
    Junior Member
    Join Date
    May 2010
    Posts
    7
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default Error Rkhunter

    Hello all thank you very much and worked

  7. #15
    Never say die nixcraft's Avatar
    Join Date
    Jan 2005
    Location
    BIOS
    Posts
    4,374
    Thanks
    17
    Thanked 754 Times in 496 Posts
    Rep Power
    10

    Default

    Quote Originally Posted by jaysunn View Post
    OK,
    I have installed this on rhel4 and it is working. Call this script exactly from cron.

    Code:
    [root@qatestapp ~]# cat rkhunter.sh 
    #!/bin/sh
    
    ( /usr/local/bin/rkhunter --versioncheck
    /usr/local/bin/rkhunter --update
    /usr/local/bin/rkhunter --cronjob --report-warnings-only
    ) | mail -s "rkhunter output" jralph@domain.com
    This script I found from this site, the only change that I made was the path to the mail executable. I removed it cause it failed.

    Slicehost Articles: Scanning for rootkits with rkhunter
    jaysunn
    Good script and there is small problem (including my version), if rkhunter failed to produce output file, than mail command will send an email with empty body message. The workaround is to add additional if command and check wheter file is empty or not and send message according to that.. may be something like
    Code:
    rkhunter options > /tmp/output
    if [ /tmp/output file is not empty ] 
      email it using mail options
    else
      email warning message stating rkhunter failed to scan
    fi
    /Solved
    All [Solved] threads are closed by mods / admin to avoid spam issues. See Howto mark a thread as [Solved]


  8. The Following User Says Thank You to nixcraft For This Useful Post:

    jaysunn (22nd May 2010)

  9. #16
    raj
    raj is offline
    Senior Member raj's Avatar
    Join Date
    Jun 2005
    Location
    Hyderabad
    Posts
    550
    Thanks
    55
    Thanked 39 Times in 36 Posts
    Rep Power
    12

    Default

    Quote Originally Posted by nixcraft View Post
    Code:
    rkhunter options > /tmp/output
    if [ /tmp/output file is not empty ] 
      email it using mail options
    else
      email warning message stating rkhunter failed to scan
    fi
    I dont think so it will run either
    Raj
    Linux rulz.
    I have never turned back in my life ; I shall not do so today.. haha

  10. #17
    Junior Member
    Join Date
    Apr 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    Default

    this is indeed a great little script, but since I get messages sent to my droid each morning about the status of numerous servers I just use:

    rkhunter --cronjob --nomow --summary

    and then if need be I can do more research by looking in the log files

    thanks!

Page 2 of 2 FirstFirst 1 2

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Exim4 - Limit daily send email
    By flipmode in forum Mail Servers
    Replies: 2
    Last Post: 7th May 2010, 06:41 PM
  2. Send Email To User When Some Path Is getting Low
    By jaysunn in forum Getting started tutorials
    Replies: 3
    Last Post: 30th August 2009, 06:46 AM
  3. BASH Script To Send Email When Something Fails in The system
    By hudipirlo in forum Shell scripting
    Replies: 1
    Last Post: 17th April 2009, 09:40 AM
  4. how to send email on every saturday in perl
    By chandanperl in forum Coding in General
    Replies: 4
    Last Post: 22nd August 2008, 06:25 PM
  5. A script for generating cPanel backup and send as email
    By vivekv in forum Shell scripting
    Replies: 0
    Last Post: 20th October 2007, 08:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41