aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWenzong Fan <wenzong.fan@windriver.com>2014-06-15 21:38:38 -0400
committerXin Ouyang <xin.ouyang@windriver.com>2014-06-23 11:50:00 +0800
commitda44a1483132abdaf53a3412c724c41cc0e87a8d (patch)
tree2af8de157ec0adca7601b7669f2a0937889b9fae
parentf210f90cc84752c6066153f5a24f1cd6b2d45502 (diff)
downloadmeta-selinux-da44a1483132abdaf53a3412c724c41cc0e87a8d.tar.gz
meta-selinux-da44a1483132abdaf53a3412c724c41cc0e87a8d.tar.bz2
meta-selinux-da44a1483132abdaf53a3412c724c41cc0e87a8d.zip
dhcp/init-server: restorecon for dhcpd*.leases
dhcp-server fails to start with avc denied error: avc: denied { read } for pid=571 comm="dhcpd" \ name="dhcpd.leases" dev="hda" ino=63911 \ scontext=system_u:system_r:dhcpd_t:s0-s15:c0.c1023 \ tcontext=system_u:object_r:dhcp_state_t:s0 tclass=file The type for dhcpd.leases is not correct, just fix it before dhcp- server started. Signed-off-by: Wenzong Fan <wenzong.fan@windriver.com> Signed-off-by: Xin Ouyang <xin.ouyang@windriver.com>
-rw-r--r--recipes-connectivity/dhcp/files/init-server8
1 files changed, 8 insertions, 0 deletions
diff --git a/recipes-connectivity/dhcp/files/init-server b/recipes-connectivity/dhcp/files/init-server
index 34c2085..1d03d7e 100644
--- a/recipes-connectivity/dhcp/files/init-server
+++ b/recipes-connectivity/dhcp/files/init-server
@@ -15,11 +15,19 @@ fi
# should listen on.)
. /etc/default/dhcp-server
+# Restorecon for /var/lib/dhcp/{dhcpd.leases,dhcpd6.leases}
+restorecon_dhcpd_leases(){
+ test ! -x /sbin/restorecon || for x in dhcpd.leases dhcpd6.leases; do
+ [ -f /var/lib/dhcp/$x ] && /sbin/restorecon -F /var/lib/dhcp/$x
+ done
+}
+
case "$1" in
start)
echo -n "Starting DHCP server: "
test -d /var/lib/dhcp/ || mkdir -p /var/lib/dhcp/
test -f /var/lib/dhcp/dhcpd.leases || touch /var/lib/dhcp/dhcpd.leases
+ restorecon_dhcpd_leases
start-stop-daemon -S -x /usr/sbin/dhcpd -- -q $INTERFACES
echo "."
;;