🕵️ Проверка на уязвимости с помощью сканера Openscap

openscap сканер уязвимостей

В RHEL поддержка безопасных и совместимых систем упрощается с помощью сканера openscap.

Что такое SCAP?

SCAP (Security Content Automation Protocol) – это проект NIST, который стандартизирует язык описания критериев и результатов оценки. Он также предоставляет систему оценки уязвимостей.

Критическими компонентами SCAP являются:

  • XCCDF: Расширяемый формат описания списков конфигурации, предназначенный для описания контрольных списков безопасности.
  • OVAL®: Open Vulnerability and Assessment Language – декларативный язык для создания логических утверждений о состоянии системы.
  • CCE™: Common Configuration Enumeration
  • CPE™: Common Platform Enumeration
  • CVE®: Common Vulnerabilities and Exposures
  • CVSS: Common Vulnerability Scoring System

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

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

Red Hat поставляет содержимое SCAP в руководстве SCAP, но содержимое, используемое OpenSCAP, находится в активной разработке, и последнюю версию можно найти по адресу: http://www.github.com/ComplianceAsCode.

 

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

Убедитесь, что Apache HTTPd, а также сканер OpenSCAP установлены, выполнив приведенную ниже команду; ее можно запускать даже в том случае, если эти пакеты уже существуют:

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

 

Пакет scap-security-guide содержит готовые системные профили для нескольких выпусков RHEL и типов систем; они устанавливаются в папку /usr/share/xml/scap/ssg/content.

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

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

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

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

 

Выполните начальную проверку соответствия с помощью сканера 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

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

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

Друзья помогите этому контенту стать доступнее в социальных сетях.

Не проходи мимо жмакни по кнопке возможно кому то еще он будет полезен!