Lynis : Security Auditing Tool for Unix/Linux Systems

Lynis is a security auditing tool for UNIX derivatives like Linux, macOS, BSD, Solaris, AIX, and others. It performs an in-depth security scan. Software packages is available by clicking here.

Requirements

Shell and basic utilities

Permissions

Normal user or preferable root permissions

Installation

Installation via package

Installing the tool via a package manager is one option to get started with it. For most operating systems and distributions, a port or package is available.

First add our software repository. This way the latest version will be available to your system.

Red Hat

This applies to systems running YUM, including CentOS, Fedora, Red Hat Enterprise Linux (RHEL).

Also Read – Leviathan : Wide Range Mass Audit Toolkit

$ yum install lynis

Debian

Systems running Debian, Linux Mint, Ubuntu, or are based on one of these.

$ apt-get install lynis

openSUSE

$ zypper install lynis

Installation via Git

Clone project

The first step is cloning the project. Before doing so, select the parent directory. Git will create a subdirectory with the full program in it.

$ cd /usr/local

$ git clone https://github.com/CISOfy/lynis
Cloning into ‘lynis’…
remote: Counting objects: 1733, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 1733 (delta 3), reused 0 (delta 0), pack-reused 1725
Receiving objects: 100% (1733/1733), 886.18 KiB | 378.00 KiB/s, done.
Resolving deltas: 100% (1204/1204), done.
Checking connectivity… done.

$ cd lynis

That is it. Time to run your first security audit:

$ lynis audit system

Although no configuration is required, there are a few useful commands to learn.

Installation via direct download

  • Create a directory

It can be started from each directory. So choose a directory where you want to store the tool. For our example purpose we use /usr/local/lynis, as the /usr/local directory exists on most distributions.

$ mkdir -p /usr/local/lynis
$ cd /usr/local

  • Download

Next step is downloading the latest version of the tool into the /usr/local directory. In this method we use the compressed tarball, which is an archive of all files.

Go to the tool download page. Copy the link to the tarball (ends with tar.gz).

Use this link together with wget (usually installed by default). macOS users can use curl tool, where BSD users could use fetch.

$ wget https://cisofy.com/files/lynis-.tar.gz

or

$ curl https://cisofy.com/files/lynis-.tar.gz -o lynis.tar.gz

  • Unpack the tarball

$ tar xfvz lynis-.tar.gz

Installation via Homebrew

For users of macOS, Homebrew can be used as an alternative to manual installation and using Git.

$ brew install lynis

After the installation with Homebrew, it is time to run it for the first time.

Running

If the tool was installed via a package or Homebrew, you can run it from any directory.

For the other methods, ensure that you are in the right directory and add ‘./’ in front of the command, like:

$ ./lynis

It can run without any preconfiguration. Configuration and fine-tuning is possible though and will be covered in later sections. For now we will run a basic scan:

$ lynis audit system

Lynis and Pauses

By default it starts and pauses after the first section. With CTRL+C you can stop the program. With ENTER it will continue to the next set of tests. If we want to run it without any pauses, we could give it an additional parameter: –quick. This will enable the “quick” option, ideal for running it while you do other things.

$ lynis audit system –quick

Features

It is security auditing tool, for Unix, Linux and macOS systems.
It is used by system administrators, auditors and security professionals, all over the world. Some of the features are:

Basics

  • Open source
  • Shell script
  • No dependencies
  • Easy to understand

Support

  • Dynamic OS detection
  • 300+ built-in tests
  • Support for custom tests
  • Plugin support
  • Compliance checks
  • Extensive software support

Reporting

  • Report on screen and details in report file
  • Reporting of warnings and suggestions
  • Detailed logging
  • Hardening index
R K

Recent Posts

Install VirtualBox on Ubuntu 18.04 from the Oracle Repository

VirtualBox is a free, open-source, cross-platform virtualization application maintained by Oracle. It lets you run multiple…

16 minutes ago

Install PostgreSQL on Ubuntu 18.04 with Remote Access Setup

PostgreSQL (also called Postgres) is a free, open-source, object-relational database management system with a strong reputation…

19 minutes ago

Install VMware on Ubuntu 18.04: Workstation Player Setup Guide

VMware Workstation Player is a mature, stable virtualization platform that lets you run multiple isolated operating…

22 minutes ago

Set Up a UFW Firewall on Ubuntu 18.04: Allow, Deny, and Manage

A properly configured firewall is one of the most important layers of security for any internet-facing server. UFW (Uncomplicated Firewall) is a user-friendly front-end for managing iptables rules that ships pre-installed on Ubuntu. Its defaults are sensible: block all incoming connections, allow all outgoing connections. No outside traffic reaches your server unless you explicitly open a port. This guide covers how to configure a UFW firewall on Ubuntu 18.04, from setting default policies and application profiles to writing allow and deny rules for specific ports, IPs, and subnets. <strong>Prerequisite:</strong>&nbsp;You&nbsp;need&nbsp;sudo&nbsp;access. Configure UFW Firewall on Ubuntu: Defaults, SSH, and Application Profiles If UFW is not installed, add it with: bashsudo…

26 minutes ago

Disable UFW Firewall on Ubuntu 18.04: Stop, Reset, and Re-enable

UFW (Uncomplicated Firewall) is a user-friendly front-end for managing iptables rules on Ubuntu. It ships pre-installed…

29 minutes ago

Install Apache Cassandra on Ubuntu 18.04: NoSQL Setup Guide

Apache Cassandra is a free, open-source NoSQL database designed for high availability and linear scalability with…

1 day ago