summaryrefslogtreecommitdiff
path: root/src/op_mode
AgeCommit message (Collapse)Author
2026-11-03Merge pull request #5567 from aiv/T9469-openvpn-client-config-tls-keyViacheslav Hletenko
openvpn: T9469: add TLS key to generated client config
2026-11-02Merge pull request #5588 from c-po/no-exec-bitChristian Breunig
T9477: remove no longer needed executable bit from conf_mode/migration scripts
2026-11-02Merge pull request #5602 from c-po/T9496-secure-boot-add-imageChristian Breunig
op-mode: T9496: verify secure-boot signature when using "add system image"
2026-11-02Merge pull request #5612 from c-po/T9542-ipsec-script-removedViacheslav Hletenko
ipsec: T9542: replace removed ipsec script with swanctl and systemctl
2026-10-31ipsec: T9543: drop checks for an unset connection-typeChristian Breunig
Since connection-type defaults to initiate, it is always present in the peer configuration. The swanctl template and the reset command still handled an unset value as a separate case, which can no longer happen. Compare against the value directly instead. The reset smoketest only checked for error messages that cannot appear, because a failed reset already aborts the test. It now verifies that reset does not start a peer that is not started at commit.
2026-10-31ipsec: T9543: start a peer again on reset when connection-type is unsetRuben Herold
A site-to-site peer without connection-type is started at commit, because the router treats an unset value as initiate. The reset command only started a peer again when initiate was set explicitly in the configuration. After a reset such a peer was terminated and stayed down, including its VTI interface. Make initiate the default value of connection-type in the CLI definition, so every consumer sees the same value, and read the peer configuration with defaults in the reset command. A peer that is disabled, whose name starts with an at sign or whose remote address is any is not started at commit, so reset keeps skipping it instead of reporting a failed initiation.
2026-10-30ipsec: T9542: do not error on missing route table 220 in debug outputChristian Breunig
"show vpn debug" ended with "Error: ipv4: FIB table does not exist" whenever strongSwan had not installed any route, as the kernel only creates table 220 with its first route. The section now lists the routes of table 220 when there are any and stays empty otherwise.
2026-10-30ipsec: T9542: handle stopped IPsec daemon in op-mode debug and statusChristian Breunig
With strongswan not running, "show vpn debug" and "show vpn ipsec status" printed the full swanctl usage text for every call, and the section headers of "show vpn debug" all appeared at the end of the output. Both commands now report that the IPsec process is not running and skip the swanctl calls; the kernel state is still dumped. Section headers are flushed so they precede their output.
2026-10-30ipsec: T9542: replace removed ipsec script with swanctl and systemctlChristian Breunig
strongSwan 6.x no longer ships the legacy ipsec starter script, so "show vpn debug", "show vpn debug peer" and "show vpn ipsec status" failed with "ipsec: command not found", and QAT acceleration could not stop or start the IPsec daemon. Debug output and status now come from swanctl, filtered per IKE connection and child SA, and QAT controls strongswan.service via systemctl. Debugging a peer without any IPsec configuration now reports the peer as not found instead of raising a traceback.
2026-10-29op-mode: T9496: verify secure-boot signature when using "add system image"Christian Breunig
On a system running with Secure Boot enabled, "add system image" installed the Linux Kernel of the new image without checking its signature. A Kernel not signed by an enrolled Machine Owner Key is rejected by shim, so the new image failed to boot. The Kernel of the new image is now verified against the enrolled MOK keys before anything is copied. If verification fails, the installation is aborted. The existing --force option overrides the check.
2026-10-29op-mode: T9538: fix interface check in reset wireguardChristian Breunig
The CLI existence check always looked up the interface under the argument name intf_name, but reset wireguard passes it as interface. The check therefore only tested whether any WireGuard interface existed: an unconfigured name slipped through and crashed with a KeyError, or the error message reported the interface as "None". The decorator now accepts the name of the argument carrying the interface, defaulting to intf_name, so existing callers are unchanged and reset wireguard reports the unconfigured interface by name.
2026-10-29Merge pull request #5603 from natali-rs1985/T9528Viacheslav Hletenko
op-mode: T9528: Fix OpenConnect OTP display for hotp-event token type
2026-10-29Merge pull request #5604 from natali-rs1985/T9530Viacheslav Hletenko
op-mode: T9530: Fix private key check in OpenVPN client config generator
2026-10-29Merge pull request #5572 from c-po/T9473-cgnatViacheslav Hletenko
cgnat: T9473: invalid input crashes commit and overlapping pools hand out the same external address and ports
2026-10-29op-mode: T9530: Fix private key check in OpenVPN client config generatorNataliia Solomko
The private-key existence check looked up the certificate name instead of the key name, so "key <name>" was never validated and an invalid key crashed with a KeyError traceback. The check now uses the key name and exits with the intended error.
2026-10-29op-mode: T9528: Fix OpenConnect OTP display for hotp-event token typeNataliia Solomko
"show openconnect-server user <name> otp" crashed with UnboundLocalError when the user's token type was `hotp-event`, because only `hotp-time` was handled, so no URI or QR code was shown. Event-based tokens now get an otpauth://hotp URI with a starting counter of 0, and the "full" output also prints the token-type command.
2026-10-28op-mode: T9525: Show only marked connections in "show wan-load-balance ↵Nataliia Solomko
connection" "show wan-load-balance connection" printed every conntrack entry, including health-check pings and flows NATed by other rules. The raw output was already limited to connections marked by WAN load-balancing, so the two outputs disagreed. Both outputs now show only connections marked by WAN load-balancing.
2026-10-26pki: T9149: fix broken OpenVPN shared-secret generated by op-modeChristian Breunig
Since T9008, "generate pki openvpn shared-secret install" kept the comment lines of the openvpn --genkey output as empty lines. The BEGIN marker of the key was therefore stored as part of the key data, and the key file written on commit carried it twice. OpenVPN refused to start every tunnel using it. Comment-only lines are dropped again, as the previous grep -o pipeline did, so only the hex key material is installed. Printed and file output lose the leading blank lines as well. The OpenVPN smoketest now installs a key through the op-mode command and brings up a site-to-site tunnel with it, instead of only using a hardcoded key.
2026-10-26cgnat: T9473: fix allocation display for single-port blocksChristian Breunig
With a per-user limit of one port, nftables stores each allocation as a plain port instead of a range, and "show nat cgnat allocation" crashed with a Python TypeError. Single-port allocations are now shown as a range of one port.
2026-10-24T9477: remove no longer needed executable bit from conf_mode scriptsChristian Breunig
With the full integration of vyos-configd, conf_mode scripts are loaded as Python modules and are no longer meant to be executed individually. Drop the executable bit and the now meaningless shebang. The remaining callers that ran a script directly (boot, op-mode, dhclient hook, vyshim fallback, ...) now invoke it through python3. The build now aborts if a conf_mode script is executable.
2026-10-17T861: remove install mok command and redundant mokutil sudoers ruleChristian Breunig
Enrolling a Machine Owner Key is only needed when testing Secure Boot with a custom, non VyOS Networks signed image, which can be done with plain mokutil. Drop the op-mode wrapper.
2026-10-16openvpn: T9469: add TLS key to generated client configMariusz Dalewski
The client configuration generated by "generate openvpn client-config" never included the TLS shared secret, so a client could not connect to a server using "tls crypt-key" or "tls auth-key" without editing the file by hand. The key is now embedded inline as <tls-crypt>, or as <tls-auth> with "key-direction 1" to match the server side. Configs for servers without a TLS key are unchanged.
2026-10-07Merge pull request #5523 from mandelbitdev/T9370-openvpn-chacha20poly1305Christian Breunig
openvpn: T9370: add chacha20poly1305 data cipher
2026-10-05op-mode: T861: add "show secure-boot detail" commandChristian Breunig
"show secure-boot" only reported whether Secure Boot is enabled, not who signed the running Linux Kernel. An image signed by the VyOS CA could not be told apart from one signed with a custom Machine Owner Key. "show secure-boot detail" now lists issuer and subject of the Kernel image signature certificates. The same information is added to the raw "show version" data as "secure_boot_detail", issuer and subject delimited by ",". The key is only present when Secure Boot is enabled and a signature could be read.
2026-10-01openvpn: T9370: add chacha20poly1305 data cipherAntonio Quartulli
Offer chacha20poly1305 in "encryption data-ciphers" and "encryption data-ciphers-fallback", rendered as CHACHA20-POLY1305 and allowed with DCO.
2026-09-29wwan: T7487: identify modem by port ownership, not interface numberAdam Smith
modem_index() in python/vyos/utils/wwan.py derived the ModemManager modem index straight from the interface name (wwan0 -> 0). The kernel-assigned WWAN interface number and ModemManager's own modem index are two independently enumerated values and are not guaranteed to match - on a box with more than one modem, they can enumerate in different orders, so modem index 0 does not necessarily own wwan0. Every function in this module funnels through modem_index() (start_modem_manager, modem_disconnect, modem_connect, and both admin-disconnect marker helpers), and is_wwan_connected() in vyos.utils.network had its own separate copy of the same assumption - so a single reversed enumeration order silently commands the wrong physical modem for every one of them. modem_index() now lists every modem ModemManager currently knows about and returns whichever one actually has ifname in its own port list, instead of assuming the correspondence. A modem that has not shown up on the bus yet looks the same as one that will never exist, so this waits up to the same modem_wait_timeout budget start_modem_manager() already gives a modem to become dialable, then returns None if nothing claimed the interface. is_wwan_connected() now calls the same resolver instead of keeping its own copy of the old assumption. None is a real, expected return now, not just a theoretical one - the three callers that previously assumed modem_index() always produced *a* string (right or wrong) are updated: start_modem_manager() bails out early (matching the tolerance its own caller's w.exists() check already has for hardware that isn't detected yet), modem_disconnect() and modem_connect() treat it as nothing to disconnect / a failed dial, matching each function's own existing return contract. show_wwan.py's modem_info() raises a clear, specific error instead, which its own top-level exception handler already reports cleanly. set_admin_disconnected()/clear_admin_disconnected() only ever used modem_index() to validate the interface name looks like a WWAN interface in the first place, so they're unaffected.
2026-09-29Merge pull request #5499 from c-po/wwan-improvementsChristian Breunig
wwan: T9350: possible dead interface after boot, disconnect does not stick
2026-09-28Merge pull request #5503 from c-po/T9354Christian Breunig
op-mode: T9354: replace "reset connection" with "reconnect interface"
2026-09-27pki: T9323: give elliptic curve keys their own constructorAntonio Quartulli
create_private_key() took one "size" for every key type, but the number means entirely different things per type: for RSA and DSA it is a modulus size, for EC it selects a curve. CodeQL is not path sensitive across the key_type comparison, so it follows the 256 an EC caller passes into the RSA and DSA branches that caller can never reach, and reports pki.py as generating 256 bit RSA and DSA keys. Build elliptic curve keys in create_ec_private_key() instead and route the op mode generator and the OpenVPN smoketest there, so no curve size ever enters the function that also builds RSA and DSA keys. create_private_key() now refuses a key type it does not build rather than returning None, so a caller cannot drift back into the old shape unnoticed.
2026-09-26Merge pull request #5398 from ruben-herold/T9205-firewall-ruff-cleanupChristian Breunig
firewall: T9205: fix ruff findings in conf_mode/op_mode firewall.py
2026-09-25op-mode: T9354: run interface reconnect detached from calling sessionChristian Breunig
A reconnect is usually issued via the very interface being reconnected. Once the link drops, the calling session dies and the reconnect was killed by SIGHUP - or by SIGPIPE on the next write to the dead terminal - before the interface could be dialed again, leaving the system unreachable. The reconnect now runs in a transient systemd unit and survives the loss of the session. Progress is logged to the journal. PPPoE and SSTP restart the ppp service in a single operation instead of stopping and starting it, so there is no window in which an interrupted command leaves the link down. WWAN still disconnects the modem before dialing again.
2026-09-25firewall: T9205: also catch UnicodeDecodeError from cmdl() outputRuben Herold
cmdl() decodes subprocess output as utf-8 and can raise UnicodeDecodeError (not an OSError subclass) if that fails, in addition to OSError on command failure. Catch both, closing a gap left by the exact-exception narrowing in the previous commit.
2026-09-25firewall: T9205: narrow except Exception to expected error typesRuben Herold
Address copilot-pull-request-reviewer feedback on PR #5398: cmdl() only raises OSError and json.loads() only raises json.JSONDecodeError here, so catching bare Exception hid unrelated bugs. Narrowed all four call sites accordingly (three flagged, one identical pattern found by inspection).
2026-09-25firewall: T9205: fix ruff findings in conf_mode/op_mode firewall.pyRuben Herold
Bare except:, extraneous f-string prefixes on ConfigError()/text calls without placeholders, and 3 unused test locals in test_firewall.py. No behavior change. Split out of PR #5374 (T9160) at sever-sever's request: that PR bundled this cleanup with the apply-path feature because it happened to touch the same files, but it isn't related to apply-path itself.
2026-09-24wwan: T9350: query ModemManager instead of the QMI control portChristian Breunig
show_wwan.py drove qmicli against /dev/cdc-wdmN, which assumes the modem exposes a QMI control port. An MBIM modem does not, so every subcommand of "show interfaces wwan wwanN" failed on one - after waiting out a five second transaction timeout, twice over for "signal": $ show interfaces wwan wwan0 signal Command not supported by Modem (10.6s) $ qmicli --device=/dev/cdc-wdm0 --device-open-proxy --nas-get-signal-info error: couldn't create client for the 'nas' service: CID allocation failed in the CTL client: Transaction timed out ports: cdc-wdm0 (mbim), ttyUSB0 (at), wwan0 (net) ModemManager has already probed the modem and speaks whichever protocol it exposes - QMI, MBIM or plain AT. It is a hard dependency of "interfaces wwan" anyway, as conf_mode cannot dial without it, and it answers from its own cache over D-Bus without touching the device: $ show interfaces wwan wwan0 signal Access technology: lte (0.2s) Signal quality: 58% Operator: Telekom.de Registration: home Packet service: attached State: connected
2026-09-24wwan: T9350: properly disconnect "disconnect interface wwanN"Christian Breunig
Two things kept an operator disconnect from taking effect. vyos-netlinkd re-dials every configured WWAN interface that has lost its session. It cannot tell a session lost to RF signal loss from one that was taken down on purpose, so the disconnect was undone on the next reconcile pass, at most 30 seconds later: $ disconnect interface wwan0 08:53:33 t+10s state=registered 08:53:43 t+20s state=registered 08:53:53 t+30s state=connected <- re-dialled 08:54:03 t+40s state=connected vyos-netlinkd: WWAN interface wwan0 is not connected, re-dialling... vyos-netlinkd: Re-dialled WWAN interface wwan0 Record the intent instead of inferring it from the session state. op-mode "disconnect" drops a marker in /run/vyos-wwan, which _reconcile_wwan() honours and "connect" removes again. conf_mode removes it too, so a commit keeps re-asserting the configured state - the marker only survives for as long as nobody says otherwise, and never across a reboot.
2026-09-24cli: T9077: insert literal '?' inside quoted values instead of triggering helpBrad Kollmyer
The '?' key is a raw readline binding (possible-completions), so a literal question mark can never be typed into a value: readline intercepts the keystroke before bash parsing begins and quoting cannot protect it. Values like remote-group URLs with query strings get silently corrupted ('.../blacklist?key=x' is stored as '.../blacklistkey=x') with no error at any stage. Rebind '?' to a bind -x handler that scans the line left of the cursor for an open single/double quote or a pending backslash escape. Inside a quote or escape the key self-inserts; otherwise it triggers the standard help via a DSR round-trip (printf '\e[5n' with the terminal's reply ESC [ 0 n bound to possible-completions), keeping the help path and output identical to the previous behavior. 'set terminal key query-help enable' now restores the quote-aware handler instead of the raw binding; 'disable' keeps its existing self-insert override, which takes precedence at login as before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-11tech-support: T5475: do not archive nested mount points below /runChristian Breunig
The archive tars /run recursively, and tarfile.add() crosses filesystems. The retired fork mounted the boot medium and the persistence partition below /live, so this was harmless. Debian's live-boot mounts them below /run/live/{medium,persistence,rootfs,overlay}, so the archive now recurses into the whole system disk, fills the staging directory and fails all four smoketests with Unable to read `/run` to archive files: [Errno 28] No space left on device Introduced by vyos-build commit c598316aa436 ("live-boot: T5475: replace the forked live-boot package with Debian's"). Prune nested mount points rather than blacklist one live-boot layout: they are read once from /proc/self/mountinfo, which covers Debian's, upstream's and the fork's paths alike, plus bind mounts os.path.ismount() cannot see. The archive root stays exempt, only directories are pruned and /etc/cni/net.d is kept, so daemon configuration in /run is still archived. ENOSPC now deletes the partial tarball and aborts.
2026-09-07T8497: image_installer: fix vulnarabilityKyrylo Yatsenko
image_installer.py was using data from untrusted source to pass to shell without escaping in case VRF was activated. Change to list in call to `cmd` to fix this, remove extra code for VRF wrappers to library parameters.
2026-09-01version: T9269: omit hardware details on containersChristian Breunig
A container has no hardware of its own - vendor, model, serial and UUID are read from /sys/class/dmi/id and thus describe the host system. Listing them below "System type: container" reads as a property of the node. Leave the hardware_* keys unset when running as a container and omit the entire block in both "show version" and the airbag bug report. The latter moves the fields into an optional HARDWARE section, as str.format() has no conditionals.
2026-09-01op-mode: T9269: report Secure Boot as "n/a (container)"Christian Breunig
A container is not booted by any firmware, so neither the UEFI nor the BIOS wording applies. Worse, is_uefi_system() probes /sys/firmware/efi which a container inherits from its host, thus a container on a UEFI host reported the Secure Boot state of that host. Check is_running_as_container() first and report "n/a (container)", leaving the UEFI and BIOS detection untouched for everything else.
2026-08-26Merge pull request #5375 from ruben-herold/T9162-nat-show-interface-keyerrorJohn Estabrook
nat: T9162: fix KeyError when show nat rules has no inbound-interface
2026-08-20utils: T8868: Refactor kernel command-line arguments and memory infoOleksandr Kuchmystyi
- Replaced direct file reads from `/proc/cmdline` with `get_kernel_boot_arg()` for fetching kernel command-line arguments in multiple modules. - Improved memory information retrieval by utilizing `get_memory_info()`.
2026-08-20kdump: T8868: Implement kernel crash dump supportOleksandr Kuchmystyi
Add new CLI subtree 'system option kdump' with memory reservation and local dump path configuration. Also add 'show system kdump' and 'show system kdump dumps' operation mode commands to get status of the configuration and list of dumps. Extend 'show tech-support report' and 'generate tech-support archive' with kdump service status, active config files and the recently kernel dump file.
2026-08-14Merge pull request #5123 from indrajitr/ddclient-v4Daniil Baturin
ddclient: T6981: Upgrade ddclient to v4.0.0
2026-08-11Merge pull request #5388 from c-po/remove-acme-autocertChristian Breunig
pki: T9135: derive ACME certificate chains from disk
2026-08-11Merge pull request #5365 from l0crian1/last-usedJohn Estabrook
firewall: T8221: Add last-used option to firewall rules
2026-08-10pki: T9135: add "show pki ca/certificate <name> text" commandChristian Breunig
"show pki ca/certificate <name>" only ever offered PEM output, which isn't practical for a human to actually read. Add a "text" form that runs the certificate through OpenSSL's own "-text" formatter, the same human-readable breakdown "openssl x509 -text" produces.
2026-08-10pki: T9135: correctly resolve a file:// URL when importing a CA certificateChristian Breunig
The local-file branch of CA certificate import recognized a file:// URL by scheme but never actually decoded it - os.path.exists()/open() still received the full "file://..." string rather than the path component, so an explicit file:// URL always failed with "File not found" even when it pointed at a real, readable file.
2026-08-10pki: T9135: preserve every certificate in an ACME chain, not just the firstChristian Breunig
certbot's chain.pem commonly holds more than one certificate - e.g. the immediate intermediate plus its own issuing root - but the synthetic CA entry built from it only ever kept the first, silently dropping the rest before find_chain() ever saw them. This left a shorter chain than certbot itself actually has, e.g. requiring a root to also be configured manually to reach the same result certbot's own data already provides. Parse every certificate block in chain.pem and emit one synthetic entry per certificate, numbering entries after the first so each is still its own addressable, non-redundant, non-settable object exactly like before.