diff options
author | Indrajit Raychaudhuri <irc@indrajit.com> | 2023-12-27 01:51:35 -0600 |
---|---|---|
committer | Indrajit Raychaudhuri <irc@indrajit.com> | 2023-12-29 00:37:56 -0600 |
commit | 745b9ea8f0df58ccd68215360b0375e89c0632a8 (patch) | |
tree | 3c0411338c62518e6fb3fe1be89b1c4bbd39822a /src/op_mode/clear_dhcp_lease.py | |
parent | 6cf6121b1bf0c3495cb2abc37c34330b422d4d16 (diff) | |
download | vyos-1x-745b9ea8f0df58ccd68215360b0375e89c0632a8.tar.gz vyos-1x-745b9ea8f0df58ccd68215360b0375e89c0632a8.zip |
dhcp: T3316: Adjust kea lease files' location and permissions
Move the kea lease file to a separate directory `/config/dhcp` that `kea`
process can write to so that subprocesses spawned by `kea` process can
operate on the lease files.
To allow `kea` process to write to `/config/dhcp`, add `_kea` user to
`vyattacfg` group. And the lease files are owned completely by `_kea`
user to play well with `kea-lfc` process.
Specifically, this is necessary for `kea-lfc` which is spawned by `kea`
process to clean up expired leases. Since `kea-lfc` creates additional
backup lease files, it needs write access to the lease file directory.
Additionally, change the extension of the lease file from `.leases` to
`.csv` to reflect the actual file format.
Diffstat (limited to 'src/op_mode/clear_dhcp_lease.py')
-rwxr-xr-x | src/op_mode/clear_dhcp_lease.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/op_mode/clear_dhcp_lease.py b/src/op_mode/clear_dhcp_lease.py index 2c95a2b08..7d4b47104 100755 --- a/src/op_mode/clear_dhcp_lease.py +++ b/src/op_mode/clear_dhcp_lease.py @@ -28,7 +28,7 @@ from vyos.utils.commit import commit_in_progress config = ConfigTreeQuery() base = ['service', 'dhcp-server'] -lease_file = '/config/dhcp4.leases' +lease_file = '/config/dhcp/dhcp4-leases.csv' def del_lease_ip(address): @@ -52,7 +52,6 @@ def is_ip_in_leases(address): Return True if address found in the lease file """ leases = kea_parse_leases(lease_file) - lease_ips = [] for lease in leases: if address == lease['address']: return True |