pcs7 安装 server 2016_在 RHEL 和 CentOS 上检查或列出已安装的安全更新的两种方法 | Linux 中国...

66c02dff2c61b1327b0d65ccc66055ec.png在本文中,我们将向你展示如何检查已安装的安全更新。我会介绍两种方法,你可以选择最适合你的。-- Magesh Maruthamuthu

我们过去曾写过两篇关于这个主题的文章,每篇文章都是根据不同的要求发表的。如果你想在开始之前浏览这些文章。请通过以下链接:

◈ 如何检查 RHEL 和 CentOS 上的可用安全更新?◈ 在 RHEL 和 CentOS 上安装安全更新的四种方法?

这些文章与其他文章相互关联,因此,在深入研究之前,最好先阅读这些文章。

在本文中,我们将向你展示如何检查已安装的安全更新。我会介绍两种方法,你可以选择最适合你的。

此外,我还添加了一个小的 shell 脚本,它为你提供已安装的安全包计数。

运行以下命令获取系统上已安装的安全更新的列表。

# yum updateinfo list security installedLoaded plugins: changelog, package_upload, product-id, search-disabled-repos, : subscription-manager, verify, versionlockRHSA-2015:2315 Moderate/Sec. ModemManager-glib-1.1.0-8.git20130913.el7.x86_64RHSA-2015:2315 Moderate/Sec. NetworkManager-1:1.0.6-27.el7.x86_64RHSA-2016:2581 Low/Sec. NetworkManager-1:1.4.0-12.el7.x86_64RHSA-2017:2299 Moderate/Sec. NetworkManager-1:1.8.0-9.el7.x86_64RHSA-2015:2315 Moderate/Sec. NetworkManager-adsl-1:1.0.6-27.el7.x86_64RHSA-2016:2581 Low/Sec. NetworkManager-adsl-1:1.4.0-12.el7.x86_64RHSA-2017:2299 Moderate/Sec. NetworkManager-adsl-1:1.8.0-9.el7.x86_64RHSA-2015:2315 Moderate/Sec. NetworkManager-bluetooth-1:1.0.6-27.el7.x86_64

要计算已安装的安全包的数量,请运行以下命令:

# yum updateinfo list security installed | wc -l1046

仅打印安装包列表:

# yum updateinfo list security all | grep -w "i"i RHSA-2015:2315 Moderate/Sec. ModemManager-glib-1.1.0-8.git20130913.el7.x86_64i RHSA-2015:2315 Moderate/Sec. NetworkManager-1:1.0.6-27.el7.x86_64i RHSA-2016:2581 Low/Sec. NetworkManager-1:1.4.0-12.el7.x86_64i RHSA-2017:2299 Moderate/Sec. NetworkManager-1:1.8.0-9.el7.x86_64i RHSA-2015:2315 Moderate/Sec. NetworkManager-adsl-1:1.0.6-27.el7.x86_64i RHSA-2016:2581 Low/Sec. NetworkManager-adsl-1:1.4.0-12.el7.x86_64i RHSA-2017:2299 Moderate/Sec. NetworkManager-adsl-1:1.8.0-9.el7.x86_64i RHSA-2015:2315 Moderate/Sec. NetworkManager-bluetooth-1:1.0.6-27.el7.x86_64i RHSA-2016:2581 Low/Sec. NetworkManager-bluetooth-1:1.4.0-12.el7.x86_64i RHSA-2017:2299 Moderate/Sec. NetworkManager-bluetooth-1:1.8.0-9.el7.x86_64i RHSA-2015:2315 Moderate/Sec. NetworkManager-config-server-1:1.0.6-27.el7.x86_64i RHSA-2016:2581 Low/Sec. NetworkManager-config-server-1:1.4.0-12.el7.x86_64i RHSA-2017:2299 Moderate/Sec. NetworkManager-config-server-1:1.8.0-9.el7.noarch

要计算已安装的安全包的数量,请运行以下命令:

# yum updateinfo list security all | grep -w "i" | wc -l1043

或者,你可以检查指定包修复的漏洞列表。

在此例中,我们将检查 “openssh” 包中已修复的漏洞列表:

# rpm -q --changelog openssh | grep -i CVE- Fix for CVE-2017-15906 (#1517226)- CVE-2015-8325: privilege escalation via user's PAM environment and UseLogin=yes (#1329191)- CVE-2016-1908: possible fallback from untrusted to trusted X11 forwarding (#1298741)- CVE-2016-3115: missing sanitisation of input for X11 forwarding (#1317819)- prevents CVE-2016-0777 and CVE-2016-0778- Security fixes released with openssh-6.9 (CVE-2015-5352) (#1247864)- only query each keyboard-interactive device once (CVE-2015-5600) (#1245971)- add new option GSSAPIEnablek5users and disable using ~/.k5users by default CVE-2014-9278- prevent a server from skipping SSHFP lookup - CVE-2014-2653 (#1081338)- change default value of MaxStartups - CVE-2010-5107 (#908707)- CVE-2010-4755- merged cve-2007_3102 to audit patch- fixed audit log injection problem (CVE-2007-3102)- CVE-2006-5794 - properly detect failed key verify in monitor (#214641)- CVE-2006-4924 - prevent DoS on deattack detector (#207957)- CVE-2006-5051 - don't call cleanups from signal handler (#208459)- use fork+exec instead of system in scp - CVE-2006-0225 (#168167)

同样,你可以通过运行以下命令来检查相应的包中是否修复了指定的漏洞:

# rpm -q --changelog openssh | grep -i CVE-2016-3115- CVE-2016-3115: missing sanitisation of input for X11 forwarding (#1317819)

如何使用 Shell 脚本计算安装的安全包?

我添加了一个小的 shell 脚本,它可以帮助你计算已安装的安全包列表。

# vi /opt/scripts/security-check.sh#!/bin/bashecho "+-------------------------+"echo "|Security Advisories Count|"echo "+-------------------------+"for i in Important Moderate Lowdo sec=$(yum updateinfo list security installed | grep $i | wc -l) echo "$i: $sec"done | column -techo "+-------------------------+"

给 security-check.sh 文件执行权限。

$ chmod +x security-check.sh

最后执行脚本统计。

# sh /opt/scripts/security-check.sh+-------------------------+|Security Advisories Count|+-------------------------+Important: 480Moderate: 410Low: 111+-------------------------+

via: https://www.2daygeek.com/check-installed-security-updates-on-redhat-rhel-and-centos-system/

作者:Magesh Maruthamuthu 选题:lujun9972 译者:geekpi 校对:wxy

本文由 LCTT 原创编译,Linux中国 荣誉推出

d5de97ccc4eed00932d25f6c5b370dc9.png
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值