From e5c4c8aa7fda6305f93e2bf378a89186722310a8 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 13 May 2017 03:10:50 +0000 Subject: [PATCH] Handle the logfiles in newsyslog and syslogd conditionally, based on src.conf(5) knobs This will allow consumers of FreeBSD to use the unmodified configuration files out of the box more than previously. Both newsyslog.conf and syslog.conf: - /var/log/lpd-errs (MK_LPR != no) - /var/log/ppp.log (MK_PPP != no) - /var/log/xferlog (MK_FTP != no) newsyslog.conf: - /var/log/amd.log (MK_AMD != no) - /var/log/pflog (MK_PF != no) - /var/log/sendmail.st (MK_SENDMAIL != no) MFC after: 3 weeks Sponsored by: Dell EMC Isilon --- etc/Makefile | 3 ++- etc/newsyslog.conf | 6 ------ etc/newsyslog.conf.d/Makefile | 24 ++++++++++++++++++++++++ etc/newsyslog.conf.d/amd.conf | 2 ++ etc/newsyslog.conf.d/ftp.conf | 2 ++ etc/newsyslog.conf.d/lpr.conf | 2 ++ etc/newsyslog.conf.d/pf.conf | 2 ++ etc/newsyslog.conf.d/ppp.conf | 2 ++ etc/newsyslog.conf.d/sendmail.conf | 2 ++ etc/syslog.conf | 4 ---- etc/syslog.d/Makefile | 19 +++++++++++++++++++ etc/syslog.d/ftp.conf | 2 ++ etc/syslog.d/lpr.conf | 2 ++ etc/syslog.d/ppp.conf | 3 +++ tools/build/mk/OptionalObsoleteFiles.inc | 9 +++++++++ 15 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 etc/newsyslog.conf.d/amd.conf create mode 100644 etc/newsyslog.conf.d/ftp.conf create mode 100644 etc/newsyslog.conf.d/lpr.conf create mode 100644 etc/newsyslog.conf.d/pf.conf create mode 100644 etc/newsyslog.conf.d/ppp.conf create mode 100644 etc/newsyslog.conf.d/sendmail.conf create mode 100644 etc/syslog.d/Makefile create mode 100644 etc/syslog.d/ftp.conf create mode 100644 etc/syslog.d/lpr.conf create mode 100644 etc/syslog.d/ppp.conf diff --git a/etc/Makefile b/etc/Makefile index 153e56787632..8bfeac2b6b96 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -8,7 +8,8 @@ FILESGROUPS= FILES # No need as it is empty and just causes rebuilds since this file does so much. UPDATE_DEPENDFILE= no SUBDIR= \ - newsyslog.conf.d + newsyslog.conf.d \ + syslog.d .if ${MK_SENDMAIL} != "no" SUBDIR+=sendmail diff --git a/etc/newsyslog.conf b/etc/newsyslog.conf index 7a969691a8bf..9982f91dfc11 100644 --- a/etc/newsyslog.conf +++ b/etc/newsyslog.conf @@ -18,7 +18,6 @@ # # logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] /var/log/all.log 600 7 * @T00 J -/var/log/amd.log 644 7 1000 * J /var/log/auth.log 600 7 1000 @0101T JC /var/log/console.log 600 5 1000 * J /var/log/cron 600 3 1000 * JC @@ -26,18 +25,13 @@ /var/log/debug.log 600 7 1000 * JC /var/log/init.log 644 3 1000 * J /var/log/kerberos.log 600 7 1000 * J -/var/log/lpd-errs 644 7 1000 * JC /var/log/maillog 640 7 * @T00 JC /var/log/messages 644 5 1000 @0101T JC /var/log/monthly.log 640 12 * $M1D0 JN -/var/log/pflog 600 3 1000 * JB /var/run/pflogd.pid -/var/log/ppp.log root:network 640 3 1000 * JC /var/log/devd.log 644 3 1000 * JC /var/log/security 600 10 1000 * JC -/var/log/sendmail.st 640 10 * 168 BN /var/log/utx.log 644 3 * @01T05 B /var/log/weekly.log 640 5 * $W6D0 JN -/var/log/xferlog 600 7 1000 * JC /etc/newsyslog.conf.d/* /usr/local/etc/newsyslog.conf.d/* diff --git a/etc/newsyslog.conf.d/Makefile b/etc/newsyslog.conf.d/Makefile index c2574b74c432..a831f3d2c6f6 100644 --- a/etc/newsyslog.conf.d/Makefile +++ b/etc/newsyslog.conf.d/Makefile @@ -6,8 +6,32 @@ BINDIR= /etc/newsyslog.conf.d FILES= +.if ${MK_AMD} != "no" +FILES+= amd.conf +.endif + +.if ${MK_FTP} != "no" +FILES+= ftp.conf +.endif + +.if ${MK_LPR} != "no" +FILES+= lpr.conf +.endif + .if ${MK_OFED} != "no" FILES+= opensm.conf .endif +.if ${MK_PF} != "no" +FILES+= pf.conf +.endif + +.if ${MK_PPP} != "no" +FILES+= ppp.conf +.endif + +.if ${MK_SENDMAIL} != "no" +FILES+= sendmail.conf +.endif + .include diff --git a/etc/newsyslog.conf.d/amd.conf b/etc/newsyslog.conf.d/amd.conf new file mode 100644 index 000000000000..329652dd5135 --- /dev/null +++ b/etc/newsyslog.conf.d/amd.conf @@ -0,0 +1,2 @@ +# $FreeBSD$ +/var/log/amd.log 644 7 1000 * J diff --git a/etc/newsyslog.conf.d/ftp.conf b/etc/newsyslog.conf.d/ftp.conf new file mode 100644 index 000000000000..c12e24d7066f --- /dev/null +++ b/etc/newsyslog.conf.d/ftp.conf @@ -0,0 +1,2 @@ +# $FreeBSD$ +/var/log/xferlog 600 7 1000 * JC diff --git a/etc/newsyslog.conf.d/lpr.conf b/etc/newsyslog.conf.d/lpr.conf new file mode 100644 index 000000000000..5febb309c6ec --- /dev/null +++ b/etc/newsyslog.conf.d/lpr.conf @@ -0,0 +1,2 @@ +# $FreeBSD$ +/var/log/lpd-errs 644 7 1000 * JC diff --git a/etc/newsyslog.conf.d/pf.conf b/etc/newsyslog.conf.d/pf.conf new file mode 100644 index 000000000000..7c41c816c1ff --- /dev/null +++ b/etc/newsyslog.conf.d/pf.conf @@ -0,0 +1,2 @@ +# $FreeBSD$ +/var/log/pflog 600 3 1000 * JB /var/run/pflogd.pid diff --git a/etc/newsyslog.conf.d/ppp.conf b/etc/newsyslog.conf.d/ppp.conf new file mode 100644 index 000000000000..198579dae27a --- /dev/null +++ b/etc/newsyslog.conf.d/ppp.conf @@ -0,0 +1,2 @@ +# $FreeBSD$ +/var/log/ppp.log root:network 640 3 1000 * JC diff --git a/etc/newsyslog.conf.d/sendmail.conf b/etc/newsyslog.conf.d/sendmail.conf new file mode 100644 index 000000000000..5cb59c4e8c18 --- /dev/null +++ b/etc/newsyslog.conf.d/sendmail.conf @@ -0,0 +1,2 @@ +# $FreeBSD$ +/var/log/sendmail.st 640 10 * 168 BN diff --git a/etc/syslog.conf b/etc/syslog.conf index a137bdcae65f..e0df421b9021 100644 --- a/etc/syslog.conf +++ b/etc/syslog.conf @@ -10,8 +10,6 @@ security.* /var/log/security auth.info;authpriv.info /var/log/auth.log mail.info /var/log/maillog -lpr.info /var/log/lpd-errs -ftp.info /var/log/xferlog cron.* /var/log/cron !-devd *.=debug /var/log/debug.log @@ -31,8 +29,6 @@ cron.* /var/log/cron # Uncomment this if you wish to see messages produced by devd # !devd # *.>=notice /var/log/devd.log -!ppp -*.* /var/log/ppp.log !* include /etc/syslog.d include /usr/local/etc/syslog.d diff --git a/etc/syslog.d/Makefile b/etc/syslog.d/Makefile new file mode 100644 index 000000000000..56047ed2bfba --- /dev/null +++ b/etc/syslog.d/Makefile @@ -0,0 +1,19 @@ +# $FreeBSD$ + +.include + +.if ${MK_FTP} != "no" +FILES+= ftp.conf +.endif + +.if ${MK_LPR} != "no" +FILES+= lpr.conf +.endif + +.if ${MK_PPP} != "no" +FILES+= ppp.conf +.endif + +BINDIR= /etc/syslog.d + +.include diff --git a/etc/syslog.d/ftp.conf b/etc/syslog.d/ftp.conf new file mode 100644 index 000000000000..d4d11cfb7a65 --- /dev/null +++ b/etc/syslog.d/ftp.conf @@ -0,0 +1,2 @@ +# $FreeBSD$ +ftp.info /var/log/xferlog diff --git a/etc/syslog.d/lpr.conf b/etc/syslog.d/lpr.conf new file mode 100644 index 000000000000..0eb6eb06db2a --- /dev/null +++ b/etc/syslog.d/lpr.conf @@ -0,0 +1,2 @@ +# $FreeBSD$ +lpr.info /var/log/lpd-errs diff --git a/etc/syslog.d/ppp.conf b/etc/syslog.d/ppp.conf new file mode 100644 index 000000000000..57ee868bd142 --- /dev/null +++ b/etc/syslog.d/ppp.conf @@ -0,0 +1,3 @@ +# $FreeBSD$ +!ppp +*.* /var/log/ppp.log diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 65d555003b04..513edfeb5505 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -56,6 +56,7 @@ OLD_FILES+=usr/share/man/man8/iasl.8.gz .if ${MK_AMD} == no OLD_FILES+=etc/amd.map +OLD_FILES+=etc/newsyslog.conf.d/amd.conf OLD_FILES+=etc/rc.d/amd OLD_FILES+=usr/bin/pawd OLD_FILES+=usr/sbin/amd @@ -1588,9 +1589,11 @@ OLD_FILES+=usr/share/man/man8/fmtree.8.gz .if ${MK_FTP} == no OLD_FILES+=etc/ftpusers +OLD_FILES+=etc/newsyslog.conf.d/ftp.conf OLD_FILES+=etc/pam.d/ftp OLD_FILES+=etc/pam.d/ftpd OLD_FILES+=etc/rc.d/ftpd +OLD_FILES+=etc/syslog.d/ftp.conf OLD_FILES+=usr/bin/ftp OLD_FILES+=usr/bin/gate-ftp OLD_FILES+=usr/bin/pftp @@ -6183,7 +6186,9 @@ OLD_FILES+=usr/share/man/man8/updatedb.8.gz .if ${MK_LPR} == no OLD_FILES+=etc/hosts.lpd OLD_FILES+=etc/printcap +OLD_FILES+=etc/newsyslog.conf.d/lpr.conf OLD_FILES+=etc/rc.d/lpd +OLD_FILES+=etc/syslog.d/lpr.conf OLD_FILES+=usr/bin/lp OLD_FILES+=usr/bin/lpq OLD_FILES+=usr/bin/lpr @@ -7158,6 +7163,7 @@ OLD_DIRS+=usr/share/examples/pc-sysinstall .endif .if ${MK_PF} == no +OLD_FILES+=etc/newsyslog.conf.d/pf.conf OLD_FILES+=etc/periodic/security/520.pfdenied OLD_FILES+=etc/pf.os OLD_FILES+=etc/rc.d/ftp-proxy @@ -7297,7 +7303,9 @@ OLD_FILES+=usr/share/man/man8/portsnap.8.gz .endif .if ${MK_PPP} == no +OLD_FILES+=etc/newsyslog.conf.d/ppp.conf OLD_FILES+=etc/ppp/ppp.conf +OLD_FILES+=etc/syslog.d/ppp.conf OLD_DIRS+=etc/ppp OLD_FILES+=usr/sbin/ppp OLD_FILES+=usr/sbin/pppctl @@ -7473,6 +7481,7 @@ OLD_FILES+=usr/share/man/man8/rtquery.8.gz .endif .if ${MK_SENDMAIL} == no +OLD_FILES+=etc/newsyslog.conf.d/sendmail.conf OLD_FILES+=etc/periodic/daily/150.clean-hoststat OLD_FILES+=etc/periodic/daily/440.status-mailq OLD_FILES+=etc/periodic/daily/460.status-mail-rejects