Perform basic system checks with checksecurity
Health Check
Linux offers users a wide range of options for system configuration. With the help of the checksecurity tool collection, you can automatically monitor basic system settings.
Linux is considered a very secure operating system for computers of all kinds. Realistically, however, even Linux is not immune to vulnerabilities and malware, which is why you can find a large number of tools in the package sources of Linux derivatives to help scan for vulnerabilities. However, these tools tend to focus on specific weaknesses and narrowly defined attack scenarios by only analyzing a computer system for individual potential security problems.
With the checksecurity tool collection, on the other hand, you can automatically check Ubuntu and Debian systems [1] and their derivatives for multiple potential basic security flaws or anomalies.
Concept
Checksecurity consists of a number of plugins, each of which you then customize in a configuration file. The corresponding files are in text format, so a simple editor is all it takes to set up the service. When checksecurity is called, the program works through the activated plugins one by one and outputs the results of the tests in a terminal window.
To achieve the highest possible level of security through an automated process, the system automatically creates two different cron jobs during installation. The check-setuid
plugin does this by checking setuid
attributes (see the "setuid" box) for modifications and looking for remote filesystems that are mounted insecurely on the local system.
setuid
Linux organizes read, write, and execute permissions for files and directories using attributes. Programs equipped with the setuid
bit (SUID) can also be executed with the owner's rights, which is a security risk if the file belongs to the root user.
The Check-sockets
plugin searches for and monitors open and modified ports, making it possible to detect malware that tries to enter the system through these ports. The check-passwd
plugin checks the system for unsecured system accounts, while check-diskfree
checks mounted filesystems for their capacity limits. The check-iptables-logs
plugin takes care of possible intrusion attempts, which it finds using the iptables logfiles.
Installation
You can set up checksecurity on Debian, Ubuntu, and their derivatives conveniently using the system's package management sources. Since it runs entirely on the command line, the installer does not create a launcher in the desktop menu hierarchy. The individual scripts for running the tests can be found after installation in /usr/share/checksecurity/
.
During installation, checksecurity also loads the Postfix mail transfer agent. This mail server allows the system to send mails independently. However, this does not work without a fixed IP address and complex configuration. The recommended approach is to configure Postfix so that the service routes outgoing mail via a commercial provider such as Gmail or GMX. You can find information on this by searching for "Postfix email provider" on the web.
Alternatively, you can set up Postfix to deliver mail locally. To do this, select the Local only option in Postfix Configuration. Then install the mailutils package and add your user to the mail group by running the command:
sudo adduser $USER mail
To be able to read mail sent by checksecurity to the root user via the mail
program, forward the messages sent to root to your own account by typing
echo $USER | sudo tee /root/.forward
Configuration
You create the global configuration for checksecurity in the /etc/checksecurity.conf
file. In the file, you can switch the individual modules on and off or set check intervals for the automated execution of the individual scripts (Figure 1).
In the /etc/checksecurity/
directory, you will find additional configuration files for all plugins except check-iptables-logs
. These files are not used for global configuration, but they do support customization of individual script flows. They are also in text format and can therefore be easily modified using your favorite editor.
You need to pay special attention to the CHECK_DISK_PERCENT
option in the check-diskfree.conf
file, which defaults to 70
. This setting results in a system message being output as soon as one of the mounted partitions reaches a utilization level of more than 70 percent. Since this value can be reached quite quickly, especially with small system partitions that also store temporary data, it is a good idea to increase the value to 80 or even 90 percent.
In the check-passwd.conf
configuration file, you can define whether or not you want the script to detect empty system password entries or duplicate passwords. By default, both routines are activated.
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
-
There's a New Open Source Terminal App in Town
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
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.