From 6fd01383257496c055d5418269b9a723ebf7976d Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Thu, 14 Feb 2019 20:29:33 +0000 Subject: [PATCH] MFC r342153, r342172-r342173 r342153: Conditionally install /etc/rc.d/audit* based on ${MK_AUDIT} /usr/sbin/audit(dist)?d are only installed if ${MK_AUDIT} == yes. Their supporting scripts should only be installed in those instances as well. Submitted by: ngie Reviewed by: emaste Pull Request: https://github.com/freebsd/freebsd/pull/242 r342172: audit(4) tests: require /etc/rc.d/auditd These tests should be skipped if /etc/rc.d/auditd is missing, which could be the case if world was built with WITHOUT_AUDIT set. Also, one test case requires /etc/rc.d/accounting. Submitted by: ngie Pull Request: https://github.com/freebsd/freebsd/pull/240 r342173: Conditionalize installtion audit(4) tests on MK_AUDIT MK_AUDIT already controls auditd(8), praudit(1), etc. It should also control the audit test suite. Submitted by: ngie Pull Request: https://github.com/freebsd/freebsd/pull/240 --- libexec/rc/rc.d/Makefile | 8 ++++++-- tests/sys/Makefile | 6 +++++- tests/sys/audit/Makefile | 1 + tests/sys/audit/administrative.c | 2 ++ tools/build/mk/OptionalObsoleteFiles.inc | 18 ++++++++++++++++++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/libexec/rc/rc.d/Makefile b/libexec/rc/rc.d/Makefile index 991267e471c..a1b8b13adfe 100644 --- a/libexec/rc/rc.d/Makefile +++ b/libexec/rc/rc.d/Makefile @@ -15,8 +15,6 @@ CONFS= DAEMON \ addswap \ adjkerntz \ archdep \ - auditd \ - auditdistd \ bgfsck \ ${_blacklistd} \ ${_bluetooth} \ @@ -164,6 +162,12 @@ APM+= apmd APMPACKAGE= apm .endif +.if ${MK_AUDIT} != "no" +CONFGROUPS+= AUDIT +AUDIT+= auditd +AUDIT+= auditdistd +.endif + .if ${MK_AUTOFS} != "no" CONFS+= automount CONFS+= automountd diff --git a/tests/sys/Makefile b/tests/sys/Makefile index 4daeb4eead0..0907ffa58ad 100644 --- a/tests/sys/Makefile +++ b/tests/sys/Makefile @@ -6,7 +6,7 @@ TESTSDIR= ${TESTSBASE}/sys TESTS_SUBDIRS+= acl TESTS_SUBDIRS+= aio -TESTS_SUBDIRS+= audit +TESTS_SUBDIRS+= ${_audit} TESTS_SUBDIRS+= auditpipe TESTS_SUBDIRS+= capsicum TESTS_SUBDIRS+= ${_cddl} @@ -28,6 +28,10 @@ TESTS_SUBDIRS+= sys TESTS_SUBDIRS+= vfs TESTS_SUBDIRS+= vm +.if ${MK_AUDIT} != "no" +_audit= audit +.endif + .if ${MK_CDDL} != "no" _cddl= cddl .endif diff --git a/tests/sys/audit/Makefile b/tests/sys/audit/Makefile index c1259167b97..6f70121da14 100644 --- a/tests/sys/audit/Makefile +++ b/tests/sys/audit/Makefile @@ -49,6 +49,7 @@ SRCS.miscellaneous+= utils.c TEST_METADATA+= timeout="30" TEST_METADATA+= required_user="root" TEST_METADATA+= is_exclusive="true" +TEST_METADATA+= required_files="/etc/rc.d/auditd" WARNS?= 6 diff --git a/tests/sys/audit/administrative.c b/tests/sys/audit/administrative.c index 8e16ee96bd1..4ec73f4710e 100644 --- a/tests/sys/audit/administrative.c +++ b/tests/sys/audit/administrative.c @@ -377,6 +377,8 @@ ATF_TC_HEAD(acct_success, tc) { atf_tc_set_md_var(tc, "descr", "Tests the audit of a successful " "acct(2) call"); + atf_tc_set_md_var(tc, "require.files", + "/etc/rc.d/accounting /etc/rc.d/auditd"); } ATF_TC_BODY(acct_success, tc) diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index d6398423e25..7e6a014f61a 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -147,6 +147,8 @@ OLD_FILES+=usr/share/man/man3/unistruct.3.gz .endif .if ${MK_AUDIT} == no +OLD_FILES+=etc/rc.d/auditd +OLD_FILES+=etc/rc.d/auditdistd OLD_FILES+=usr/sbin/audit OLD_FILES+=usr/sbin/auditd OLD_FILES+=usr/sbin/auditdistd @@ -158,6 +160,22 @@ OLD_FILES+=usr/share/man/man5/auditdistd.conf.5.gz OLD_FILES+=usr/share/man/man8/audit.8.gz OLD_FILES+=usr/share/man/man8/auditd.8.gz OLD_FILES+=usr/share/man/man8/auditdistd.8.gz +OLD_FILES+=usr/tests/sys/audit/process-control +OLD_FILES+=usr/tests/sys/audit/open +OLD_FILES+=usr/tests/sys/audit/network +OLD_FILES+=usr/tests/sys/audit/miscellaneous +OLD_FILES+=usr/tests/sys/audit/Kyuafile +OLD_FILES+=usr/tests/sys/audit/ioctl +OLD_FILES+=usr/tests/sys/audit/inter-process +OLD_FILES+=usr/tests/sys/audit/file-write +OLD_FILES+=usr/tests/sys/audit/file-read +OLD_FILES+=usr/tests/sys/audit/file-delete +OLD_FILES+=usr/tests/sys/audit/file-create +OLD_FILES+=usr/tests/sys/audit/file-close +OLD_FILES+=usr/tests/sys/audit/file-attribute-modify +OLD_FILES+=usr/tests/sys/audit/file-attribute-access +OLD_FILES+=usr/tests/sys/audit/administrative +OLD_DIRS+=usr/tests/sys/audit .endif .if ${MK_AUTHPF} == no -- 2.45.0