
上QQ阅读APP看书,第一时间看更新
1.5.4 配置系统时间同步
风险分析 对于一个安全的系统来说,获取准确的时间是至关重要的,特别是对于一些和系统时间相关联的应用,比如Kerberos、NFS(Network File System,网络文件系统)等。
加固详情 配置系统时间同步。
加固步骤
(1)安装服务。
在系统中直接使用yum命令安装服务,依次执行以下命令。
yum install chrony yum install ntp
(2)配置chrony服务。
在文件/etc/chrony.conf中添加或者编辑参数server,形式如下。
server <remote-server>
在文件/etc/sysconfig/chronyd中添加或者编辑参数OPTIONS,添加-u chrony,形式如下。
OPTIONS="-u chrony"
配置完成信息如图1-14所示。

图1-14 配置chrony服务
(3)配置ntp服务。
在文件/etc/ntp.conf中添加或者编辑以下内容。
restrict -4 default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery
在文件/etc/ntp.conf中添加或者编辑参数server,形式如下。
server <remote-server>
在文件/etc/sysconfig/ntpd中添加或者编辑参数OPTIONS,添加 -u ntp:ntp,形式如下。
OPTIONS="-u ntp:ntp"
配置完成信息如图1-15所示。

图1-15 配置ntp服务
在系统执行以下命令,重启服务使配置生效。
systemctl daemon-reload systemctl --now enable ntpd