[步骤] auditd 日志传送到远端的日志搜集服务器的设置 (rsyslog 版) (RHEL 版)

正文:

步骤一:将 auditd 日志转换为系统日志

1.1 安装 audispd-plugins 组件 (只在 RHEL 8 和 RHEL 8 之后版本的 RHEL 上操作)

# dnf install audispd-plugins

(注意:只在 RHEL 8 和 RHEL 8 之后版本的 RHEL 上进行此操作)

1.2 将 auditd 日志转换为系统日志

如果是 RHEL 7 和 RHEL 7 之前的版本 RHEL:

# vim /etc/audisp/plugins.d/syslog.conf

将部分内容修改如下:

......
active = yes
......
args = LOG_INFO LOG_LOCAL3
......

(补充:这里以将 auditd 日志转换成系统的 local3 日志为例)


如果是 RHEL 8 和 RHEL 8 之后版本的 RHEL:

# vim /etc/audit/plugins.d/syslog.conf

将部分内容修改如下:

......
active = yes
......
args = LOG_INFO LOG_LOCAL3
......

(补充:这里以将 auditd 日志转换成系统的 local3 日志为例)

步骤二:将系统日志中的 auditd 日志传送到远端的日志搜集服务器

# vi /etc/rsyslog.conf

添加以下内容:

......
local3.info        @remotesyslog.com
local3.info        stop

(补充:这里以将 local3 日志传送到远端的日志搜集服务器 remotesyslog.com 为例)

步骤三:让刚刚修改的 auditd 配置文件生效

如果是 RHEL 6 和 RHEL 6 之前的版本 RHEL:

# service rsyslog restart
# service auditd restart

如果是 RHEL 7 和 RHEL 7 之后版本的 RHEL:

# systemctl restart rsyslog
# service auditd restart

步骤四:检测 auditd 日志是否传送到了远端的日志搜集服务器

4.1 在本地生成 auditd 日志用于检测

# auditctl -m "This is a test auditd message from client"

(补充:这里以在 auditd 日志里写入 1 条内容是 “This is a test auditd message from client” 的日志为例)

4.2 查看本地的系统日志

# tail -f /var/log/messages
...... auditd[......]: ......

(补充:此时可以看到 /var/log/messages 系统日志里有和 auditd 相关的日志)

4.3 在远端的日志搜集服务器检测是否收到 auditd 日志

(步骤略)

参考文献:

https://access.redhat.com/solutions/28676

[内容] Linux locale 的设置 (系统语言格式的设置)

内容一:全局设置 locale

1.1 通过 localectl 命令设置 locale

# localectl set-locale LANG=en_US.UTF-8

(补充:这里以将 locale 设置为 en_US.UTF-8 为例)

1.2 通过修改 /etc/locale.conf 设置 locale

# vi /etc/locale.conf

将全部内容修改如下:

LANG=en_US.UTF-8

(补充:这里以将 locale 设置为 en_US.UTF-8 为例)

内容二:只给某个用户设置 locale

2.1 通过修改 ~/.bash_profile 设置 locale

# vi ~/.bash_profile

添加以下内容:

......
LANG=en_US.UTF-8

(补充:这里以给当前用户将 locale 设置为 en_US.UTF-8 为例)

2.2 通过修改 ~/.bashrc 设置 locale

# vi ~/.bashrc

添加以下内容:

......
LANG=en_US.UTF-8

(补充:这里以给当前用户将 locale 设置为 en_US.UTF-8 为例)

补充:查看系统支持的所有系统语言格式

# locale -a

[CONTENT] Linux common parameters of /etc/fstab file

/dev/vg/lv_var /var xfs nodev,nosuid,noexec 0 0
/dev/vg/lv_var_log /var/log xfs nodev,nosuid,noexec,x-systemd.requires-mounts-for=/var 0 0

(
Add:
1) nodev parameter here means this directory can not be interpreted by devices or blocks
2) nosuid parameter here means no setuid files can be created in this directory
3) noexec parameter here means no files can be executed in this directory
4) x-systemd.requires-mounts-for=/var here parameter means /var/log directory can not be mounted until /var directory has been mounted
)