О сканере OpenSCAP

В этой статье расскажем, как можно проводить проверку на уязвимости с помощью сканера OpenSCAP.

Что такое OpenSCAP

OpenSCAP — сканер, который реализует инструменты для проведения SCAP-сканирования и устранения обнаруженных уязвимостей.

Подробнее можно почитать здесь → http://www.open-scap.org/ А вот репозиторий инструментов и профилей на GitHub → https://github.com/OpenSCAP/openscap/

Установка Httpd и сканера OpenSCAP

  1. Убеждаемся, что Apache HTTPd, а также сканер OpenSCAP установлены:

sudo yum install -y httpd openscap-scanner scap-security-guide

2. Получить информацию о профилях можно с помощью следующей команды:

oscap info --fetch-remote-resources /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml

Вывод:

# oscap info --fetch-remote-resources /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml
Document type: Source Data Stream
Imported: 2021-04-28T13:42:03

Stream: scap_org.open-scap_datastream_from_xccdf_ssg-rhel7-xccdf-1.2.xml
Generated: (null)
Version: 1.3
Checklists:
        Ref-Id: scap_org.open-scap_cref_ssg-rhel7-xccdf-1.2.xml
Downloading: https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL7.xml ... ok
                Status: draft
                Generated: 2021-04-28
                Resolved: true
                Profiles:
                        Title: NIST National Checklist Program Security Guide
                                Id: xccdf_org.ssgproject.content_profile_ncp
                        Title: DRAFT - ANSSI-BP-028 (high)
                                Id: xccdf_org.ssgproject.content_profile_anssi_nt28_high
                        Title: OSPP - Protection Profile for General Purpose Operating Systems v4.2.1
                                Id: xccdf_org.ssgproject.content_profile_ospp
                        Title: ANSSI-BP-028 (intermediary)
                                Id: xccdf_org.ssgproject.content_profile_anssi_nt28_intermediary
                        Title: Red Hat Corporate Profile for Certified Cloud Providers (RH CCP)
                                Id: xccdf_org.ssgproject.content_profile_rht-ccp
                        Title: ANSSI-BP-028 (enhanced)
                                Id: xccdf_org.ssgproject.content_profile_anssi_nt28_enhanced
                        Title: [DRAFT] DISA STIG for Red Hat Enterprise Linux Virtualization Host (RHELH)
                                Id: xccdf_org.ssgproject.content_profile_rhelh-stig
                        Title: CIS Red Hat Enterprise Linux 7 Benchmark
                                Id: xccdf_org.ssgproject.content_profile_cis
                        Title: Unclassified Information in Non-federal Information Systems and Organizations (NIS
T 800-171)
                                Id: xccdf_org.ssgproject.content_profile_cui
                                Id: xccdf_org.ssgproject.content_profile_e8
                        Title: ANSSI-BP-028 (minimal)
                                Id: xccdf_org.ssgproject.content_profile_anssi_nt28_minimal
                        Title: Health Insurance Portability and Accountability Act (HIPAA)
                                Id: xccdf_org.ssgproject.content_profile_hipaa
                        Title: DISA STIG for Red Hat Enterprise Linux 7
                                Id: xccdf_org.ssgproject.content_profile_stig
                        Title: PCI-DSS v3.2.1 Control Baseline for Red Hat Enterprise Linux 7
                                Id: xccdf_org.ssgproject.content_profile_pci-dss
                Referenced check files:
                        ssg-rhel7-oval.xml
                                system: http://oval.mitre.org/XMLSchema/oval-definitions-5
                        ssg-rhel7-ocil.xml
                                system: http://scap.nist.gov/schema/ocil/2
                        security-data-oval-com.redhat.rhsa-RHEL7.xml
                                system: http://oval.mitre.org/XMLSchema/oval-definitions-5
        Ref-Id: scap_org.open-scap_cref_ssg-rhel7-pcidss-xccdf-1.2.xml
Downloading: https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL7.xml ... ok
                Status: draft
                Generated: 2021-04-28
                Resolved: true
                Profiles:
                        Title: PCI-DSS v3.2.1 Control Baseline for Red Hat Enterprise Linux 7
                                Id: xccdf_org.ssgproject.content_profile_pci-dss_centric
                Referenced check files:
                        ssg-rhel7-oval.xml
                                system: http://oval.mitre.org/XMLSchema/oval-definitions-5
                        ssg-rhel7-ocil.xml
                                system: http://scap.nist.gov/schema/ocil/2
                        security-data-oval-com.redhat.rhsa-RHEL7.xml
                                system: http://oval.mitre.org/XMLSchema/oval-definitions-5
Checks:
        Ref-Id: scap_org.open-scap_cref_ssg-rhel7-oval.xml
        Ref-Id: scap_org.open-scap_cref_ssg-rhel7-ocil.xml
        Ref-Id: scap_org.open-scap_cref_ssg-rhel7-cpe-oval.xml
        Ref-Id: scap_org.open-scap_cref_ssg-rhel7-oval.xml000
        Ref-Id: scap_org.open-scap_cref_ssg-rhel7-ocil.xml000
        Ref-Id: scap_org.open-scap_cref_security-data-oval-com.redhat.rhsa-RHEL7.xml
Dictionaries:
        Ref-Id: scap_org.open-scap_cref_ssg-rhel7-cpe-dictionary.xml

Включение httpd для просмотра отчета о соответствии со сканера OpenSCAP

  1. Вводим команду, чтобы включить веб-сервер Apache и разрешить клиенту доступ к нему:

firewall-cmd --permanent --zone=public --add-service=http
systemctl reload firewalld
systemctl enable --now httpd

2. Выполняем начальную проверку соответствия с помощью OpenSCAP

Используем профиль OSPP для RHEL 8 с помощью следующей команды. Профиль задается с помощью поля Id:

# sudo oscap xccdf eval --fetch-remote-resources --profile xccdf_org.ssgproject.content_profile_ospp --results-arf /t
mp/arf.xml --report /var/www/html/report.html /usr/share/xml/scap/ssg/content/ssg-rhel7-ds.xml
Downloading: https://www.redhat.com/security/data/oval/com.redhat.rhsa-RHEL7.xml ... ok
Title   Install the dracut-fips Package
Rule    xccdf_org.ssgproject.content_rule_package_dracut-fips_installed
Ident   CCE-80358-5
Result  notapplicable
Title   Enable FIPS Mode in GRUB2
Rule    xccdf_org.ssgproject.content_rule_grub2_enable_fips_mode
Ident   CCE-80359-3
Result  notapplicable
................
.....
Title   Use Only FIPS 140-2 Validated Ciphers
Rule    xccdf_org.ssgproject.content_rule_sshd_use_approved_ciphers
Ident   CCE-27295-5
Result  notapplicable
Title   Disable Host-Based Authentication
Rule    xccdf_org.ssgproject.content_rule_disable_host_auth
Ident   CCE-27413-4
Result  notapplicable
Title   Disable GSSAPI Authentication
Rule    xccdf_org.ssgproject.content_rule_sshd_disable_gssapi_auth
Ident   CCE-80220-7
Result  notapplicable
Title   Disable SSH Root Login
Rule    xccdf_org.ssgproject.content_rule_sshd_disable_root_login
Ident   CCE-27445-6
Result  notapplicable

3. Команды выводят результат сканирования на соответствие требованиям в файл Asset Reporting Format (ARF) и формируют отчет в формате HTML.

4. По окончании выполнения команды открываем ссылку в новой вкладке, чтобы просмотреть отчет → http://master.unixcop.com/report.html

Last updated