aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorIan Lepore <ian@FreeBSD.org>2018-07-19 23:55:29 +0000
committerIan Lepore <ian@FreeBSD.org>2018-07-19 23:55:29 +0000
commit3496c981ac86b0541bdbc9a211f7847a97df008d (patch)
treeb0b83197f84809480a40d805bbdbfa95fc14cc9b /etc
parentdbe8ed38bf5f7a05e4763a7bde69651e30e6c321 (diff)
downloadsrc-3496c981ac86b0541bdbc9a211f7847a97df008d.tar.gz
src-3496c981ac86b0541bdbc9a211f7847a97df008d.zip
Make it possible to run ntpd as a non-root user, add ntpd uid and gid.
Code analysis and runtime analysis using truss(8) indicate that the only privileged operations performed by ntpd are adjusting system time, and (re-)binding to privileged UDP port 123. These changes add a new mac(4) policy module, mac_ntpd(4), which grants just those privileges to any process running with uid 123. This also adds a new user and group, ntpd:ntpd, (uid:gid 123:123), and makes them the owner of the /var/db/ntp directory, so that it can be used as a location where the non-privileged daemon can write files such as the driftfile, and any optional logfile or stats files. Because there are so many ways to configure ntpd, the question of how to configure it to run without root privs can be a bit complex, so that will be addressed in a separate commit. These changes are just what's required to grant the limited subset of privs to ntpd, and the small change to ntpd to prevent it from exiting with an error if running as non-root. Differential Revision: https://reviews.freebsd.org/D16281
Notes
Notes: svn path=/head/; revision=336525
Diffstat (limited to 'etc')
-rw-r--r--etc/group1
-rw-r--r--etc/master.passwd1
-rw-r--r--etc/mtree/BSD.var.dist2
3 files changed, 3 insertions, 1 deletions
diff --git a/etc/group b/etc/group
index c20f1d93dd3c..1a409312d69d 100644
--- a/etc/group
+++ b/etc/group
@@ -29,6 +29,7 @@ dialer:*:68:
network:*:69:
audit:*:77:
www:*:80:
+ntpd:*:123:
_ypldap:*:160:
hast:*:845:
nogroup:*:65533:
diff --git a/etc/master.passwd b/etc/master.passwd
index 4b0f3645cd3d..a7903f08a576 100644
--- a/etc/master.passwd
+++ b/etc/master.passwd
@@ -22,6 +22,7 @@ uucp:*:66:66::0:0:UUCP pseudo-user:/var/spool/uucppublic:/usr/local/libexec/uucp
pop:*:68:6::0:0:Post Office Owner:/nonexistent:/usr/sbin/nologin
auditdistd:*:78:77::0:0:Auditdistd unprivileged user:/var/empty:/usr/sbin/nologin
www:*:80:80::0:0:World Wide Web Owner:/nonexistent:/usr/sbin/nologin
+ntpd:*:123:123::0:0:NTP Daemon:/var/db/ntp:/usr/sbin/nologin
_ypldap:*:160:160::0:0:YP LDAP unprivileged user:/var/empty:/usr/sbin/nologin
hast:*:845:845::0:0:HAST unprivileged user:/var/empty:/usr/sbin/nologin
nobody:*:65534:65534::0:0:Unprivileged user:/nonexistent:/usr/sbin/nologin
diff --git a/etc/mtree/BSD.var.dist b/etc/mtree/BSD.var.dist
index e522549fffd0..fc6021aad9ac 100644
--- a/etc/mtree/BSD.var.dist
+++ b/etc/mtree/BSD.var.dist
@@ -46,7 +46,7 @@
..
ipf mode=0700
..
- ntp mode=0700
+ ntp uname=ntpd gname=ntpd
..
pkg
..