dhcp: restorecon for dhcpd*.leases from initscript
cover dhcp: restorecon for dhcpd*.leases from initscript
From: Wenzong Fan <[email protected]>
dhcp-server fails to start since /var/lib/dhcpd.leases has incorrect
contexts: dhcp_state_t, it should be: dhcpd_state_t.
* make a local copy of init-server
* update init-server to restorecon for dhcpd*.lesses before starting dhcp server.
The following changes since commit 7984856ca2c6ef7a1c8d5bee3f8ec3e8031ee971:
setools: Add bison-native and flex-native to DEPENDS (2014-06-02 09:16:33 -0500)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib wenzong/dhcp
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/dhcp
Wenzong Fan (2):
dhcp: make a copy of init-server
dhcp/init-server: restorecon for dhcpd*.leases
recipes-connectivity/dhcp/dhcp_4.2.5-P1.bbappend | 3 ++ recipes-connectivity/dhcp/files/init-server | 52 ++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 recipes-connectivity/dhcp/dhcp_4.2.5-P1.bbappend create mode 100644 recipes-connectivity/dhcp/files/init-server
Signature · 1 line
1.7.9.5
PATCH 1/2 dhcp: make a copy of init-server
From: Wenzong Fan <[email protected]>
--- recipes-connectivity/dhcp/dhcp_4.2.5-P1.bbappend | 3 ++ recipes-connectivity/dhcp/files/init-server | 44 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 recipes-connectivity/dhcp/dhcp_4.2.5-P1.bbappend create mode 100644 recipes-connectivity/dhcp/files/init-server
recipes-connectivity/dhcp/dhcp_4.2.5-P1.bbappend new file +3 -0
@@ -0,0 +1,3 @@ +inherit with-selinux + +FILESEXTRAPATHS_prepend := "${@target_selinux(d, '${THISDIR}/files:')}"
recipes-connectivity/dhcp/files/init-server new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 2/2 dhcp/init-server: restorecon for dhcpd*.leases
In reply to [email protected]From: Wenzong Fan <[email protected]>
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=fileThe type for dhcpd.leases is not correct, just fix it before dhcp- server started.
--- recipes-connectivity/dhcp/files/init-server | 8 ++++++++ 1 file changed, 8 insertions(+)
recipes-connectivity/dhcp/files/init-server +8 -0
@@ -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 "." ;;
Signature · 1 line
1.7.9.5
Recall this patch since the dhcp in oe-core has been updated to 4.3.0.
I'll send v2 after fixed the version number for bbappend.
Sorry for the inconvenience.
// Wenzong
Quoted 27 lines · On 06/06/2014 06:00 PM, [email protected] wrote:
From: Wenzong Fan <[email protected]>
dhcp-server fails to start since
/var/lib/dhcpd.leaseshas incorrect
contexts:dhcp_state_t, it should be:dhcpd_state_t.* make a local copy of init-server
* update init-server to restorecon for dhcpd*.lesses before starting dhcp server.The following changes since commit
7984856ca2c6ef7a1c8d5bee3f8ec3e8031ee971:setools: Add bison-native and flex-native to DEPENDS (2014-06-02 09:16:33 -0500)are available in the git repository at:
git://git.pokylinux.org/poky-contribwenzong/dhcp
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=wenzong/dhcpWenzong Fan (2):
dhcp: make a copy of init-server
dhcp/init-server: restorecon for dhcpd*.leasesrecipes-connectivity/dhcp/dhcp_4.2.5-P1.bbappend | 3 ++ recipes-connectivity/dhcp/files/init-server | 52 ++++++++++++++++++++++ 2 files changed, 55 insertions(+)create mode 100644 recipes-connectivity/dhcp/dhcp_4.2.5-P1.bbappend create mode 100644 recipes-connectivity/dhcp/files/init-server