Bug 1406887

Summary: auditd validate_email uses incorrect/obsolete gethostbyname
Product: Red Hat Enterprise Linux 7 Reporter: Scott Nicholas <scott.a.nicholas4.ctr>
Component: auditAssignee: Steve Grubb <sgrubb>
Status: CLOSED ERRATA QA Contact: Ondrej Moriš <omoris>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.3CC: david.jones74, omoris, scott.a.nicholas4.ctr
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: audit-2.7.8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 12:18:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1476406    

Description Scott Nicholas 2016-12-21 18:29:57 UTC
Description of problem:
auditd fails to start with:
 auditd[3156]: validate_email: failed looking up host for nsoc.health.mil

Version-Release number of selected component (if applicable):

# auditctl -v
auditctl version 2.6.5


How reproducible:
Setup auditd with a action_mail_acct to domain without A record

Steps to Reproduce:
1. "action_mail_acct = user" in /etc/audit/auditd.conf
2. start auditd

Actual results:
auditd fails to start

Expected results:
auditd starts

Additional info:

Comment 2 David Jones 2017-05-19 13:45:52 UTC
For me, auditd starts, but issues warning message when running aureport.

Comment 3 Steve Grubb 2017-06-23 03:11:16 UTC
Added option to disable domain name checking in upstream commit 95d8141.

Comment 4 Steve Grubb 2017-09-20 15:01:42 UTC
Built audit-2.7.8 to address this issue.

Comment 6 Ondrej Moriš 2017-11-30 18:38:49 UTC
Successfully reproduced and verified on all supported architectures (x86_64, ppc64, ppc64le and s390x for RHEL and ppc64le and aarch64 for RHEL-ALT).

OLD (audit-2.7.6-3.el7)
=======================
* No verify-email option in config.
* action_mail_acct = a

# service auditd restart
# systemctl status auditd -f -n 100

...
Nov 30 15:58:15 XXX auditd[10800]: validate_email: failed looking up host for redhat.xxxxx

Auditd service running, only warning message.

NEW (audit-2.8.1-2.el7)
=======================
* verify-email = no
* action_mail_acct = a

# service auditd restart
# systemctl status auditd -f -n 100

Nov 30 16:03:06 XXX systemd[1]: Starting Security Auditing Service...
... 
<no warning message> 
...
Nov 30 16:03:06 XXX systemd[1]: Started Security Auditing Service.

Moreover I have verified that all setting of verify_email option (including default) work as expected.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: verify_email unspecified (default = yes)
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   LOG    ] :: Non-existing domain
:: [   PASS   ] :: Command 'sed -i '/verify_email/d' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'sed -i '/action_mail_acct/d' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'echo 'action_mail_acct = a' >> /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'service auditd start && sleep 10' (Expected 0, got 0)
:: [   PASS   ] :: Command 'systemctl status auditd -f -n 100' (Expected 0, got 0)
:: [   PASS   ] :: File '/var/tmp/rlRun_LOG.1x5C4J1W' should contain 'validate_email: failed' 
:: [   PASS   ] :: Command 'service auditd stop && sleep 10' (Expected 0, got 0)
:: [   LOG    ] :: Existing domain
:: [   PASS   ] :: Command 'sed -i '/verify_email/d' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'sed -i '/action_mail_acct/d' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'echo 'action_mail_acct = a' >> /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'service auditd start && sleep 10' (Expected 0, got 0)
:: [   PASS   ] :: Command 'systemctl status auditd -f -n 100' (Expected 0, got 0)
:: [   PASS   ] :: File '/var/tmp/rlRun_LOG.oinwnm7i' should not contain 'validate_email: failed' 
:: [   PASS   ] :: Command 'service auditd stop && sleep 10' (Expected 0, got 0)
:: [   LOG    ] :: Duration: 42s
:: [   LOG    ] :: Assertions: 15 good, 0 bad
:: [   PASS   ] :: RESULT: verify_email unspecified (default = yes)

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: verify_email = no
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   LOG    ] :: Non-existing domain
:: [   PASS   ] :: Command 'sed -i '/verify_email/d' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'sed -i '/action_mail_acct/d' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'echo 'verify_email = no' >> /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'echo 'action_mail_acct = a' >> /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'service auditd start && sleep 10' (Expected 0, got 0)
:: [   PASS   ] :: Command 'systemctl status auditd -f -n 100' (Expected 0, got 0)
:: [   PASS   ] :: File '/var/tmp/rlRun_LOG.qpL7j0Zz' should not contain 'validate_email: failed' 
:: [   PASS   ] :: Command 'service auditd stop && sleep 10' (Expected 0, got 0)
:: [   LOG    ] :: Existing domain
:: [   PASS   ] :: Command 'sed -i '/verify_email/d' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'sed -i '/action_mail_acct/d' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'echo 'verify_email = no' >> /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'echo 'action_mail_acct = a' >> /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'service auditd start && sleep 10' (Expected 0, got 0)
:: [   PASS   ] :: Command 'systemctl status auditd -f -n 100' (Expected 0, got 0)
:: [   PASS   ] :: File '/var/tmp/rlRun_LOG.NDyvVBDt' should not contain 'validate_email: failed' 
:: [   PASS   ] :: Command 'service auditd stop && sleep 10' (Expected 0, got 0)
:: [   LOG    ] :: Duration: 42s
:: [   LOG    ] :: Assertions: 16 good, 0 bad
:: [   PASS   ] :: RESULT: verify_email = no

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: verify_email = yes
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [   LOG    ] :: Non-existing domain
:: [   PASS   ] :: Command 'sed -i '/verify_email/d' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'sed -i '/action_mail_acct/d' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'echo 'verify_email = yes' >> /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'echo 'action_mail_acct = a' >> /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'service auditd start && sleep 10' (Expected 0, got 0)
:: [   PASS   ] :: Command 'systemctl status auditd -f -n 100' (Expected 0, got 0)
:: [   PASS   ] :: File '/var/tmp/rlRun_LOG.bBTyXsJK' should contain 'validate_email: failed' 
:: [   PASS   ] :: Command 'service auditd stop && sleep 10' (Expected 0, got 0)
:: [   LOG    ] :: Existing domain
:: [   PASS   ] :: Command 'sed -i '/verify_email/d' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'sed -i '/action_mail_acct/d' /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'echo 'verify_email = yes' >> /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'echo 'action_mail_acct = a' >> /etc/audit/auditd.conf' (Expected 0, got 0)
:: [   PASS   ] :: Command 'service auditd start && sleep 10' (Expected 0, got 0)
:: [   PASS   ] :: Command 'systemctl status auditd -f -n 100' (Expected 0, got 0)
:: [   PASS   ] :: File '/var/tmp/rlRun_LOG.xsPOUOTU' should not contain 'validate_email: failed' 
:: [   PASS   ] :: Command 'service auditd stop && sleep 10' (Expected 0, got 0)
:: [   LOG    ] :: Duration: 42s
:: [   LOG    ] :: Assertions: 16 good, 0 bad
:: [   PASS   ] :: RESULT: verify_email = yes

Comment 9 errata-xmlrpc 2018-04-10 12:18:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:0760