Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
Re: net/isc-dhcpd: avoid uncontrolled grow of lease db
To:
"Kirill A. Korinsky" <kirill@korins.ky>
Cc:
ports@openbsd.org
Date:
Wed, 10 Jan 2024 20:21:22 +0000

Download raw body.

Thread
  • Kirill A. Korinsky:

    net/isc-dhcpd: avoid uncontrolled grow of lease db

  • On 2024/01/10 18:49, Kirill A. Korinsky wrote:
    > > On 10. Jan 2024, at 12:55, Stuart Henderson <stu@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
    > }
    
    definitely not this
    
    > 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.
    
    hrmmm, that doesn't make sense, if it can't write to /var/db/dhcpd.leases
    due to permissions, it shouldn't be able to write to /var/db/dhcpd.leases~
    either..
    
    I'll try and find some time to do a test install and figure out what's 
    going on, but it won't be for a few days
    
    
    
  • Kirill A. Korinsky:

    net/isc-dhcpd: avoid uncontrolled grow of lease db