LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-11-2020, 03:50 AM   #1
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Rep: Reputation: Disabled
The usage of "auditd" service.


Hello,
I'm using CentOS 8 and I tested my server by Lynis. It showed me below warning:
Quote:
* Audit daemon is enabled with an empty ruleset. Disable the daemon or define rules [ACCT-9630]
https://cisofy.com/lynis/controls/ACCT-9630/
I wanted to disable this service but:
Code:
# systemctl disable auditd
Removed /etc/systemd/system/multi-user.target.wants/auditd.service.

# systemctl stop auditd
Failed to stop auditd.service: Operation refused, unit auditd.service may be requested by dependency only (it is configured to refuse manual start/stop).
See system logs and 'systemctl status auditd.service' for details.

# systemctl status auditd.service
● auditd.service - Security Auditing Service
   Loaded: loaded (/usr/lib/systemd/system/auditd.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-08-25 16:33:31 +0430; 2 weeks 2 days ago
     Docs: man:auditd(8)
           https://github.com/linux-audit/audit-documentation
 Main PID: 1156 (auditd)
    Tasks: 4 (limit: 23575)
   Memory: 5.0M
   CGroup: /system.slice/auditd.service
           ├─1156 /sbin/auditd
           └─1158 /usr/sbin/sedispatch

Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable.
Why?

Thank you.
 
Old 09-11-2020, 05:48 AM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
I had never seen this error message before: "may be requested by dependency only". So what do you do in such a case? You use Google or (better) DuckDuckGo.

There are many pages that refer to this problem with auditd on RHEL (therefore also Centos). I found this in the RHEL 7 manual:
Quote:
Note

The service command is the only way to correctly interact with the auditd daemon. You need to use the service command so that the auid value is properly recorded. You can use the systemctl command only for two actions: enable and status.
Try it, perhaps it also works in Centos 8.
 
Old 09-11-2020, 12:21 PM   #3
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
I had never seen this error message before: "may be requested by dependency only". So what do you do in such a case? You use Google or (better) DuckDuckGo.

There are many pages that refer to this problem with auditd on RHEL (therefore also Centos). I found this in the RHEL 7 manual:

Try it, perhaps it also works in Centos 8.
Is it a bug?
Code:
$ sudo service auditd stop
Stopping logging:                                          [  OK  ]
What is the usage of Auditd?
 
Old 09-11-2020, 06:30 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by n00b_noob View Post
Is it a bug?
Hardly. It seems entirely deliberate.
Quote:
What is the usage of Auditd?
Auditing. For more info, read the manual.
 
Old 09-12-2020, 12:36 AM   #5
n00b_noob
Member
 
Registered: Sep 2020
Posts: 436

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
Hardly. It seems entirely deliberate.

Auditing. For more info, read the manual.
Why by default it was disabled?
 
Old 09-12-2020, 01:05 AM   #6
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by n00b_noob View Post
Why by default it was disabled?
Probably because it uses a non-negligible amount of resources. Also, any additional service you run increases your attack surface.
 
Old 06-08-2021, 10:45 AM   #7
scottieH
Member
 
Registered: Mar 2021
Posts: 58

Rep: Reputation: Disabled
auditd could be immutable

On RedHat/CentOS (I'm sure others have this config also), the audit rules have an enable flag: -e
Code:
man -s 8 auditctl
0 = temporarily disable auditing
1 = enable auditing
2 = lock the audit configuration to prevent changes

To see what you system is set to, look in your rules file (/etc/audit/audit.rules) for the -e setting. Immutable (2), if set, should be at the end of the file.
Code:
 sudo grep -e '^-e' /etc/audit/audit.rules
If -e is 2, you will NOT be able to stop the audit daemon with systemctl.
You can either kill the pid, or use the service command, as documented by 'n00b_noob'
Code:
sudo service auditd stop
Best practice is to set this to immutable (2) to prevent someone from changing the audit rules in vitro
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
The auditd daemon stops logging after deleting audit.log until auditd is restarted Latitude Linux - Security 2 06-20-2013 03:10 PM
Who knows for what use is the service 'auditd' thomas2004ch Linux - Software 2 01-28-2011 03:48 AM
[SOLVED] auditd won't start from service or /etc/init.d poctob Linux - Software 1 10-21-2009 01:13 PM
auditd: auditd startup failed cmschube Red Hat 2 05-11-2009 07:08 AM
auditd outputting errors at service start & stop cdhgee Fedora 8 08-08-2005 01:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration