file

    Lynis — это инструмент для аудита безопасности в Unix и Linux ОС. Он выполняет глубокие проверки безопасности, практически без настройки. Он работает на самом хосте, поэтому он выполняет более обширные проверки безопасности, чем сканеры уязвимостей.

    Lynis выполняет сотни отдельных тестов, чтобы определить состояние безопасности системы. Сама проверка безопасности состоит в выполнении набора шагов от инициализации программы до его отчета:

    • Определяет операционную систему.
    • Поиск доступных инструментов и утилит.
    • Проверка Lynis обновлений.
    • Запуск тестов для включенных плагинов.
    • Запуск тестов безопасности для каждой категории.
    • Состояние отчета проверки безопасности.

    Во время сканирования технические данные о сканировании хранятся в лог-файл. В то же время результаты (предупреждения, предложения, сбор данных) хранятся в файле отчета.

    Скачаем архив с исходными кодами и распаковать во временную директорию.
    https://cisofy.com/download/lynis/

    cd /tmp  
    wget https://cisofy.com/files/lynis-3.0.3.tar.gz  
    tar xvfz lynis-3.0.3.tar.gz  
    mv lynis /usr/local/  
    ln -s /usr/local/lynis/lynis /usr/local/bin/lynis  
    
    [email protected]:~# cd /tmp  
    [email protected]:/tmp# wget https://cisofy.com/files/lynis-3.0.3.tar.gz  
    --2021-02-22 18:13:58--  https://cisofy.com/files/lynis-3.0.3.tar.gz
    Resolving cisofy.com (cisofy.com)... 37.97.224.115, 2a01:7c8:aac4:309::1  
    Connecting to cisofy.com (cisofy.com)|37.97.224.115|:443... connected.  
    HTTP request sent, awaiting response... 301 Moved Permanently  
    Location: https://downloads.cisofy.com/lynis/lynis-3.0.3.tar.gz [following]  
    --2021-02-22 18:13:58--  https://downloads.cisofy.com/lynis/lynis-3.0.3.tar.gz
    Resolving downloads.cisofy.com (downloads.cisofy.com)... 37.97.194.171, 2a01:7c8:aac2:37b::1  
    Connecting to downloads.cisofy.com (downloads.cisofy.com)|37.97.194.171|:443... connected.  
    HTTP request sent, awaiting response... 200 OK  
    Length: 331182 (323K) [application/octet-stream]  
    Saving to: ‘lynis-3.0.3.tar.gz’  
    
    lynis-3.0.3.tar.gz    100%[=========================>] 323.42K  --.-KB/s    in 0.03s  
    
    2021-02-22 18:13:58 (9.72 MB/s) - ‘lynis-3.0.3.tar.gz’ saved [331182/331182]  
    
    [email protected]:/tmp# tar xvfz lynis-3.0.3.tar.gz  
    lynis/CHANGELOG.md  
    lynis/CODE_OF_CONDUCT.md  
    lynis/CONTRIBUTING.md  
    lynis/CONTRIBUTORS.md  
    lynis/FAQ  
    lynis/HAPPY_USERS.md  
    lynis/INSTALL  
    lynis/LICENSE  
    lynis/README  
    lynis/SECURITY.md  
    lynis/db/  
    lynis/db/languages/  
    lynis/db/languages/da  
    lynis/db/languages/ru  
    lynis/db/languages/sk  
    lynis/db/languages/he  
    lynis/db/languages/pl  
    lynis/db/languages/gr  
    lynis/db/languages/pt  
    lynis/db/languages/en-GB  
    lynis/db/languages/fr  
    lynis/db/languages/en  
    lynis/db/languages/de  
    lynis/db/languages/cn  
    lynis/db/languages/br  
    lynis/db/languages/nl-BE  
    lynis/db/languages/nl-NL  
    lynis/db/languages/ko  
    lynis/db/languages/tr  
    lynis/db/languages/hu  
    lynis/db/languages/es  
    lynis/db/languages/se  
    lynis/db/languages/ja  
    lynis/db/languages/de-AT  
    lynis/db/languages/nl  
    lynis/db/languages/en-US  
    lynis/db/languages/az  
    lynis/db/languages/fi  
    lynis/db/languages/nb-NO  
    lynis/db/languages/it  
    lynis/db/tests.db  
    lynis/db/malware.db  
    lynis/db/integrity.db  
    lynis/db/hints.db  
    lynis/db/software-eol.db  
    lynis/db/malware-susp.db  
    lynis/db/fileperms.db  
    lynis/db/sbl.db  
    lynis/default.prf  
    lynis/developer.prf  
    lynis/extras/  
    lynis/extras/build-lynis.sh  
    lynis/extras/bash_completion.d/  
    lynis/extras/bash_completion.d/lynis  
    lynis/extras/systemd/  
    lynis/extras/systemd/lynis.timer  
    lynis/extras/systemd/lynis.service  
    lynis/extras/README  
    lynis/extras/files.dat  
    lynis/extras/openbsd/  
    lynis/extras/openbsd/+CONTENTS  
    lynis/extras/lynis.spec  
    lynis/extras/travis-ci/  
    lynis/extras/travis-ci/before_script.sh  
    lynis/extras/check-lynis.sh  
    lynis/include/  
    lynis/include/tests_system_integrity  
    lynis/include/tests_usb  
    lynis/include/tests_homedirs  
    lynis/include/profiles  
    lynis/include/tests_kernel_hardening  
    lynis/include/tool_tips  
    lynis/include/tests_networking  
    lynis/include/helper_update  
    lynis/include/tests_virtualization  
    lynis/include/tests_banners  
    lynis/include/helper_generate  
    lynis/include/functions  
    lynis/include/tests_filesystems  
    lynis/include/parameters  
    lynis/include/tests_file_integrity  
    lynis/include/tests_php  
    lynis/include/tests_databases  
    lynis/include/tests_accounting  
    lynis/include/tests_file_permissions  
    lynis/include/tests_storage  
    lynis/include/tests_custom.template  
    lynis/include/helper_system_remote_scan  
    lynis/include/data_upload  
    lynis/include/tests_squid  
    lynis/include/tests_ports_packages  
    lynis/include/tests_scheduling  
    lynis/include/binaries  
    lynis/include/tests_authentication  
    lynis/include/tests_logging  
    lynis/include/tests_time  
    lynis/include/tests_containers  
    lynis/include/tests_webservers  
    lynis/include/tests_insecure_services  
    lynis/include/tests_tooling  
    lynis/include/tests_storage_nfs  
    lynis/include/osdetection  
    lynis/include/tests_ssh  
    lynis/include/tests_mail_messaging  
    lynis/include/consts  
    lynis/include/tests_memory_processes  
    lynis/include/tests_ldap  
    lynis/include/tests_malware  
    lynis/include/tests_crypto  
    lynis/include/report  
    lynis/include/helper_configure  
    lynis/include/tests_printers_spoolers  
    lynis/include/tests_dns  
    lynis/include/tests_snmp  
    lynis/include/tests_shells  
    lynis/include/helper_audit_dockerfile  
    lynis/include/helper_show  
    lynis/include/tests_hardening  
    lynis/include/tests_mac_frameworks  
    lynis/include/tests_firewalls  
    lynis/include/tests_nameservices  
    lynis/include/tests_boot_services  
    lynis/include/tests_kernel  
    lynis/lynis  
    lynis/lynis.8  
    lynis/plugins/  
    lynis/plugins/custom_plugin.template  
    lynis/plugins/README  
    [email protected]:/tmp# mv lynis /usr/local/  
    [email protected]:/tmp# ln -s /usr/local/lynis/lynis /usr/local/bin/lynis  
    

    Это установит Lynis в каталог /usr/local/lynis и создаст symlink для легкого доступа.

    Проверим версию утилиты:

    lynis update info  
    
    [email protected]:/tmp# lynis update info  
    
     == Lynis ==
    
      Version            : 3.0.3
      Status             : Up-to-date
      Release date       : 2021-01-07
      Project page       : https://cisofy.com/lynis/
      Source code        : https://github.com/CISOfy/lynis
      Latest package     : https://packages.cisofy.com/
    
    
    2007-2021, CISOfy - https://cisofy.com/lynis/  
    

    Чтобы запустить Lynis, достаточно указать хотя бы один ключ.
    К примеру, для запуска всех имеющихся тестов следует указать ключ -c (check all, проверить все):

    # Типовой набор тестов
    sudo lynis audit system  
    # Полный набор тестов
    sudo lynis audit system -c  
    # Сканирование удаленного хоста
    audit system remote <host>  
    
    lynis audit system  
    
    [email protected]:/tmp# lynis audit system  
    
    [ Lynis 3.0.3 ]
    
    ################################################################################
      Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are
      welcome to redistribute it under the terms of the GNU General Public License.
      See the LICENSE file for details about using this software.
    
      2007-2021, CISOfy - https://cisofy.com/lynis/
      Enterprise support available (compliance, plugins, interface and tools)
    ################################################################################
    
    
    [+] Initializing program
    ------------------------------------
      - Detecting OS...                                           [ DONE ]
      - Checking profiles...                                      [ DONE ]
    
      ---------------------------------------------------
      Program version:           3.0.3
      Operating system:          Linux
      Operating system name:     Ubuntu
      Operating system version:  20.04
      Kernel version:            5.4.0
      Hardware platform:         x86_64
      Hostname:                  dsde949-22869
      ---------------------------------------------------
      Profiles:                  /usr/local/lynis/default.prf
      Log file:                  /var/log/lynis.log
      Report file:               /var/log/lynis-report.dat
      Report version:            1.0
      Plugin directory:          /usr/local/lynis/plugins
      ---------------------------------------------------
      Auditor:                   [Not Specified]
      Language:                  en
      Test category:             all
      Test group:                all
      ---------------------------------------------------
      - Program update status...                                  [ NO UPDATE ]
    
    [+] System tools
    ------------------------------------
      - Scanning available tools...
      - Checking system binaries...
    
    [+] Plugins (phase 1)
    ------------------------------------
     Note: plugins have more extensive tests and may take several minutes to complete
    
      - Plugins enabled                                           [ NONE ]
    
    [+] Boot and services
    ------------------------------------
      - Service Manager                                           [ systemd ]
      - Checking UEFI boot                                        [ DISABLED ]
      - Checking presence GRUB2                                   [ FOUND ]
        - Checking for password protection                        [ NONE ]
      - Check running services (systemctl)                        [ DONE ]
            Result: found 26 running services
      - Check enabled services at boot (systemctl)                [ DONE ]
            Result: found 57 enabled services
      - Check startup files (permissions)                         [ OK ]
      - Running 'systemd-analyze security'
            - accounts-daemon.service:                            [ UNSAFE ]
            - apache2.service:                                    [ UNSAFE ]
            - apport.service:                                     [ UNSAFE ]
            - atd.service:                                        [ UNSAFE ]
            - cron.service:                                       [ UNSAFE ]
            - dbus.service:                                       [ UNSAFE ]
            - dm-event.service:                                   [ UNSAFE ]
            - dmesg.service:                                      [ UNSAFE ]
            - dovecot.service:                                    [ EXPOSED ]
            - emergency.service:                                  [ UNSAFE ]
            - exim4.service:                                      [ UNSAFE ]
            - fwupd.service:                                      [ EXPOSED ]
            - [email protected]:                                 [ UNSAFE ]
            - grub-common.service:                                [ UNSAFE ]
            - hestia.service:                                     [ UNSAFE ]
            - [email protected]:                                  [ UNSAFE ]
            - irqbalance.service:                                 [ MEDIUM ]
            - iscsid.service:                                     [ UNSAFE ]
            - lvm2-lvmpolld.service:                              [ UNSAFE ]
            - lxd-agent.service:                                  [ UNSAFE ]
            - mariadb.service:                                    [ MEDIUM ]
            - multipathd.service:                                 [ UNSAFE ]
            - nginx.service:                                      [ UNSAFE ]
            - ondemand.service:                                   [ UNSAFE ]
            - open-vm-tools.service:                              [ UNSAFE ]
            - php7.4-fpm.service:                                 [ UNSAFE ]
            - plymouth-start.service:                             [ UNSAFE ]
            - polkit.service:                                     [ UNSAFE ]
            - qemu-guest-agent.service:                           [ UNSAFE ]
            - rc-local.service:                                   [ UNSAFE ]
            - rescue.service:                                     [ UNSAFE ]
            - rsync.service:                                      [ UNSAFE ]
            - rsyslog.service:                                    [ UNSAFE ]
            - [email protected]:                         [ UNSAFE ]
            - snapd.service:                                      [ UNSAFE ]
            - ssh.service:                                        [ UNSAFE ]
            - systemd-ask-password-console.service:               [ UNSAFE ]
            - systemd-ask-password-plymouth.service:              [ UNSAFE ]
            - systemd-ask-password-wall.service:                  [ UNSAFE ]
            - systemd-fsckd.service:                              [ UNSAFE ]
            - systemd-initctl.service:                            [ UNSAFE ]
            - systemd-journald.service:                           [ OK ]
            - systemd-logind.service:                             [ OK ]
            - systemd-rfkill.service:                             [ UNSAFE ]
            - systemd-timesyncd.service:                          [ OK ]
            - systemd-udevd.service:                              [ EXPOSED ]
            - thermald.service:                                   [ UNSAFE ]
            - unattended-upgrades.service:                        [ UNSAFE ]
            - [email protected]:                                     [ UNSAFE ]
            - uuidd.service:                                      [ OK ]
            - vgauth.service:                                     [ UNSAFE ]
            - vsftpd.service:                                     [ UNSAFE ]
    
    [+] Kernel
    ------------------------------------
      - Checking default run level                                [ RUNLEVEL 5 ]
      - Checking CPU support (NX/PAE)
        CPU support: PAE and/or NoeXecute supported               [ FOUND ]
      - Checking kernel version and release                       [ DONE ]
      - Checking kernel type                                      [ DONE ]
      - Checking loaded kernel modules                            [ DONE ]
          Found 58 active modules
      - Checking Linux kernel configuration file                  [ FOUND ]
      - Checking default I/O kernel scheduler                     [ NOT FOUND ]
      - Checking for available kernel update                      [ OK ]
      - Checking core dumps configuration
        - configuration in systemd conf files                     [ DEFAULT ]
        - configuration in etc/profile                            [ DEFAULT ]
        - 'hard' configuration in security/limits.conf            [ DEFAULT ]
        - 'soft' configuration in security/limits.conf            [ DEFAULT ]
        - Checking setuid core dumps configuration                [ PROTECTED ]
      - Check if reboot is needed                                 [ YES ]
    
    [+] Memory and Processes
    ------------------------------------
      - Checking /proc/meminfo                                    [ FOUND ]
      - Searching for dead/zombie processes                       [ NOT FOUND ]
      - Searching for IO waiting processes                        [ NOT FOUND ]
      - Search prelink tooling                                    [ NOT FOUND ]
    
    [+] Users, Groups and Authentication
    ------------------------------------
      - Administrator accounts                                    [ OK ]
      - Unique UIDs                                               [ WARNING ]
      - Consistency of group files (grpck)                        [ OK ]
      - Unique group IDs                                          [ OK ]
      - Unique group names                                        [ OK ]
      - Password file consistency                                 [ OK ]
      - Password hashing methods                                  [ SUGGESTION ]
      - Checking password hashing rounds                          [ DISABLED ]
      - Query system users (non daemons)                          [ DONE ]
      - NIS+ authentication support                               [ NOT ENABLED ]
      - NIS authentication support                                [ NOT ENABLED ]
      - Sudoers file(s)                                           [ FOUND ]
        - Permissions for directory: /etc/sudoers.d               [ WARNING ]
        - Permissions for: /etc/sudoers                           [ OK ]
        - Permissions for: /etc/sudoers.d/admin                   [ OK ]
        - Permissions for: /etc/sudoers.d/README                  [ OK ]
        - Permissions for: /etc/sudoers.d/99-snapd.conf           [ OK ]
      - PAM password strength tools                               [ SUGGESTION ]
      - PAM configuration files (pam.conf)                        [ FOUND ]
      - PAM configuration files (pam.d)                           [ FOUND ]
      - PAM modules                                               [ FOUND ]
      - LDAP module in PAM                                        [ NOT FOUND ]
      - Accounts without expire date                              [ SUGGESTION ]
      - Accounts without password                                 [ OK ]
      - Locked accounts                                           [ OK ]
      - Checking user password aging (minimum)                    [ DISABLED ]
      - User password aging (maximum)                             [ DISABLED ]
      - Checking expired passwords                                [ OK ]
      - Checking Linux single user mode authentication            [ OK ]
      - Determining default umask
        - umask (/etc/profile)                                    [ NOT FOUND ]
        - umask (/etc/login.defs)                                 [ SUGGESTION ]
      - LDAP authentication support                               [ NOT ENABLED ]
      - Logging failed login attempts                             [ ENABLED ]
    
    [+] Shells
    ------------------------------------
      - Checking shells from /etc/shells
        Result: found 10 shells (valid shells: 10).
        - Session timeout settings/tools                          [ NONE ]
      - Checking default umask values
        - Checking default umask in /etc/bash.bashrc              [ NONE ]
        - Checking default umask in /etc/profile                  [ NONE ]
    
    [+] File systems
    ------------------------------------
      - Checking mount points
        - Checking /home mount point                              [ SUGGESTION ]
        - Checking /tmp mount point                               [ SUGGESTION ]
        - Checking /var mount point                               [ SUGGESTION ]
      - Query swap partitions (fstab)                             [ OK ]
      - Testing swap partitions                                   [ OK ]
      - Testing /proc mount (hidepid)                             [ OK ]
      - Checking for old files in /tmp                            [ OK ]
      - Checking /tmp sticky bit                                  [ OK ]
      - Checking /var/tmp sticky bit                              [ OK ]
      - ACL support root file system                              [ ENABLED ]
      - Mount options of /                                        [ OK ]
      - Mount options of /dev                                     [ HARDENED ]
      - Mount options of /dev/shm                                 [ PARTIALLY HARDENED ]
      - Mount options of /run                                     [ HARDENED ]
      - Total without nodev:5 noexec:5 nosuid:3 ro or noexec (W^X): 5 of total 33
      - Disable kernel support of some filesystems
        - Discovered kernel modules: cramfs freevxfs jffs2 udf 
    
    [+] USB Devices
    ------------------------------------
      - Checking usb-storage driver (modprobe config)             [ NOT DISABLED ]
      - Checking USB devices authorization                        [ ENABLED ]
      - Checking USBGuard                                         [ NOT FOUND ]
    
    [+] Storage
    ------------------------------------
      - Checking firewire ohci driver (modprobe config)           [ DISABLED ]
    
    [+] NFS
    ------------------------------------
      - Check running NFS daemon                                  [ NOT FOUND ]
    
    [+] Name services
    ------------------------------------
      - Checking /etc/resolv.conf options                         [ FOUND ]
      - Searching DNS domain name                                 [ FOUND ]
          Domain name: fornex.org
      - Checking /etc/hosts
        - Duplicate entries in hosts file                         [ NONE ]
        - Presence of configured hostname in /etc/hosts           [ NOT FOUND ]
        - Hostname mapped to localhost                            [ NOT FOUND ]
        - Localhost mapping to IP address                         [ OK ]
    
    [+] Ports and packages
    ------------------------------------
      - Searching package managers
        - Searching dpkg package manager                          [ FOUND ]
          - Querying package manager
        - Query unpurged packages                                 [ FOUND ]
      - Checking security repository in sources.list file         [ OK ]
      - Checking APT package database                             [ OK ]
      - Checking vulnerable packages                              [ OK ]
    
      [WARNING]: Test PKGS-7392 had a long execution: 25.953545 seconds
    
      - Checking upgradeable packages                             [ SKIPPED ]
      - Checking package audit tool                               [ INSTALLED ]
        Found: apt-check
      - Toolkit for automatic upgrades (unattended-upgrade)       [ FOUND ]
    
    [+] Networking
    ------------------------------------
      - Checking IPv6 configuration                               [ ENABLED ]
          Configuration method                                    [ AUTO ]
          IPv6 only                                               [ NO ]
      - Checking configured nameservers
        - Testing nameservers
            Nameserver: 91.228.153.88                             [ OK ]
            Nameserver: 212.224.118.111                           [ OK ]
            Nameserver: 185.18.52.124                             [ OK ]
        - Minimal of 2 responsive nameservers                     [ OK ]
        - DNSSEC supported (systemd-resolved)                     [ UNKNOWN ]
      - Getting listening ports (TCP/UDP)                         [ DONE ]
      - Checking promiscuous interfaces                           [ OK ]
      - Checking status DHCP client
      - Checking for ARP monitoring software                      [ NOT FOUND ]
      - Uncommon network protocols                                [ 0 ]
    
    [+] Printers and Spools
    ------------------------------------
      - Checking cups daemon                                      [ NOT FOUND ]
      - Checking lp daemon                                        [ NOT RUNNING ]
    
    [+] Software: e-mail and messaging
    ------------------------------------
      - Exim status                                               [ RUNNING ]
        - Type                                                    [ NOT CONFIGURED ]
      - Dovecot status                                            [ RUNNING ]
    
    [+] Software: firewalls
    ------------------------------------
      - Checking iptables kernel module                           [ FOUND ]
        - Checking iptables policies of chains                    [ FOUND ]
        - Checking for empty ruleset                              [ WARNING ]
        - Checking for unused rules                               [ OK ]
      - Checking host based firewall                              [ ACTIVE ]
    
    [+] Software: webserver
    ------------------------------------
      - Checking Apache (binary /usr/sbin/apache2)                [ FOUND ]
          Info: Configuration file found (/etc/apache2/apache2.conf)
          Info: Found 8 virtual hosts
        * Loadable modules                                        [ FOUND (120) ]
            - Found 120 loadable modules
              mod_evasive: anti-DoS/brute force                   [ NOT FOUND ]
              mod_reqtimeout/mod_qos                              [ FOUND ]
              ModSecurity: web application firewall               [ NOT FOUND ]
      - Checking nginx                                            [ FOUND ]
        - Searching nginx configuration file                      [ FOUND ]
          - Found nginx includes                                  [ 6 FOUND ]
        - Parsing configuration options
            - /etc/nginx/nginx.conf
            - /etc/nginx/conf.d/212.224.113.76.conf
            - /etc/nginx/conf.d/status.conf
            - /etc/nginx/conf.d/domains/mecmep.site.conf
            - /etc/nginx/conf.d/domains/mecmep.site.ssl.conf
            - /etc/nginx/conf.d/domains/webmail.mecmep.site.conf
          - SSL configured                                        [ YES ]
            - Ciphers configured                                  [ YES ]
            - Prefer server ciphers                               [ YES ]
            - Protocols configured                                [ YES ]
              - Insecure protocols found                          [ NO ]
          - Checking log file configuration
            - Missing log files (access_log)                      [ NO ]
            - Disabled access logging                             [ YES ]
            - Missing log files (error_log)                       [ NO ]
            - Debugging mode on error_log                         [ NO ]
    
    
    

    Предложения по исправлению

    Во время аудита приложение Lynis проводит несколько тестов, разделенных на категории. После каждого этапа в стандартный вывод (на экран) выводятся результаты тестов, отладочная информация и предложения по защите системы.

    Все предупреждения (Warnings) будут перечислены после результатов. Каждое начинается с текста предупреждения, потом рядом в скобках указывается тест, который его сгенерировал. В следующей строке предлагается решение проблемы, если оно существует.
    Последняя строка — это URL-адрес, по которому вы сможете посмотреть подробности и найти дополнительные рекомендации, как устранить возникшую проблему.

     Warnings (3):
      ----------------------------
      ! Reboot of system is most likely needed [KRNL-5830] 
        - Solution : reboot
          https://cisofy.com/lynis/controls/KRNL-5830/
    
      ! Multiple accounts found with same UID [AUTH-9208] 
          https://cisofy.com/lynis/controls/AUTH-9208/
    
      ! iptables module(s) loaded, but no rules active [FIRE-4512] 
          https://cisofy.com/lynis/controls/FIRE-4512/
    
      Suggestions (52):
      ----------------------------
      * Set a password on GRUB boot loader to prevent altering boot configuration (e.g. boot in single user mode without password) [BOOT-5122] 
          https://cisofy.com/lynis/controls/BOOT-5122/
    
      * Consider hardening system services [BOOT-5264] 
        - Details  : Run '/usr/bin/systemd-analyze security SERVICE' for each service
          https://cisofy.com/lynis/controls/BOOT-5264/
    
      * If not required, consider explicit disabling of core dump in /etc/security/limits.conf file [KRNL-5820] 
          https://cisofy.com/lynis/controls/KRNL-5820/
    
      * Check PAM configuration, add rounds if applicable and expire passwords to encrypt with new values [AUTH-9229] 
          https://cisofy.com/lynis/controls/AUTH-9229/
    
      * Configure password hashing rounds in /etc/login.defs [AUTH-9230] 
          https://cisofy.com/lynis/controls/AUTH-9230/
    
      * Install a PAM module for password strength testing like pam_cracklib or pam_passwdqc [AUTH-9262] 
          https://cisofy.com/lynis/controls/AUTH-9262/
    
      * When possible set expire dates for all password protected accounts [AUTH-9282] 
          https://cisofy.com/lynis/controls/AUTH-9282/
    
      * Configure minimum password age in /etc/login.defs [AUTH-9286] 
          https://cisofy.com/lynis/controls/AUTH-9286/
    
      * Configure maximum password age in /etc/login.defs [AUTH-9286] 
          https://cisofy.com/lynis/controls/AUTH-9286/
    
      * Default umask in /etc/login.defs could be more strict like 027 [AUTH-9328] 
          https://cisofy.com/lynis/controls/AUTH-9328/
    
      * To decrease the impact of a full /home file system, place /home on a separate partition [FILE-6310] 
          https://cisofy.com/lynis/controls/FILE-6310/
    
      * To decrease the impact of a full /tmp file system, place /tmp on a separate partition [FILE-6310] 
          https://cisofy.com/lynis/controls/FILE-6310/
    
      * To decrease the impact of a full /var file system, place /var on a separate partition [FILE-6310] 
          https://cisofy.com/lynis/controls/FILE-6310/
    
      * Consider disabling unused kernel modules [FILE-6430] 
        - Details  : /etc/modprobe.d/blacklist.conf
        - Solution : Add 'install MODULENAME /bin/true' (without quotes)
          https://cisofy.com/lynis/controls/FILE-6430/
    
      * Disable drivers like USB storage when not used, to prevent unauthorized storage or data theft [USB-1000] 
          https://cisofy.com/lynis/controls/USB-1000/
    
      * Add the IP name and FQDN to /etc/hosts for proper name resolving [NAME-4404] 
          https://cisofy.com/lynis/controls/NAME-4404/
    
      * Purge old/removed packages (15 found) with aptitude purge or dpkg --purge command. This will cleanup old configuration files, cron jobs and startup scripts. [PKGS-7346] 
          https://cisofy.com/lynis/controls/PKGS-7346/
    
      * Install debsums utility for the verification of packages with known good database. [PKGS-7370] 
          https://cisofy.com/lynis/controls/PKGS-7370/
    
      * Install package apt-show-versions for patch management purposes [PKGS-7394] 
          https://cisofy.com/lynis/controls/PKGS-7394/
    
      * Remove any unneeded kernel packages [PKGS-7410] 
        - Details  : 6 kernels
        - Solution : validate dpkg -l output and perform cleanup with apt autoremove
          https://cisofy.com/lynis/controls/PKGS-7410/
    
      * Determine if protocol 'dccp' is really needed on this system [NETW-3200] 
          https://cisofy.com/lynis/controls/NETW-3200/
    
      * Determine if protocol 'sctp' is really needed on this system [NETW-3200] 
          https://cisofy.com/lynis/controls/NETW-3200/
    
      * Determine if protocol 'rds' is really needed on this system [NETW-3200] 
          https://cisofy.com/lynis/controls/NETW-3200/
    
      * Determine if protocol 'tipc' is really needed on this system [NETW-3200] 
          https://cisofy.com/lynis/controls/NETW-3200/
    
      * Install Apache mod_evasive to guard webserver against DoS/brute force attempts [HTTP-6640] 
          https://cisofy.com/lynis/controls/HTTP-6640/
    
      * Install Apache modsecurity to guard webserver against web application attacks [HTTP-6643] 
          https://cisofy.com/lynis/controls/HTTP-6643/
    
      * Check your nginx access log for proper functioning [HTTP-6712] 
          https://cisofy.com/lynis/controls/HTTP-6712/
    
      * Consider hardening SSH configuration [SSH-7408] 
        - Details  : AllowTcpForwarding (set YES to NO)
          https://cisofy.com/lynis/controls/SSH-7408/
    
      * Consider hardening SSH configuration [SSH-7408] 
        - Details  : ClientAliveCountMax (set 3 to 2)
          https://cisofy.com/lynis/controls/SSH-7408/
    
      * Consider hardening SSH configuration [SSH-7408] 
        - Details  : Compression (set YES to NO)
          https://cisofy.com/lynis/controls/SSH-7408/
    
      * Consider hardening SSH configuration [SSH-7408] 
        - Details  : LogLevel (set INFO to VERBOSE)
          https://cisofy.com/lynis/controls/SSH-7408/
    
      * Consider hardening SSH configuration [SSH-7408] 
        - Details  : MaxAuthTries (set 6 to 3)
          https://cisofy.com/lynis/controls/SSH-7408/
    
      * Consider hardening SSH configuration [SSH-7408] 
        - Details  : MaxSessions (set 10 to 2)
          https://cisofy.com/lynis/controls/SSH-7408/
    
      * Consider hardening SSH configuration [SSH-7408] 
        - Details  : PermitRootLogin (set YES to (FORCED-COMMANDS-ONLY|NO|PROHIBIT-PASSWORD|WITHOUT-PASSWORD))
          https://cisofy.com/lynis/controls/SSH-7408/
    
      * Consider hardening SSH configuration [SSH-7408] 
        - Details  : Port (set 22 to )
          https://cisofy.com/lynis/controls/SSH-7408/
    
      * Consider hardening SSH configuration [SSH-7408] 
        - Details  : TCPKeepAlive (set YES to NO)
          https://cisofy.com/lynis/controls/SSH-7408/
    
      * Consider hardening SSH configuration [SSH-7408] 
        - Details  : X11Forwarding (set YES to NO)
          https://cisofy.com/lynis/controls/SSH-7408/
    
      * Consider hardening SSH configuration [SSH-7408] 
        - Details  : AllowAgentForwarding (set YES to NO)
          https://cisofy.com/lynis/controls/SSH-7408/
    
      * Change the allow_url_fopen line to: allow_url_fopen = Off, to disable downloads via PHP [PHP-2376] 
          https://cisofy.com/lynis/controls/PHP-2376/
    
      * Enable logging to an external logging host for archiving purposes and additional protection [LOGG-2154] 
          https://cisofy.com/lynis/controls/LOGG-2154/
    
      * Check what deleted files are still in use and why. [LOGG-2190] 
          https://cisofy.com/lynis/controls/LOGG-2190/
    
      * Add a legal banner to /etc/issue, to warn unauthorized users [BANN-7126] 
          https://cisofy.com/lynis/controls/BANN-7126/
    
      * Add legal banner to /etc/issue.net, to warn unauthorized users [BANN-7130] 
          https://cisofy.com/lynis/controls/BANN-7130/
    
      * Enable process accounting [ACCT-9622] 
          https://cisofy.com/lynis/controls/ACCT-9622/
    
      * Enable sysstat to collect accounting (disabled) [ACCT-9626] 
          https://cisofy.com/lynis/controls/ACCT-9626/
    
      * Enable auditd to collect audit information [ACCT-9628] 
          https://cisofy.com/lynis/controls/ACCT-9628/
    
    

    Более подробная информация записывается в /var/log/lynis.log, а данные отчета сохраняются в /var/log/lynis-report.dat.
    Отчеты содержат общую информацию о сервере и самом приложении, поэтому особое внимание лучше уделить лог-файлу. Лог очищается (перезаписывается) при каждой проверке, потому результаты предыдущей проверки не сохраняются.

    Оценка hardening state

    По результатам выполнения всех тестов в конце каждого вывода аудита утилиты (чуть ниже раздела предложений) вы увидите раздел, который будет выглядеть приблизительно следующим образом:

     Lynis security scan details:
    
      Hardening index : 64 [############        ]
      Tests performed : 265
      Plugins enabled : 0
    
      Components:
      - Firewall               [V]
      - Malware scanner        [X]
    
      Scan mode:
      Normal [V]  Forensics [ ]  Integration [ ]  Pentest [ ]
    
      Lynis modules:
      - Compliance status      [?]
      - Security audit         [V]
      - Vulnerability scan     [V]
    
      Files:
      - Test and debug information      : /var/log/lynis.log
      - Report data                     : /var/log/lynis-report.dat
    

    Этот результат, выраженный числом, показывает количество пройденных тестов и индекс безопасности системы, то есть hardening index — итоговое число, с помощью которого Lynis оценивает общий уровень безопасности сервера. Имейте ввиду, что индекс безопасности изменяется в зависимости от количества исправленных предупреждений и реализованных рекомендаций Lynis.
    Поэтому после фиксов повторный аудит может показать совсем другое число!


    Чтобы автоматически запускать Lynis для проверки в ночное время, создайте задание cron:

    crontab -e  
    

    Например:

    0 3 * * * /usr/local/bin/lynis --quick 2>&1 | mail -s "chkrootkit Report" ваш_почтовый@ящик  
    

    Проверка будет выполняться ежедневно, в 3 часа ночи.
    Замените путь к lynis и укажите свой почтовый адрес на который будет приходить письмо.


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