NoPaste

/etc/cron.daily/maldet

von hume

SNIPPET_TEXT:
  1. #!/usr/bin/env bash
  2. export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
  3. export LMDCRON=1
  4. inspath='/usr/local/maldetect'
  5. intcnf="$inspath/internals/internals.conf"
  6.  
  7. if [ -f "$intcnf" ]; then
  8.         source $intcnf
  9. else
  10.         echo "\$intcnf not found."
  11.         exit 1
  12. fi
  13. if [ -f "$cnf" ]; then
  14.         source $cnf
  15.         if [ -f "$compatcnf" ]; then
  16.                 source $compatcnf
  17.         fi
  18. else
  19.         echo "could not find \$cnf, fatal error, bye."
  20.         exit 1
  21. fi
  22.  
  23. if [ -f "/etc/sysconfig/maldet" ]; then
  24.         . /etc/sysconfig/maldet
  25. elif [ -f "/etc/default/maldet" ]; then
  26.         . /etc/default/maldet
  27. fi
  28.  
  29. if [ -f "$cron_custom_conf" ]; then
  30.         . $cron_custom_conf
  31. fi
  32.  
  33. if [ -z "$scan_days" ]; then
  34.         scan_days=1
  35. fi
  36.  
  37. if [ -z "$cron_prune_days" ]; then
  38.         cron_prune_days=21
  39. fi
  40.  
  41. if [ "$find" ]; then
  42.         # prune any quarantine/session/tmp data older than 7 days
  43.         tmpdirs="$tmpdir $varlibpath/sess $varlibpath/quarantine $varlibpath/pub"
  44.         for dir in $tmpdirs; do
  45.          if [ -d "$dir" ]; then
  46.           $find $dir -type f -mtime +${cron_prune_days} -print0 | xargs -0 rm -f >> /dev/null 2>&1
  47.          fi
  48.         done
  49. fi
  50.  
  51. if [ "$autoupdate_version" == "1" ] || [ "$autoupdate_signatures" == "1" ]; then
  52.         # sleep for random 1-999s interval to better distribute upstream load
  53.         sleep $(echo $RANDOM | cut -c1-3) >> /dev/null 2>&1
  54. fi
  55.  
  56. if [ "$autoupdate_version" == "1" ]; then
  57.         # check for new release version
  58.         $inspath/maldet -d >> /dev/null 2>&1
  59. fi
  60.  
  61. if [ "$autoupdate_signatures" == "1" ]; then
  62.         # check for new definition set
  63.         $inspath/maldet -u >> /dev/null 2>&1
  64. fi
  65.  
  66. # if we're running inotify monitoring, send daily hit summary
  67. if [ "$(ps -A --user root -o "cmd" | grep -E maldetect | grep -E inotifywait)" ]; then
  68.         $inspath/maldet --monitor-report >> /dev/null 2>&1
  69. else
  70.         if [ -d "/home/virtual" ] && [ -d "/usr/lib/opcenter" ]; then
  71.                 # ensim
  72.                 $inspath/maldet -b -r /home/virtual/?/fst/var/www/html/,/home/virtual/?/fst/home/?/public_html/ $scan_days >> /dev/null 2>&1
  73.         elif [ -d "/etc/psa" ] && [ -d "/var/lib/psa" ]; then
  74.                 # psa
  75.                 $inspath/maldet -b -r /var/www/vhosts/?/ $scan_days >> /dev/null 2>&1
  76.         elif [ -d "/usr/local/directadmin" ]; then
  77.                 # DirectAdmin
  78.                 $inspath/maldet -b -r /home?/?/domains/?/public_html/,/var/www/html/?/ $scan_days >> /dev/null 2>&1
  79.         elif [ -d "/var/www/clients" ]; then
  80.                 # ISPConfig
  81.                 $inspath/maldet -b -r /var/www/clients/?/web?/web,/var/www/clients/?/web?/subdomains,/var/www $scan_days >> /dev/null 2>&1
  82.         elif [ -d "/etc/webmin/virtual-server" ]; then
  83.                 # Virtualmin
  84.                 $inspath/maldet -b -r /home/?/public_html/,/home/?/domains/?/public_html/ $scan_days >> /dev/null 2>&1
  85.         elif [ -d "/usr/local/ispmgr" ]; then
  86.                 # ISPmanager
  87.                 $inspath/maldet -b -r /var/www/?/data/,/home/?/data/ $scan_days >> /dev/null 2>&1
  88.         elif [ -d "/var/customers/webs" ]; then
  89.                 # froxlor
  90.                 $inspath/maldet -b -r /var/customers/webs/ $scan_days >> /dev/null 2>&1
  91.         elif [ -d "/usr/local/vesta" ]; then
  92.                 # VestaCP
  93.                 $inspath/maldet -b -r /home/?/web/?/public_html/,/home/?/web/?/public_shtml/,/home/?/tmp/,/home/?/web/?/private/ $scan_days >> /dev/null 2>&1
  94.         elif [ -d "/usr/share/dtc" ]; then
  95.                 # DTC
  96.                 if [ -f /var/lib/dtc/saved_install_config ]; then
  97.                     . /var/lib/dtc/saved_install_config
  98.                 fi
  99.                 $inspath/maldet -b -r ${conf_hosting_path:-/var/www/sites}/?/?/subdomains/?/html/ $scan_days >> /dev/null 2>&1
  100.         else
  101.                 # cpanel, interworx and other standard home/user/public_html setups
  102.                 $inspath/maldet -b -r /home?/?/public_html/,/var/www/html/,/usr/local/apache/htdocs/ $scan_days >> /dev/null 2>&1
  103.         fi
  104. fi
  105.  
  106. if [ -f "$cron_custom_exec" ]; then
  107.         . $cron_custom_exec
  108. fi

Quellcode

Hier kannst du den Code kopieren und ihn in deinen bevorzugten Editor einfügen. PASTEBIN_DOWNLOAD_SNIPPET_EXPLAIN