Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148380011
D49319.1786543062.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D49319.1786543062.diff
View Options
diff --git a/libexec/rc/rc.d/ntpd b/libexec/rc/rc.d/ntpd
--- a/libexec/rc/rc.d/ntpd
+++ b/libexec/rc/rc.d/ntpd
@@ -45,6 +45,7 @@
{
# If the admin set what uid to use, we don't change it.
if [ -n "${ntpd_user}" ]; then
+ logger -s -t "rc.d/ntpd" -p daemon.err "user ${ntpd_user} is not found, exiting"
return 1
fi
@@ -54,6 +55,7 @@
*-f* | *--driftfile* | *-i* | *--jaildir* | \
*-k* | *--keyfile* | *-l* | *--logfile* | \
*-p* | *--pidfile* | *-s* | *--statsdir* )
+ logger -s -t "rc.d/ntpd" -p daemon.err "user ${ntpd_user} cannot access files listed in command line, exiting"
return 1;;
esac
@@ -66,15 +68,32 @@
# privileges. Detect whether MAC is compiled into the kernel, load
# the policy module if not already present, then check whether the
# policy has been disabled via tunable or sysctl.
- [ -n "$(sysctl -qn security.mac.version)" ] || return 1
- sysctl -qn security.mac.ntpd >/dev/null || kldload -qn mac_ntpd || return 1
- [ "$(sysctl -qn security.mac.ntpd.enabled)" == "1" ] || return 1
+ if [ -z "$(sysctl -qn security.mac.version)" ]; then
+ logger -s -t "rc.d/ntpd" -p daemon.err "kernel does not support MAC, exiting"
+ return 1
+ fi
+ if ! sysctl -qn security.mac.ntpd >/dev/null; then
+ if ! kldload -qn mac_ntpd; then
+ logger -s -t "rc.d/ntpd" -p daemon.err "failed to load mac_ntpd, exiting"
+ return 1
+ fi
+ fi
+ if [ ! "$(sysctl -qn security.mac.ntpd.enabled)" == "1" ]; then
+ logger -s -t "rc.d/ntpd" -p daemon.err "security.mac.ntpd.enabled is not enabled, exiting"
+ return 1
+ fi
# On older existing systems, the ntp dir may by owned by root, change
# it to ntpd to give the daemon create/write access to the driftfile.
if [ "$(stat -f %u ${_ntp_default_dir})" = "0" ]; then
- chown ntpd:ntpd "${_ntp_default_dir}" || return 1
- chmod 0755 "${_ntp_default_dir}" || return 1
+ if ! chown ntpd:ntpd "${_ntp_default_dir}"; then
+ logger -s -t "rc.d/ntpd" -p daemon.err "chown ${_ntp_default_dir} failed, exiting"
+ return 1
+ fi
+ if ! chmod 0755 "${_ntp_default_dir}"; then
+ logger -s -t "rc.d/ntpd" -p daemon.err "chmod ${_ntp_default_dir} failed, exiting"
+ return 1
+ fi
logger -s -t "rc.d/ntpd" -p daemon.notice \
"${_ntp_default_dir} updated to owner ntpd:ntpd, mode 0755"
fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 12, 1:57 PM (18 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29399423
Default Alt Text
D49319.1786543062.diff (2 KB)
Attached To
Mode
D49319: rc.d/ntpd: Explain why can_non_root() fails
Attached
Detach File
Event Timeline
Log In to Comment