Security audits with Lynis
Logger
Lynis generates multiple logs. Besides a profile containing the respective test scenario, it generates a logfile and a report. Lynis shows you the search paths for the individual files after starting the tests.
The report is the most important of these files. It not only contains a detailed list of all loaded kernel modules, data on the network interfaces, and the directory structures, but it also includes all of the installed packages, cron jobs, and the tests that have been run. These do not appear in plain text like in the program output, but with their internal designations. Lynis also outputs detailed information about the services loaded by the init system.
The report also contains several suggestions on how to harden the current system against attacks. However, these suggestions are somewhat cluttered and unstructured in the report. The suggestion
tag at the beginning of each line marks the individual suggestions.
Profiles
Lynis supports the use of different profiles. You can view a list of all existing profiles with lynis show profiles
. The preset profile uses all available options. If you only want to test certain components or services, you can create an additional profile for this purpose. There are no restrictions on the number of profiles.
The profiles are simple text files, which can be managed with any text editor. However, be careful not to modify the original profile. To use a specific profile during a test run, specify its name as an option when calling Lynis. To perform a test run with a specific profile, type the following at the prompt:
lynis audit --profile <profile>
When you assign names to new profiles that you generate from the default profile as a template, you should include the components to be tested in the name. For example, you can create specific profiles for different installations, but also group different server services, such as web or mail servers, into separate profiles. The security level can also be taken into account in individual profiles.
Regular Scanning
Especially in a corporate environment, you will want to run security scans regularly. A cron job gives you the ability to run Lynis at fixed intervals. To do this, the application offers the --cronjob
call parameter, which does a complete scan of the system. You also need to generate a matching script and create the associated paths to be able to save the report.
Automated tests will then run at regular intervals without any user interaction. The software also removes all special characters from the report to facilitate processing downstream. Users of the Enterprise variant also have the option to use the --upload
parameter to send the report to their own Lynis instance for auditing and documentation purposes [5].
« Previous 1 2 3 4 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.
-
Red Hat Enterprise Linux 9.5 Released
Notify your friends, loved ones, and colleagues that the latest version of RHEL is available with plenty of enhancements.
-
Linux Sees Massive Performance Increase from a Single Line of Code
With one line of code, Intel was able to increase the performance of the Linux kernel by 4,000 percent.
-
Fedora KDE Approved as an Official Spin
If you prefer the Plasma desktop environment and the Fedora distribution, you're in luck because there's now an official spin that is listed on the same level as the Fedora Workstation edition.
-
New Steam Client Ups the Ante for Linux
The latest release from Steam has some pretty cool tricks up its sleeve.
-
Gnome OS Transitioning Toward a General-Purpose Distro
If you're looking for the perfectly vanilla take on the Gnome desktop, Gnome OS might be for you.
-
Fedora 41 Released with New Features
If you're a Fedora fan or just looking for a Linux distribution to help you migrate from Windows, Fedora 41 might be just the ticket.
-
AlmaLinux OS Kitten 10 Gives Power Users a Sneak Preview
If you're looking to kick the tires of AlmaLinux's upstream version, the developers have a purrfect solution.
-
Gnome 47.1 Released with a Few Fixes
The latest release of the Gnome desktop is all about fixing a few nagging issues and not about bringing new features into the mix.