rkhunter

Discussion in 'General' started by SamTzu, Nov 9, 2023.

Tags:
  1. SamTzu

    SamTzu Active Member

    There used to be an ISPconfig config file that allowed rkhunter scans to start at different times.
    When rkhunter starts in many LXC containers at the same time it can take all CPU power of the host.
    Any way to randomize scan times?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    The start time is part of the cron plugin, you can find it in the code at the beginning of the plugin. The corn plugins are in the folder /usr/local/ispconfig/server/lob/classes/cron.d/

    The main problem with changing the time there is that it gets overwritten on update and there is currently no mechanism that you can do this in an update-safe way, yo you might e.g. use a shell script as a wrapper for the ispconfig_update.sh script that runs e.g. a sed command to alter the start time when the update is finished.
     
    ahrasis likes this.
  3. SamTzu

    SamTzu Active Member

    thx @till
    Here's my quick and dirty solution...
    nano /usr/local/ispconfig/server/lib/classes/cron.d/100-monitor_rkhunter.inc.php
    protected $_schedule = '@daily';
    chattr +i /usr/local/ispconfig/server/lib/classes/cron.d/100-monitor_rkhunter.inc.php
     
  4. SamTzu

    SamTzu Active Member

    I ended up removing all rkhunters from our servers. The load always hit at the same time no matter what.
    Here is a quote from cron.daily for apt.

    # Systemd systems use a systemd timer unit which is preferable to
    # run. We want to randomize the apt update and unattended-upgrade
    # runs as much as possible to avoid hitting the mirrors all at the
    # same time. The systemd time is better at this than the fixed
    # cron.daily time
     
  5. pyte

    pyte Well-Known Member HowtoForge Supporter

    You could have just add a sleep statement with a random delay and a && operator to the cron job. That should work just fine
     
    ahrasis likes this.

Share This Page