步骤一:查看 audit 目前生效的所有配置
/sbin/auditctl -s
步骤二:查看 audit 目前生效的所有规则
/sbin/auditctl -l
步骤三:生成 audit 报告
/sbin/aureport
/sbin/auditctl -s
/sbin/auditctl -l
/sbin/aureport
-w <command> -p x -k <search_key>
(
补充:
1) 这里的 <command> 是要监控的命令
2) 这里的 <search_key> 是个标识,用于简化在 audit 日志里搜索此命令
)
-w /usr/bin/rm -p x -k rm_command
(
补充:这里以
1) 监控 /usr/bin/rm 命令
2) 标识是 rm_command 为例
)
# augenrules
# service auditd restart
# auditctl -l
# ausearch -k rm_command
(补充:这里以查看标识为 rm_command 的 audit 日志为例)
https://access.redhat.com/solutions/3401281
SIOCADDRT: File Exists
确保以下目录中,网卡配置文件的 IP 地址只出现过了 1 次
/etc/sysconfig/network-scripts
# loginctl -a
SESSION UID USER SEAT TTY
27 1001 mingyuzhu pts/0
(
补充:从输出结果可以看出
1) 会话\进程的 SESSION 号码为 27
2) 创建会话\进程的用户 UID 是 1001
3) 创建会话\进程的用户是 mingyuzhu
4) 创建会话\进程的 SEAT TTY 是 pts/0
)
# loginctl terminate-session 27
(补充:这里以关闭 SESSION 号码是 27 的会话\进程为例)
# loginctl -a | grep mingyuzhu| awk '{print "loginctl terminate-session "$1;system("loginctl terminate-session "$1"")}'
# loginctl -a | grep mingyuzhu| awk '{print "loginctl terminate-session "$1;system("loginctl terminate-session "$1"")}' > /dev/null
或者:
# loginctl -a | grep mingyuzhu| `awk '{print "loginctl terminate-session "$1;system("loginctl terminate-session "$1"")}'`
[error] [/....../system-auth] has unexpected content!
[error] [/....../password-auth] has unexpected content!
[error] [/....../nsswitch.conf] has unexpected content!
[error] Unexpected changes to the configuration were detected.
[error] Refusing to activate profile unless those changes are removed or overwrite is requested.
Some unexpected changes to the configuration were detected. Use 'select' command instead.
# mv /etc/authselect/custom/password-policy /etc/authselect/custom/password-policy-backup
# authselect create-profile password-policy -b sssd --symlink-meta --symlink-pam
# authselect select custom/password-policy with-sudo with-faillock without-nullok with-mkhomedir --force
# dnf install oddjob ; systemctl enable --now oddjobd.service
# authselect apply-changes