To obtain a copy of Lynis, several options are available. We advise to choose the option you are most familiar with.
The latest stable version of Lynis, as a normal download. Good match for AIX, HPUX.
SelectInstalling Lynis via a package manager is one option to get started with Lynis. 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).
$ yum install lynisDebian
Systems running Debian, Linux Mint, Ubuntu, or are based on one of these.
$ apt-get install lynisopenSUSE
$ zypper install lynisAfter the installation, it is time to run Lynis for the first time.
To First Run
Clone projectThe first step is cloning the project. Before doing so, select the parent directory. Git will create a 'lynis' 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 lynisThat is it. Time to run your first security audit:
$ lynis audit systemAlthough no configuration is required, there are a few useful commands to learn.
Learn Commands
Step 1. Create a directoryLynis can be started from each directory. So choose a directory where you want to store Lynis. 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/localStep 2. Download
Next step is downloading the latest version of Lynis into the /usr/local directory. In this method we use the compressed tarball, which is an archive of all files.
Go to the Lynis download page. Copy the link to the Lynis tarball (ends with lynis-<version>.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-<version>.tar.gz
or$ curl https://cisofy.com/files/lynis-<version>.tar.gz -o lynis.tar.gzStep 3. Unpack the tarball
$ tar xfvz lynis-<version>.tar.gzAfter unpacking, it is time to run Lynis for the first time.
To First Run
For users of macOS, Homebrew can be used as an alternative to manual installation and using Git.
$ brew install lynisAfter the installation with Homebrew, it is time to run Lynis for the first time.
To First Run
If Lynis was installed via a package or Homebrew, you can run Lynis from any directory.
For the other methods, ensure that you are in the right directory and add './' in front of the command, like:
$ ./lynis
Lynis can directly run after installation. Configuration and fine-tuning is optional and will be covered in later sections. For now we will run a basic scan:
$ lynis audit system
By default Lynis 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 Lynis without any pauses, we could give it an additional parameter: --quick. This will enable the "quick" option, ideal for running Lynis while you do other things.
$ lynis audit system --quick
Lynis is started with at least one command, usually followed by one or more options.
Command | Description |
audit system | Perform a system audit |
show commands | Show available Lynis commands |
show help | Provide a help screen |
show profiles | Display discovered profiles |
show settings | List all active settings from profiles |
show version | Display current Lynis version |
The show command requires an up-to-date version of Lynis.
Option | Abbreviated | Description |
--auditor "Given name Surname" | Assign an auditor name to the audit (report) | |
--cronjob | Run Lynis as cronjob (implies quick mode) | |
--debug | Show debug information, useful for troubleshooting and development | |
--help | -h | Shows valid parameters |
--man-page | View man page | |
--no-colors | Do not use any colors | |
--pentest | Perform a penetration test scan (non-privileged) | |
--quick | -Q | Don't wait for user input, except on errors |
--quiet | -q | Only show warnings (includes --quick, but doesn't wait) |
--reverse-colors | Use a different color scheme for lighter backgrounds | |
--verbose | Show more screen output |
Lynis performs an in-depth audit and reports its findings to the following outputs:
Lynis scans the system and performs hundreds of tests. For most of these tests, a result will be displayed on the screen.
Possible tests results include:
During the audit process, Lynis will gather findings and other data points. This information is stored in the report file, which is by default /var/log/lynis-report.dat.
Lynis supports one report format, which can be used to gather results and display them in a custom or (more) friendly presentation. The report file can also be used to compare scan results from the past with a current scan. Lynis Enterprise has much more possibilities to display data, including extended reports in several formats.
Contents of report file:
When an option could have multiple values (like installed packages for example), brackets ([]) are added. Example: installed_package[]=Package-1.0.0
Staying up-to-date
Staying up-to-date with software is important. Some options to ensure your Lynis installation is up-to-date:
- Notification list (see Downloads page)
- Twitter (@cisofy_is)
- Run lynis update info for details
Is Lynis really free?
Yes, Lynis is open source and free to use. Lynis is released under GPL and comes without warranties or support. If you still prefer support or Enterprise features, then Lynis Enterprise is a better choice.
Is Lynis restricted in functionality compared with the Enterprise version?
There are no limitations regarding functionality. Lynis is also part of the Enterprise version. Therefore it has similar functionality, with the exception of (some) plugins.
What systems are supported?
All common systems based on UNIX are supported. Examples include Linux, AIX, *BSD, HP-UX, macOS, and Solaris.
For package management are the following tools supported:
- apt/dpkg, DNF, pacman, pkg_info, ports, RPM, YUM, zypperThe colors used are hard to read with my white background, how can I solve this?
Disable color usage or use the --reverse-colors option
What is the difference between a normal test and a plugin?
Both look very similar in what they can do. A normal test has the main goal of performing a check, and conclude. Something is present or not, the outcome is good or bad etc.
The purpose of plugins is to collect data for later analysis. In particular the Lynis Enterprise solution will use plugins to collect extra data which will be later analyzed. One example would be to determine exceptions or outliers. It would not make sense to have everyone build up databases of data, while all information is already centrally stored.
Can I create my own tests or plugins?
A good start is using the development guide for Lynis plugins.
Where can I report any issues?
The best way to discuss any findings or issues, is using the Lynis project page on GitHub.
Lynis is licensed under the GPLv3 license.