freebsd-dev/libexec
Ian Lepore 1e121c3ef1 Limit access to system accounting files.
In 2013 the security chapter of the Handbook was updated in r42501 to
suggest limiting access to the system accounting file [*1] by creating the
initial file with a mode of 0600. This was in part based on a discussion in
the forums [*2]. Unfortunately, this advice is overridden by the fact that a
new file is created as part of periodic daily processing, and the file mode
is set by the rc.d/accounting script.

These changes update the accounting script to create the directory with mode
0750 if it doesn't already exist, and to create the daily file with mode
0640. This limits write access to root only, read access to root and members
of wheel, and eliminates world access completely. For admins who want to
prevent even members of wheel from accessing the files, the mode of the
/var/account directory can be manually changed to 0700, because the script
never creates or changes that directory if it already exists.

The accounting_rotate_log() function now also handles the error cases of no
existing log file to rotate, and attempting to rotate the file multiple
times (.0 file already exists).

Another small change here eliminates the complexity of the mktemp/chmod/mv
sequence for creating a new acct file by using install(1) with the flags
needed to directly create the file with the desired ownership and
modes. That allows coalescing two separate if checkyesno accounting_enable
blocks into one.

These changes were inspired by my investigation of PR 202203.

[1] https://www.freebsd.org/doc/handbook/security-accounting.html
[2] http://forums.freebsd.org/showthread.php?t=41059

PR:		202203
Differential Revision:	https://reviews.freebsd.org/D20876
2019-07-13 16:07:38 +00:00
..
atf DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
atrun libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
blacklistd-helper DIRDEPS_BUILD: Connect new directories and update dependencies. 2016-06-03 19:25:30 +00:00
bootpd Correctly align usage: output 2019-05-25 11:22:49 +00:00
comsat General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
dma Replace send-mail with the more standarized sendmail, we do not create 2017-12-27 06:23:50 +00:00
fingerd General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
ftpd Move ftpusers to libexec/ftpd/ 2018-08-21 17:07:52 +00:00
getty Fix potential buffer overflow and undefined behavior. 2019-01-26 20:43:28 +00:00
hyperv hyperv: Add VF bringup scripts and devd rules. 2017-07-31 07:18:15 +00:00
mail.local DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
makewhatis.local makewhatis: do not try to operate on read-only mounted directories 2018-10-27 17:15:58 +00:00
mknetid General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
pppoed libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
rbootd General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
rc Limit access to system accounting files. 2019-07-13 16:07:38 +00:00
revnetgroup General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
rpc.rquotad This exposes ZFS user and group quotas via the normal 2018-07-05 22:56:13 +00:00
rpc.rstatd General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
rpc.rusersd General further adoption of SPDX licensing ID tags. 2017-11-20 19:49:47 +00:00
rpc.rwalld libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
rpc.sprayd rpc.sprayd: raise WARNS to 6 2018-03-05 16:11:07 +00:00
rtld-aout libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
rtld-elf Fix build race when building rtld 2019-07-02 22:11:07 +00:00
save-entropy save-entropy(8), rc.d/random: Set nodump flag 2019-05-22 21:47:17 +00:00
smrsh DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
talkd Remove All Rights Reserved 2019-02-05 21:37:34 +00:00
tcpd DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
telnetd DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
tftp-proxy DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
tftpd Drop "All rights reserved" from the files I own 2019-03-11 22:23:56 +00:00
ulog-helper libexec: adoption of SPDX licensing ID tags. 2017-11-27 15:25:02 +00:00
ypxfr spdx: initial adoption of licensing ID tags. 2017-11-18 14:26:50 +00:00
Makefile Move the rc framework out of sbin/init into libexec/rc. 2018-10-17 16:49:11 +00:00
Makefile.amd64 HYPERV isn't available on all architectures, but just on by default 2014-10-16 00:33:06 +00:00
Makefile.i386 HYPERV isn't available on all architectures, but just on by default 2014-10-16 00:33:06 +00:00
Makefile.inc