summaryrefslogtreecommitdiff
path: root/src/conf_mode/dhcp_server.py
AgeCommit message (Collapse)Author
2023-12-31T5474: establish common file name pattern for XML conf mode commandsChristian Breunig
We will use _ as CLI level divider. The XML definition filename and also the Python helper should match the CLI node. Example: set interfaces ethernet -> interfaces_ethernet.xml.in set interfaces bond -> interfaces_bond.xml.in set service dhcp-server -> service_dhcp-server-xml.in
2023-12-29dhcp: T3316: Adjust kea lease files' location and permissionsIndrajit Raychaudhuri
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.
2023-12-28Merge pull request #2650 from indrajitr/kea-reservation-fixChristian Breunig
dhcp: T3316: Support hostname, DUID and MAC address in reservation
2023-12-22T5840: Add override for systemd kea-ctrl-agent.serviceViacheslav Hletenko
After update KEA to 2.4.x in the bf04cd8fea44d375fb7d93d75a1f31c220730c88 there is a file that expects ConditionFileNotEmpty=/etc/kea/kea-api-password It cause the unit `kea-ctrl-agent.service` cannot start systemd[1]: kea-ctrl-agent.service - Kea Control Agent was skipped because of an unmet condition check (ConditionFileNotEmpty=/etc/kea/kea-api-password) Override systemd kea-ctrl-agent.service do not check this file
2023-12-21dhcp: T3316: Support hostname, DUID and MAC address in reservationIndrajit Raychaudhuri
Reinstate support for hostname in DHCP reservation. Having `hostname` in allows for server-side assignment of hostname. This is useful for static lookup of hostname. Ensure that hostname is a valid FQDN (doesn't have underscore, etc.) Additionally, support using either of DUID or MAC address for reservation. While MAC address is typically used for IPv4, and DUID is typically used for IPv6, either of them can be used in IPv4 and IPv6 reservations in Kea.
2023-12-17dhcp: T3316: Kea DHCP and DHCPv6 fixessarthurdev
* Move Kea socket permission change on-demand and speed up conf scripts * Fix issue with DHCP reservations when no `ip-address` value
2023-12-08dhcp: T3316: Migrate dhcp/dhcpv6 server to Keasarthurdev
2023-09-04T2958: Refactor DHCP-server systemd unit and leaseViacheslav Hletenko
Render isc-dhcp-server systemd unit from configuration
2023-08-15T5483: clean up tmp config fileJohn Estabrook
2023-08-07T5319: remove workarounds for defaults in dhcp_server.pyJohn Estabrook
2023-08-06T5195: move helpers from vyos.validate to vyos.utils packageChristian Breunig
2023-07-14T5195: vyos.util -> vyos.utils package refactoring (#2093)Christian Breunig
* T5195: move run, cmd, call, rc_cmd helper to vyos.utils.process * T5195: use read_file and write_file implementation from vyos.utils.file Changed code automatically using: find . -type f -not -path '*/\.*' -exec sed -i 's/^from vyos.util import read_file$/from vyos.utils.file import read_file/g' {} + find . -type f -not -path '*/\.*' -exec sed -i 's/^from vyos.util import write_file$/from vyos.utils.file import write_file/g' {} + * T5195: move chmod* helpers to vyos.utils.permission * T5195: use colon_separated_to_dict from vyos.utils.dict * T5195: move is_systemd_service_* to vyos.utils.process * T5195: fix boot issues with missing imports * T5195: move dict_search_* helpers to vyos.utils.dict * T5195: move network helpers to vyos.utils.network * T5195: move commit_* helpers to vyos.utils.commit * T5195: move user I/O helpers to vyos.utils.io
2023-03-22T5105: Fix error message from dhcp-serverNicolas Fort
2023-02-12T5001: Replace links to the phabricator siteChristian Breunig
Replace links to the phabricator site from https://phabricator.vyos.net to https://vyos.dev
2022-04-15dhcp(v6)-server: T4353: fix Jinja2 linting errorsChristian Poessinger
2022-04-08dhcp-server: T4344: Fix underscores for shared network nameViacheslav Hletenko
Shared network name should not be handled by tag node mangling I.e. should not replace underscores with dashed set service dhcp-server shared-network-name NET_01 shared-network NET_01 { authoritative; ... on commit { set shared-networkname = "NET_01"; } }
2021-10-21Merge pull request #1036 from sever-sever/T3610Christian Poessinger
dhcp-server: T3610: Allow configuration for non-primary ip address
2021-10-21dhcp-server: T3610: Allow configuration for non-primary ip addressViacheslav
2021-10-21dhcp: T3626: Prevent to disable only one configured networkViacheslav
2021-09-19dhcp-server: T3672: re-add missing "name" CLI optionChristian Poessinger
This option is mandatory and must be user configurable as it needs to match on both sides.
2021-09-19dhcp-server: T3672: only one failover peer is supportedChristian Poessinger
2021-09-18dhcp-server: T1968: allow multiple static-routes to be configuredChristian Poessinger
vyos@vyos# show service dhcp-server shared-network-name LAN { subnet 10.0.0.0/24 { default-router 10.0.0.1 dns-server 194.145.150.1 lease 88 range 0 { start 10.0.0.100 stop 10.0.0.200 } static-route 192.168.10.0/24 { next-hop 10.0.0.2 } static-route 192.168.20.0/24 { router 10.0.0.2 } } }
2021-05-27dhcp-server: T2669: do not allow overlapping ranges to be createdChristian Poessinger
set service dhcp-server shared-network-name NET01 authoritative set service dhcp-server shared-network-name NET01 subnet 10.0.0.0/24 default-router '10.0.0.1' set service dhcp-server shared-network-name NET01 subnet 10.0.0.0/24 lease '86400' set service dhcp-server shared-network-name NET01 subnet 10.0.0.0/24 range RNG01 start '10.0.0.60' set service dhcp-server shared-network-name NET01 subnet 10.0.0.0/24 range RNG01 stop '10.0.0.70' set service dhcp-server shared-network-name NET01 subnet 10.0.0.0/24 range RNG02 start '10.0.0.55' set service dhcp-server shared-network-name NET01 subnet 10.0.0.0/24 range RNG02 stop '10.0.0.65' Will result in a dhcpd.conf: shared-network NET01 { authoritative; subnet 10.0.0.0 netmask 255.255.255.0 { option routers 10.0.0.1; default-lease-time 86400; max-lease-time 86400; range 10.0.0.60 10.0.0.70; range 10.0.0.55 10.0.0.65; } on commit { set shared-networkname = "NET01"; } } This is not allowed by ISC DHCPd: dhcpd[3307]: /run/dhcp-server/dhcpd.conf line 25: lease 10.0.0.63 is declared twice! dhcpd[3307]: range 10.0.0.55 10.0.0.65;
2021-05-15dhcp-server: T3544: fix FileNotFoundError on first invokationChristian Poessinger
The problem of using the move() operation over render() is that render will silently create the directory tree in the background and move() does not. This means that on first boot when /run/dhcp-server does not exist, move will fail with a FileNotFoundError. Instead of using move() we render() the configuration two times, one for validating it via dhcpd -t and the other time to really apply it to the service. The performance impact should be little as the config should still be cached in the system RAM.
2021-05-13dhcp-server: T3544: test config in IPv4 mode onlyChristian Poessinger
2021-05-13dhcp-server: T3544: test newly rendered configuration before restarting daemonChristian Poessinger
The current DHCP server implementation comes with options (see below) which allow the user to pass in any arbitrary option(s) in a verbatim way which will manifest in dhcpd.conf. The options are: * set service dhcp-server global-parameters * set service dhcp-server shared-network-name foo shared-network-parameters * set service dhcp-server shared-network-name foo subnet 192.0.2.0/25 subnet-parameters * set service dhcp-server shared-network-name foo subnet 192.0.2.0/25 static-mapping ff static-mapping-parameters Having an invalid configuration will yield: vyos@vyos# commit [ service dhcp-server ] Configuration file errors encountered - check your options! [[service dhcp-server]] failed
2021-01-03dhcp: T2562: harden implementation for non existing shared-subnetsChristian Poessinger
2021-01-03dhcp: T3180: bugfix assignment of sliced ranges to config dictChristian Poessinger
A reference to a dictionary key obtained by a for loop can not be used to update values inside that dictionaries key. You must use the original path to the nested dictionaries key.
2021-01-03dhcp: T3180: bugfix NameError when slicing server rangesChristian Poessinger
Introduced in commit e46def834483e ("dhcp: T3100: re-add range slicing support when exclude addresses are used") by not obeying the move from list to dict and still relying on the old list names variables.
2020-12-06dhcp: T2562: add "listen-address" CLI node for better DHCP relay supportChristian Poessinger
Running ISC DHCP server as backend server for multiple pools served to relay agents requires DHCPd to explicitly listen on give interfaces or a "transit" subnet declaration facing the network where we receive the DHCPREQ messages on. This implements a new "listen-address" CLI node, the given address is validated if it is assigned to the system and upon success, a proper "subnet { }" statement is added into dhcpd.conf
2020-12-04dhcp: T3100: re-add range slicing support when exclude addresses are usedChristian Poessinger
Support was not yet present after the rewrite from commit 84b7ade2 ("dhcp: T3100: migrate server configuration to get_config_dict()")
2020-12-04dhcp: T3100: migrate server configuration to get_config_dict()Christian Poessinger
2020-08-31configd: T2582: add scripts to include list for daemonJohn Estabrook
2020-05-29airbag: T2088: explicit enabling of the featureThomas Mangin
airbag must now be explicitly installed. the patch also allow to fully disables the installation of the logging code at setup (and not just installing and doing nothing)
2020-04-27template: T2388: move mkdir/chmod/chown within render()Thomas Mangin
2020-04-12dhcp-server: T2185: add comment on config dir generationChristian Poessinger
2020-04-12dhcp-server: T2185: create directories in /run on-demandChristian Poessinger
Commit bc68244 ("dhcp-server: T2185: migrate from SysVinit to systemd") migrated the DHCP subsystem to systemd, necessary directories in the volatile /run directory have not been created.
2020-04-12dhcp-server: T2185: fixup ConditionPathExists variableChristian Poessinger
Commit bc68244 ("dhcp-server: T2185: migrate from SysVinit to systemd") migrated the DHCP subsystem to systemd, but on the test-system there was still the old configuration file present not triggering this condition.
2020-04-12dhcp-server: T2185: migrate from SysVinit to systemdChristian Poessinger
2020-04-12template: T2230: use render to generate templatesThomas Mangin
convert all call to jinja to use template.render
2020-04-09util: T2226: os.system was wrongly converted to runThomas Mangin
os.system does print the ouput of the command, run() does not. A new function called call() does the printing and return the error code.
2020-04-06util: T2226: covert most calls from os.system to utilThomas Mangin
As little change a possible but the function call The behaviour should be totally unchanged.
2020-04-05dhcp-server: T2230: rename template dir from dhcp -> dhcp-serverChristian Poessinger
2020-04-05dhcp: T2230: move inlined templates to dedicated filesChristian Poessinger
2020-03-03dhcp-server: T2092: add default route to rfc3442-static-route optionAndras Elso
2020-03-03dhcp-server: T2062: Fix static route bytesAndras Elso
2019-12-13T1873: DHCP: ship our own server init scriptsJernej Jakob
2019-11-28dhcp-serverr: T1825: replaced DHCP configuration error messagezdc
Previous one DHCP configuration error message does not point that DHCP server work only with primary IP address on interface.
2019-10-19dhcp-server: T1745: bugfix corner case on static-assignmentsChristian Poessinger
There was a bug when refactoring this with commits 5848a4d ("dhcp-server: T1707: remove DHCP static-mappings from address pool") and 1182b44 ("dhcp-server: T1707: bugfix on subsequent DHCP exclude addresses") that when a static address assignemnt was using the last IP address from the specified range. This triggered the following error: "DHCP range stop address x must be greater or equal to the range start address y!"
2019-10-03dhcp-server: T1707: remove DHCP static-mappings from address poolChristian Poessinger
Previously when static-mappings have been created the address was still within the DHCP pool resulting in log entries as follows: dhcpd: Dynamic and static leases present for 192.0.2.51 dhcpd: Remove host declaration DMZ_PC2 or remove 192.0.2.51 dhcpd: from the dynamic address pool for DMZ (cherry picked from commit 6f954ab56768af9a07d8a1dc086f54ddefa58da7)