: 本书中描述的每个软件所需的所有配置文件均由我们以 gzipped 文件的形式提供,floppy.tgz为了您的方便。可以从以下网址下载:http://www.openna.com/books/floppy.tgz 您可以将其解压缩到本地计算机上的任何位置,例如/tmp,假设您已完成此操作,您的目录结构将是/tmp/floppy。在此 floppy 目录中,每个配置文件都有其各自软件的目录。例如,sXid 配置文件按如下方式组织
如果您忠实地遵循我们从一开始的说明,您可以直接剪切和粘贴,或者手动编辑这些文件以满足您的需求。提供此功能是为了方便您,但请不要忘记,最终您有责任在使用它们之前检查、验证 等,无论是否修改过。
total 4 -rw-r--r-- 1 harrypotter harrypotter 1586 Jun 8 13:00 sxid.conf
: 要运行 sXid,需要从 floppy.tgz 存档中获取以下文件,并且必须创建或复制到服务器上的相应目录。将 sxid.conf 文件复制到/etc/目录。或者,您可以直接从本书中复制并粘贴到相关文件中。
sXid 的配置文件/etc/sxid.conf允许您设置修改程序操作的选项。它有很好的注释,并且非常基础。
编辑 sxid.conf 文件,使用命令 vi/etc/sxid.conf并根据您的需要进行设置
# Configuration file for sXid # Note that all directories must be absolute with no trailing /'s # Where to begin our file search SEARCH = "/" # Which subdirectories to exclude from searching EXCLUDE = "/proc /mnt /cdrom /floppy" # Who to send reports to EMAIL = "root" # Always send reports, even when there are no changes? ALWAYS_NOTIFY = "no" # Where to keep interim logs. This will rotate 'x' number of # times based on KEEP_LOGS below LOG_FILE = "/var/log/sxid.log" # How many logs to keep KEEP_LOGS = "5" # Rotate the logs even when there are no changes? ALWAYS_ROTATE = "no" # Directories where +s is forbidden (these are searched # even if not explicitly in SEARCH), EXCLUDE rules apply FORBIDDEN = "/home /tmp" # Remove (-s) files found in forbidden directories? ENFORCE = "yes" # This implies ALWAYS_NOTIFY. It will send a full list of # entries along with the changes LISTALL = "no" # Ignore entries for directories in these paths # (this means that only files will be recorded, you # can effectively ignore all directory entries by # setting this to "/"). The default is /home since # some systems have /home g+s. IGNORE_DIRS = "/home" # File that contains a list of (each on it's own line) # of other files that sxid should monitor. This is useful # for files that aren't +s, but relate to system # integrity (tcpd, inetd, apache...). # EXTRA_LIST = "/etc/sxid.list" # Mail program. This changes the default compiled in # mailer for reports. You only need this if you have changed # it's location and don't want to recompile sxid. # MAIL_PROG = "/usr/bin/mail" |
在 root 用户的 crontab 中添加一个条目,使 sXid 作为 cron 作业运行。sXid 将从 crond 运行;基本上,它会跟踪您的s[ug]id文件和文件夹中的任何更改。如果有任何新的文件或文件夹,或者不再设置的文件或文件夹,或者它们的位或其他模式已更改,则它会报告这些更改。要在您的 cron 作业中添加 sxid,您必须编辑 crontab 并添加以下行:要编辑 crontab,请使用命令 以 root 用户身份
[root@deep] /#crontab -e |
# Sample crontab entry to run every day at 4am 0 4 * * * /usr/bin/sxid |
更多详细信息,请参阅以下 man 手册:sxid.conf(5) - sxid 的配置设置 和 sxid(1) - 检查 s[ug]id 文件和目录中的更改
sXid 作为管理工具旨在作为 cron 作业运行。它必须每天运行一次,但繁忙的 shell 服务器可能希望每天运行两次。您也可以手动运行它进行抽查。要手动运行 sxid,请使用命令
[root@deep] /#sxid -k |
sXid 版本 : 4.0.1 检查运行时间 : 1999 年 12 月 29 日 星期三 12:40:32 主机名 : mail.openna.com 抽查路径 : /home/admin 排除路径 : /proc /mnt /cdrom /floppy 忽略目录: /home 禁止目录 : /home /tmp
未发现任何更改! 这通过递归当前工作目录来检查更改。日志文件不会轮换,也不会发送电子邮件。所有输出都将发送到 stdout。以下是 sXid 程序在您的系统上安装的文件。
/etc/sxid.conf |
/usr/bin/sxid |
/usr/man/man1/sxid.1 |
/usr/man/man5/sxid.conf.5 |