Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F136555913
D45343.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D45343.diff
View Options
diff --git a/net-mgmt/net-snmp/files/snmpd.in b/net-mgmt/net-snmp/files/snmpd.in
--- a/net-mgmt/net-snmp/files/snmpd.in
+++ b/net-mgmt/net-snmp/files/snmpd.in
@@ -10,7 +10,8 @@
# snmpd_conffile="<set as needed>"
#
# Add the following line to make snmpd drop privileges after initialization.
-# This might invalidate existing SNMPv3 users.
+# This might invalidate existing SNMPv3 users. Make sure that configuration
+# files are readable by the snmpd user.
#
# snmpd_sugid="YES"
#
@@ -32,8 +33,24 @@
start_precmd=net_snmpd_precmd
-net_snmpd_precmd () {
- local flag conffile snmpd_conffile_set
+check_conffile()
+{
+ local conffile
+
+ conffile=$1
+
+ if [ ! -f "${conffile}" ]; then
+ warn "snmpd configuration file $conffile not found"
+ return
+ fi
+ su -m snmpd -c "test -r ${conffile}"
+ if [ $? -ne 0 ]; then
+ warn "snmpd configuration file $conffile not readable by snmpd user"
+ fi
+}
+
+net_snmpd_precmd() {
+ local flag conffile snmpd_conffile_set readable
if checkyesno snmpd_flush_cache; then
rm -vf /var/net-snmp/.snmp-exec-cache
@@ -52,11 +69,14 @@
esac
done
+ # -c does not override the default config file.
+ check_conffile %%PREFIX%%/share/snmp/snmpd.conf
for conffile in ${snmpd_conffile}; do
+ check_conffile ${conffile}
if [ -f "${conffile}" -a -s "${conffile}" ]; then
- snmpd_conffile_set="${snmpd_conffile_set},${conffile}"
+ snmpd_conffile_set="${snmpd_conffile_set},${conffile}"
else
- err 1 "snmpd configuration file $conffile not found."
+ err 1 "snmpd configuration file $conffile not found."
fi
done
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 19, 7:46 AM (8 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25610584
Default Alt Text
D45343.diff (1 KB)
Attached To
Mode
D45343: net-mgmt/net-snmp: Print a warning if config files aren't readable
Attached
Detach File
Event Timeline
Log In to Comment