LMD(Linux恶意软件检测),未找到inotify进程Ubuntu 14.04 LTS
我正在使用Linux恶意软件检测,它真的很棒。我每天运行最近的maldet脚本4次,但我想让监视器运行,因为它是一个共享主机服务器 如果我运行maldet-m/home,我将得到以下错误:LMD(Linux恶意软件检测),未找到inotify进程Ubuntu 14.04 LTS,linux,ubuntu-14.04,inotify,Linux,Ubuntu 14.04,Inotify,我正在使用Linux恶意软件检测,它真的很棒。我每天运行最近的maldet脚本4次,但我想让监视器运行,因为它是一个共享主机服务器 如果我运行maldet-m/home,我将得到以下错误: maldet(19604): {mon} no inotify process found, check /usr/local/maldetect/inotify/inotify_log for errors. 问题是日志文件是空的,所以我不知道如何进一步 感谢您的帮助 我第一次回答时,在Plesk和CL
maldet(19604): {mon} no inotify process found, check /usr/local/maldetect/inotify/inotify_log for errors.
问题是日志文件是空的,所以我不知道如何进一步
感谢您的帮助 我第一次回答时,在Plesk和CL linux(基于centos)的VPS上也遇到了同样的问题,所以请对我温柔一点:) 我的解决方案不是很专业,但如果您需要在监控模式下运行maldet,这是一种变通方法(可能基于此的其他解决方案可以为您提供更好的解决方案) 因此,我做了
nano/usr/local/maldetect/maldet
,找到了包含$nice的行(这是在第1318行附近包含搜索词$nice的唯一一行)
它没有运行有两个原因
/proc/sys/fs/inotify/max_user_watchs
在运行此命令之前被设置为0
(因此我在$notice行之前添加了
echo 100000 > /proc/sys/fs/inotify/max_user_watches
/usr/local/maldetect/maldet -d >> /dev/null 2>&1
100000也可以更低,如果它太低,你会得到这样的错误
Apr 15 13:38:38 plesk2 inotifywait[889842]: Setting up watches. Beware: since -r was given, this may take a while!
Apr 15 13:38:38 plesk2 inotifywait[889842]: Failed to watch /var/www/vhosts/domain.com/httpdocs; upper limit on inotify watches reached!
在/var/log/messages
中(像这样搜索它们:grep inotify/var/log/messages
)/bin/nice -n 10 /usr/local/maldetect/inotify/inotifywait -d -r -o /usr/local/maldetect/inotify/inotify_log --fromfile /usr/local/maldetect/sess/inotify.paths.864367 --exclude (^/var/tmp/mysql.sock$|^/tmp/mysql.sock$|^/var/cache/buagent/md0.cache.data$|^/var/tmp/#sql_.*\.MYD$|^/tmp/#sql_.*\.MYD$) --timefmt %d %b %H:%M:%S --format %w%f %e %T -m -e create,move,modify
bash或sh对--exclude(^/var/tmp/mysql.sock$|^/tmp/mysql.sock$|^/var/cache/buagent/md0.cache.data$|^/var/tmp/#sql.*\.MYD$|^/tmp/#sql.*\.MYD$)
部分不满意,所以我刚从那行中删除了$exclude(我知道它不好,但如果我发现它我会发回,我正在处理它)
so线
$nice -n $inotify_nice $inotify -d -r -o $inotify_log --fromfile $inotify_fpaths $exclude --timefmt "%d %b %H:%M:%S" --format "%w%f %e %T" -m -e create,move,modify >> /dev/null 2>&1 &
改为
$nice -n $inotify_nice $inotify -d -r -o $inotify_log --fromfile $inotify_fpaths --timefmt "%d %b %H:%M:%S" --format "%w%f %e %T" -m -e create,move,modify >> /dev/null 2>&1 &
它成功了mysql -ss -uadmin -p`cat /etc/psa/.psa.shadow` psa -e "select www_root from hosting;" > /usr/local/maldetect/maldetfilelist
然后,您可以从以下内容开始LMD:
maldet -m /usr/local/maldetect/maldetfilelist
以上内容可在此处找到:
如果您想查看bash正在执行什么,请将其放在您想要的行之前(在我们的例子中是$nice行):
这里的神奇之处在于漂亮的set-x(为了不看到我在set+x
之后放的数百行调试代码)
对不起,我的英语太差了,希望能对你或其他人有所帮助
更新如果您更改了maldet文件中的任何内容,则有一个cron每天都在(/etc/cron.daily/maldet
)中运行,并且该行更具体
echo 100000 > /proc/sys/fs/inotify/max_user_watches
/usr/local/maldetect/maldet -d >> /dev/null 2>&1
每当发现文件maldet的md5发生了变化,上面这一行就会重新安装原来的一个:(所以我只是把它注释掉:)而monitor现在每天晚上都不停地工作:)
干杯
sassm430谢谢sassm430
您的具体演练没有帮助,但您发布了源代码(),我发现:
sed-i-e“s/\$inspath/inotify/inotifywait//usr/bin/inotifywait/”/usr/local/maldetect/internals.conf
您还可以手动编辑/usr/local/maldetect/internals.conf并编辑底部的这一行:
inotify=$inspath/inotify/inotifywait
将上述行更改为:
inotify=/usr/bin/inotifywait
现在显示器正在运行,我上传了一个已经隔离的文件,但它似乎不工作,或者显示器是如何工作的
监视器是否在重新启动时自动启动
编辑:我执行了以下命令:maldet-m users@Jonathan Lindgren
对我来说
inotify=$inspath/inotify/inotifywait
将上述行更改为:
inotify=/usr/bin/inotifywait
不起作用
我不是马尔代特布的专家,我唯一能告诉你的是
1) 我没有使用过maldet用户或类似的东西(在plesk上)
mysql-ss-uadmin-pcat/etc/psa/.psa.shadow
psa-e“从主机中选择www_root;”>/usr/local/maldetect/maldetfilelist
然后,您可以从以下内容开始LMD:
maldet -m /usr/local/maldetect/maldetfilelist
maldet-m/usr/local/maldetect/maldetfilelist
这将从plesk创建一个包含所有路径的文件
另一种选择是使用这样的东西
Apr 15 13:38:38 plesk2 inotifywait[889842]: Setting up watches. Beware: since -r was given, this may take a while!
Apr 15 13:38:38 plesk2 inotifywait[889842]: Failed to watch /var/www/vhosts/domain.com/httpdocs; upper limit on inotify watches reached!
maldet--m/var/www/vhosts/或maldet--m/var/www/vhosts/?/somesubfolder在哪里?意思是在bash上的所有类似*
2) 我能想到的另一个原因是,你确定inotify正在运行吗?也许你用光了inotify的观察者
cat/proc/sys/fs/inotify/max\u user\u手表
就在你喝了朗姆酒后。或者只是在日志文件上做一个tail-f,如果您在设备上没有更多的空间了,那么您可能已经用完了inotify watcher 但如果你告诉我们你的发行版等,这会有所帮助,正如我在最初的帖子中提到的,我在centos上使用云linux和plesk,有这个问题,但在centos上使用cloudlinux和cpanel,它是开箱即用的:((直到今天我还不明白为什么) 此外,我强烈建议您使用 集合x $nice-n$inotify\u nice$inotify-s-d-r-o$inotify\u日志--从文件$inotify\f路径--timemt“%d%b%H:%M:%s”--格式“%w%f%e%T”-M-e创建、移动、修改>>/dev/null 2>&1& 集合+x 将其放入maldet文件(在$nice行之前和之后),它将真正告诉您是否所有操作都正确执行:) 更新:也请检查我在第一个答案底部所做的更新,可能是你被它击中了(在这种情况下,监视器停止) 您还可以运行一个小脚本来检查monitor和inotifywatch是否正在运行,如果没有,则重新启动它们
希望您可以使用其中任何一个,如果我能进一步提供帮助,请让我知道。使用
$nice
而不仅仅是运行nice
是一种反模式——最好避免这种不好的做法。inotify的包装方式和所有未引用的扩展也是如此。(请尝试运行这些脚本,以获得改进建议)。感谢您的提示(shellcheck.net),我将尝试一下,关于这个案例,不幸的是,它是一个用于恶意软件检测的开源项目,Linux恶意软件检测(LMD)是一个恶意战