Install Lynis Security Audit Tool on Rocky Linux 9

This article will take you through how to install Lynis Security Audit Tool on Rocky Linux 9. Lynis is a security auditing tool for computers running Linux, macOS, and UNIX. It conducts a thorough system health check to facilitate system hardening and compliance testing.

How to Install Lynis Security Audit Tool on Rocky Linux 9

  • Update your system using the command below.
sudo dnf update
  • Next, install the EPEL repository using the following command.
sudo dnf install epel-release
  • Then install Lynis.
sudo dnf install lynis

Sample output

Dependencies resolved.
======================================================================
 Package       Architecture   Version              Repository    Size
======================================================================
Installing:
 lynis         noarch         3.0.8-1.el9          epel         275 k

Transaction Summary
======================================================================
Install  1 Package

Total download size: 275 k
Installed size: 1.7 M
Is this ok [y/N]: y
Downloading Packages:
lynis-3.0.8-1.el9.noarch.rpm           19 kB/s | 275 kB     00:14    
----------------------------------------------------------------------
Total                                  15 kB/s | 275 kB     00:18     
Extra Packages for Enterprise Linux 9 1.6 MB/s | 1.6 kB     00:00    
Importing GPG key 0x3228467C:
 Userid     : "Fedora (epel9) "
 Fingerprint: FF8A D134 4597 106E CE81 3B91 8A38 72BF 3228 467C
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                              1/1 
  Installing       : lynis-3.0.8-1.el9.noarch                     1/1 
  Running scriptlet: lynis-3.0.8-1.el9.noarch                     1/1 
  Verifying        : lynis-3.0.8-1.el9.noarch                     1/1 

Installed:
  lynis-3.0.8-1.el9.noarch                                            

Complete!
  • List Lynis commands.
lynis show commands

Sample output

Commands:
lynis audit
lynis configure
lynis generate
lynis show
lynis update
lynis upload-only

Demo Lynis System Audit

  • Run a system audit on your operating system using the following command.
sudo lynis audit system

Sample output

[ Lynis 3.0.8 ]

################################################################################
  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.8
  Operating system:          Linux
  Operating system name:     Rocky Linux
  Operating system version:  9.0
  Kernel version:            5.14.0
  Hardware platform:         x86_64
  Hostname:                  localhost
  ---------------------------------------------------
  Profiles:                  /etc/lynis/default.prf
  Log file:                  /var/log/lynis.log
  Report file:               /var/log/lynis-report.dat
  Report version:            1.0
  Plugin directory:          /usr/share/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                        [ OK ]
  - Check running services (systemctl)                        [ DONE ]
        Result: found 36 running services
  - Check enabled services at boot (systemctl)                [ DONE ]
        Result: found 44 enabled services
  - Check startup files (permissions)                         [ OK ]
  - Running 'systemd-analyze security'
        - ModemManager.service:                               [ MEDIUM ]
        - NetworkManager.service:                             [ EXPOSED ]
        - accounts-daemon.service:                            [ UNSAFE ]
        - alsa-state.service:                                 [ UNSAFE ]
        - atd.service:                                        [ UNSAFE ]
        - auditd.service:                                     [ EXPOSED ]
        - avahi-daemon.service:                               [ UNSAFE ]
        - chronyd.service:                                    [ EXPOSED ]
        - colord.service:                                     [ EXPOSED ]
        - crond.service:                                      [ UNSAFE ]
        - cups.service:                                       [ UNSAFE ]
        - dbus-broker.service:                                [ EXPOSED ]
        - dm-event.service:                                   [ UNSAFE ]
        - emergency.service:                                  [ UNSAFE ]
        - firewalld.service:                                  [ UNSAFE ]
        - fprintd.service:                                    [ PROTECTED ]
        - fwupd.service:                                      [ EXPOSED ]
        - gdm.service:                                        [ UNSAFE ]
        - [email protected]:                                 [ UNSAFE ]
        - irqbalance.service:                                 [ EXPOSED ]
        - iscsid.service:                                     [ UNSAFE ]
        - iscsiuio.service:                                   [ UNSAFE ]
        - libstoragemgmt.service:                             [ UNSAFE ]
        - low-memory-monitor.service:                         [ MEDIUM ]
        - lvm2-lvmpolld.service:                              [ UNSAFE ]
        - mcelog.service:                                     [ UNSAFE ]
        - mdmonitor.service:                                  [ UNSAFE ]
        - mlocate-updatedb.service:                           [ EXPOSED ]
        - multipathd.service:                                 [ UNSAFE ]
        - packagekit.service:                                 [ UNSAFE ]
        - plymouth-start.service:                             [ UNSAFE ]
        - polkit.service:                                     [ UNSAFE ]
        - power-profiles-daemon.service:                      [ EXPOSED ]
        - rc-local.service:                                   [ UNSAFE ]
        - rescue.service:                                     [ UNSAFE ]
        - rsyslog.service:                                    [ UNSAFE ]
        - rtkit-daemon.service:                               [ MEDIUM ]
        - smartd.service:                                     [ UNSAFE ]
        - sshd.service:                                       [ UNSAFE ]
        - sssd-kcm.service:                                   [ EXPOSED ]
        - sssd.service:                                       [ EXPOSED ]
        - switcheroo-control.service:                         [ EXPOSED ]
        - systemd-ask-password-console.service:               [ UNSAFE ]
        - systemd-ask-password-plymouth.service:              [ UNSAFE ]
        - systemd-ask-password-wall.service:                  [ UNSAFE ]
        - systemd-initctl.service:                            [ UNSAFE ]
        - systemd-journald.service:                           [ PROTECTED ]
        - systemd-logind.service:                             [ PROTECTED ]
        - systemd-rfkill.service:                             [ UNSAFE ]
        - systemd-udevd.service:                              [ MEDIUM ]
        - udisks2.service:                                    [ UNSAFE ]
        - upower.service:                                     [ PROTECTED ]
        - [email protected]:                                  [ UNSAFE ]
        - vgauthd.service:                                    [ UNSAFE ]
        - vmtoolsd.service:                                   [ UNSAFE ]
        - wpa_supplicant.service:                             [ UNSAFE ]

[+] Kernel
------------------------------------
  - Checking default runlevel                                 [ 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 81 active modules
  - Checking Linux kernel configuration file                  [ FOUND ]
  - Checking default I/O kernel scheduler                     [ NOT FOUND ]
  - Checking core dumps configuration
    - configuration in systemd conf files                     [ DEFAULT ]
    - configuration in /etc/profile                           [ DEFAULT ]
    - 'hard' configuration in /etc/security/limits.conf       [ DEFAULT ]
    - 'soft' configuration in /etc/security/limits.conf       [ DEFAULT ]
    - Checking setuid core dumps configuration                [ PROTECTED ]
  - Check if reboot is needed                                 [ NO ]

[+] 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                                               [ OK ]
  - 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               [ OK ]
    - Permissions for: /etc/sudoers                           [ OK ]
  - PAM password strength tools                               [ OK ]
  - PAM configuration file (pam.conf)                         [ NOT 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                             [ DISABLED ]

[+] Shells
------------------------------------
  - Checking shells from /etc/shells
    Result: found 4 shells (valid shells: 4).
    - Session timeout settings/tools                          [ NONE ]
  - Checking default umask values
    - Checking default umask in /etc/bashrc                   [ WEAK ]
    - Checking default umask in /etc/csh.cshrc                [ WEAK ]
    - 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 ]
  - Checking LVM volume groups                                [ FOUND ]
    - Checking LVM volumes                                    [ FOUND ]
  - Query swap partitions (fstab)                             [ OK ]
  - Testing swap partitions                                   [ OK ]
  - Testing /proc mount (hidepid)                             [ SUGGESTION ]
  - 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 /boot                                    [ DEFAULT ]
  - Mount options of /dev                                     [ PARTIALLY HARDENED ]
  - Mount options of /dev/shm                                 [ PARTIALLY HARDENED ]
  - Mount options of /run                                     [ HARDENED ]
  - Total without nodev:8 noexec:10 nosuid:5 ro or noexec (W^X): 10 of total 24
  - Checking Locate database                                  [ FOUND ]
  - Disable kernel support of some filesystems

[+] 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)           [ NOT DISABLED ]

[+] NFS
------------------------------------
  - Check running NFS daemon                                  [ NOT FOUND ]

[+] Name services
------------------------------------
  - Checking search domains                                   [ FOUND ]
  - Searching DNS domain name                                 [ FOUND ]
      Domain name: localdomain
  - Checking /etc/hosts
    - Duplicate entries in hosts file                         [ NONE ]
    - Presence of configured hostname in /etc/hosts           [ FOUND ]
    - Hostname mapped to localhost                            [ FOUND ]
    - Localhost mapping to IP address                         [ OK ]

[+] Ports and packages
------------------------------------
  - Searching package managers
    - Searching DNF package manager                           [ FOUND ]
      - Querying DNF package manager

  [WARNING]: Test PKGS-7350 had a long execution: 17.638259 seconds

  - Using DNF to find vulnerable packages                     [ NONE ]
  - Checking package audit tool                               [ INSTALLED ]
    Found: dnf

[+] Networking
------------------------------------
  - Checking IPv6 configuration                               [ ENABLED ]
      Configuration method                                    [ AUTO ]
      IPv6 only                                               [ NO ]
  - Checking configured nameservers
    - Testing nameservers
        Nameserver: 192.168.171.2                             [ OK ]
    - Minimal of 2 responsive nameservers                     [ WARNING ]
  - Checking default gateway                                  [ DONE ]
  - Getting listening ports (TCP/UDP)                         [ DONE ]
  - Checking promiscuous interfaces                           [ OK ]
  - Checking waiting connections                              [ OK ]
  - Checking status DHCP client
  - Checking for ARP monitoring software                      [ NOT FOUND ]
  - Uncommon network protocols                                [ 0 ]

[+] Printers and Spools
------------------------------------
  - Checking cups daemon                                      [ RUNNING ]
  - Checking CUPS configuration file                          [ OK ]
    - File permissions                                        [ OK ]
  - Checking CUPS addresses/sockets                           [ FOUND ]
  - Checking lp daemon                                        [ NOT RUNNING ]

[+] Software: e-mail and messaging
------------------------------------

[+] Software: firewalls
------------------------------------
  - Checking iptables kernel module                           [ NOT FOUND ]
  - Checking host based firewall                              [ ACTIVE ]

[+] Software: webserver
------------------------------------
  - Checking Apache                                           [ NOT FOUND ]
  - Checking nginx                                            [ NOT FOUND ]
  • That concludes our article, we have gone through how to install Lynis Security Audit Tool on Rocky Linux 9.

Read more on Lynis Documentation

Other Tutorials

Install and Setup Wazuh Server with ELK Stack on Ubuntu 20.04

Enable Authentication Authorization and Audit Logging in Apache Solr

Install Arkime/Moloch on CentOS 8

System administrator | Software Developer | DevOps

Leave a Comment