Dual Stack DHCP clobber each other when using /run/dhcp-server/ for pid files

Bug #1882317 reported by Joshua Stark
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
isc-dhcp (Ubuntu)
New
Undecided
Unassigned

Bug Description

When installing dual stack IPv4 and IPv6 DHCP I found that DHCPv4 and DHCPv6 clobber each others /run/dhcp-server path when you stop or restart one of the daemons

I found that the config in the systemd unit has the /run path set to the same location for both DHCPv4 and DHCPv6

In /lib/systemd/system/isc-dhcp-server.service the offending line that conflicts is:
  exec dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcpd.pid -cf $CONFIG_FILE $INTERFACES'

In /lib/systemd/system/isc-dhcp-server6.service the offending line that conflicts is:
  exec dhcpd -user dhcpd -group dhcpd -f -6 -pf /run/dhcp-server/dhcpd6.pid -cf $CONFIG_FILE $INTERFACES'

This means if you stop/restart DHCPv4 or DHCPv6, then it cleans up the path /run/dhcp-server and removed the pid file for the alternate process.

I have found a possible fix is to give DHCPv6 it's own /run path, thus I suggest:

1) update DHCPv6 to use /run/dhcp-server6/

Update /lib/systemd/system/isc-dhcp-server6.service to use /run/dhcp-server6/
ie.
  exec dhcpd -user dhcpd -group dhcpd -f -6 -pf /run/dhcp-server6/dhcpd6.pid -cf $CONFIG_FILE $INTERFACES'

Now we need to give dhcp access to this path in Apparmor:

2) Update /etc/apparmor.d/usr.sbin.dhcpd and add an additional line

38d39
  /var/lib/dhcp/dhcpd{,6}.leases* lrw,
  /var/log/ r,
  /var/log/** rw,
  /{,var/}run/{,dhcp-server/}dhcpd{,6}.pid rw,
+ /{,var/}run/{,dhcp-server6/}dhcpd{,6}.pid rw,

Found in package version:
  4.4.1-2ubuntu5

Joshua Stark (starkjs)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.