How are auditd and Lynis different?
Differences between auditd and Lynis
Recently I received the question what the difference is between auditd and Lynis. Both focus on auditing, that part is clear. For someone not familiar with both software tools, the technical differences may not directly be obvious. Time to write about that, for everyone that has the same question.
Comparing functionality
Let’s start with a quick introduction in both tools.
Audit daemon
Auditd is the daemon process in the Linux Audit Framework, written and maintained by Red Hat. It focuses on logging system events (accounting).
Lynis
Lynis performs a security audit of the system. You can compare it with health check, or a yearly checkup for your car.
When to use which tool?
Both tools share the “auditing” part, so this is where the confusion might come in. The important difference is the specific goal you want to achieve.
If you want to track events (like if your /etc/passwd file was changed, or setting the time), then you want to use auditd. Lynis on the other hand, would check for incorrect file permissions on a file like /etc/passwd. It does not track changes in the file itself.
Consider Lynis as a the yearly check for your car and auditd the onboard computer of the car which checks that the engine is not too hot while driving.
Conclusion
So if you want to track changes, use auditd. If you want to know if things are properly configured, then use Lynis. And you may have guessed it: if you want to get your system properly secured, you want to use both solutions. After all, they have a different goal.