大网数据广告活动
服务器运维问答

Monit sshd binary Checksum Check and Restart

· 52CE 我爱测

I'm going over a monit config file and something doesn't seem right. I'm using monit to monitor the checksum of the sshd binary, if its different from whats expected it should reload a known binary. Is the below section correct f…

问题原文

原帖链接 · T. Thomas · CC BY-SA 3.0

I'm going over a monit config file and something doesn't seem right. I'm using monit to monitor the checksum of the sshd binary, if its different from whats expected it should reload a known binary. Is the below section correct for checking the checksum on the ssh binary? What does the monit daemon compare the current checksum with? No where in the file do I see any other mention of the checksum or outside tool to check the checksum.

check process ssh
    with pidfile "/var/run/sshd.pid"
    start program = "/sbin/service sshd start"
    stop program = "/sbin/service sshd stop"
    depends on sshd_binary

check file sshd_binary
    with path /usr/sbin/sshd
    if failed checksum then alert

已采纳解答

原帖链接 · sippybear · CC BY-SA 3.0

To check a file for any changes, use:

IF CHANGED [MD5|SHA1] CHECKSUM THEN action

Or if you've already computed the checksum on a file you expect to be static:

IF FAILED [MD5|SHA1] CHECKSUM [EXPECT checksum] THEN action

The EXPECT directive is optional. If you don't specify the expected checksum, then it uses the checksum of the file as of when the monitoring started.

For more details, check out monit's documentation: https://mmonit.com/monit/documentation/monit.html#FILE-CHECKSUM-TESTING

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-25)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。