agdsn / hades

AG DSN Authentication and Authorization Infrastructure
MIT License
8 stars 3 forks source link

Add API to release a DHCP lease #67

Closed sebschrader closed 2 years ago

sebschrader commented 6 years ago

Occasionally we change IP-MAC bindings of our users. The typical scenario for this is the following:

A user changes her MAC address, the first MAC has still a lease for the IP and therefore the new MAC can't obtain a lease for the same IP until it expires. Most devices don't release IP addresses or if they do, users might just unplug the device without a proper shutdown which could do a relase.

We need an API to inform the DHCP server, that a lease is no longer valid. An approach, that works with any DHCP server, is to impersonate the user and send DHCPRELEASE packets on his behalf. The dnsmasq repository contains a small utility, dhcp_release in its contrib directory, which does exactly that.

We should build and package this utility and add an RPC task to our Celery API, which executes it.

sebschrader commented 6 years ago

Turns after studying the source code of dhcp_release, that this program works only with clients that are on the same interface as the DHCP server. It tries to find an interface in the same subnet as the IP address of the client. So we need to modify it or implement this ourselves.

Shouldn't be too difficult to implement this functionality ourselves. On the bright side: We can implement it in Python and integrate it directly into the deputy component of Hades.