好吧,我认为内核/proc/sys/kernel/random/boot_id
在启动期间发生变化,然后在运行时保持该值是合乎逻辑的。如果 的预期用途boot_id
是找出机器何时重新启动,那么至少这对我来说是有意义的。
当使用监视文件时monit
,我注意到即使机器没有重新启动,文件似乎也发生了变化;这意味着文件的时间戳发生变化,而不是内容发生变化。
所以我想知道是谁更改了文件的时间戳。
作为参考,这是我正在使用的监视配置:
check file bootid with path /proc/sys/kernel/random/boot_id
#if changed timestamp then alert
if content !=
"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
then alert
if changed checksum then alert
group local
在检查监控结果时,我得到:
File 'bootid'
status OK
monitoring status Monitored
monitoring mode active
on reboot start
permission 444
uid 0
gid 0
size 0 B
access timestamp Tue, 07 May 2024 11:01:31
change timestamp Tue, 07 May 2024 11:01:31
modify timestamp Tue, 07 May 2024 11:01:31
content match no
checksum d174a6b860689b62417af5eccd2b17ee (MD5)
data collected Tue, 07 May 2024 11:46:11
交叉检查我得到:
# stat /proc/sys/kernel/random/boot_id
File: '/proc/sys/kernel/random/boot_id'
Size: 0 Blocks: 0 IO Block: 1024 regular empty file
Device: 4h/4d Inode: 9770501 Links: 1
Access: (0444/-r--r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2024-05-07 11:01:31.721335498 +0200
Modify: 2024-05-07 11:01:31.721335498 +0200
Change: 2024-05-07 11:01:31.721335498 +0200
Birth: -
# uptime
11:49am up 14 days 0:49, 4 users, load average: 0.00, 0.00, 0.00
系统在 x86_64 上运行 SLES12 SP5,唯一的“嫌疑人”是 cron-jobs 和“snapper”:
May 07 11:00:01 v04 systemd[1]: Started Session 7426 of user root.
May 07 11:00:01 v04 systemd[1]: Started Session 7428 of user root.
May 07 11:00:01 v04 systemd[1]: Started Session 7427 of user root.
May 07 11:00:01 v04 CRON[5541]: (root) CMD ([ -x /usr/lib64/sa/sa1 ] && exe
May 07 11:00:01 v04 run-crons[5606]: suse.de-snapper: OK