> On 10. Jan 2024, at 12:55, Stuart Henderson <s...@spacehopper.org> wrote:
> 
> I think we'll need to warn users about the change some way or other
> otherwise they'll lose their existing lease db and could end up issuing
> conflicting leases. Though I wonder how this works at all t the moment
> because there's a "touch dhcpd.leases" in the rc script which would
> create it owned by root if missing...


Here two issues:
1. dhcpd can't write into dhcpd.leases
2. dhcpd can't move dhcpd.leases~ into dhcpd.leases

On my machine I've changed permission to dhcpd.leases by hand,
by default root owns it => dhcpd can't do anything with it.

=> end user lives with dhcpd.leases~

So, here I have two ideas:

1. Move dhcpd.leases~ into dhcpd/dhcpd.leases inside rc script
like this:
rc_pre() {
        # keep for migration to /var/db/dhcpd
        # See: https://marc.info/?l=openbsd-ports&m=170490611812818&w=2
        test -f /var/dhcpd/dhcpd.leases~ && mv -f /var/dhcpd/dhcpd.leases~ 
/var/db/dhcpd/dhcpd.leases
        touch /var/db/dhcpd/dhcpd.leases
        chown _isc-dhcp:_isc-dhcp /var/db/dhcpd/dhcpd.leases
}

or add readme / note which suggest to move that file by hand
before services is started with wording like this:

The previous version of ISC-DHCPD contained a bug that caused missed permissions
when writing to the leases DB. This resulted in the database being stored at
/var/db/dhcpd.leases~ instead of /var/db/dhcpd.leases and never updated or
cleanedup. Please move an actual DB into /var/db/dhcpd/dhcpd.leases with
changing ownership to _isc-dhcp:_isc-dhcp. You may use dhcp-lease-list to
determine which DB is actual one.



--
wbr, Kirill

Reply via email to