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
-
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.
-
System76 Unveils an Ampere-Powered Thelio Desktop
If you're looking for a new desktop system for developing autonomous driving and software-defined vehicle solutions. System76 has you covered.
-
VirtualBox 7.1.4 Includes Initial Support for Linux kernel 6.12
The latest version of VirtualBox has arrived and it not only adds initial support for kernel 6.12 but another feature that will make using the virtual machine tool much easier.
-
New Slimbook EVO with Raw AMD Ryzen Power
If you're looking for serious power in a 14" ultrabook that is powered by Linux, Slimbook has just the thing for you.
-
The Gnome Foundation Struggling to Stay Afloat
The foundation behind the Gnome desktop environment is having to go through some serious belt-tightening due to continued financial problems.
-
Thousands of Linux Servers Infected with Stealth Malware Since 2021
Perfctl is capable of remaining undetected, which makes it dangerous and hard to mitigate.
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.