feat(login-auth): how people log in to the firewall, from config.xml (NetOrk/netork#662) #51

Merged
christianmanivong merged 1 commits from feature/login-auth into main 2026-11-28 07:52:53 +00:00
Owner

For NetOrk/netork#662 (decided 2026-11-28: OPNsense is the next driver-specific read). It uses napalm-device-types 4.50.0's shapes (NAPALM/napalm-device-types#140).

  • get_web_login_auth() returns the auth servers <system><webgui><authmode> names, in order. With none named, it is the Local Database alone. Each server says what it asks for:

    • password for local, ldap and voucher;
    • password_otp for totp and ldap-totp;
    • external for radius;
    • unknown for any other type.

    A name no server has is skipped, as AuthenticationFactory::authenticate skips it. Names are not trimmed, and "Local API" is skipped too.

  • get_ssh_server_auth() reads <system><ssh> the way openssh_configure_do writes sshd_config:

    • server_enabled from enabled;
    • password and challenge-response login together from passwordauth;
    • root login from permitrootlogin.

    Each is tested for presence, as isset. A key is always on. password_sources lists the same servers, because OPNsense's System service runs that list for sshd, login, su and sudo.

  • Both read config.xml over /api/core/backup/download/this, the download get_config uses. No API controller reads these settings.

Tests: tests/unit/test_login_auth.py (17); the full suite passes (643).

For NetOrk/netork#662 (decided 2026-11-28: OPNsense is the next driver-specific read). It uses napalm-device-types 4.50.0's shapes (NAPALM/napalm-device-types#140). - `get_web_login_auth()` returns the auth servers `<system><webgui><authmode>` names, in order. With none named, it is the Local Database alone. Each server says what it asks for: - `password` for `local`, `ldap` and `voucher`; - `password_otp` for `totp` and `ldap-totp`; - `external` for `radius`; - `unknown` for any other type. A name no server has is skipped, as `AuthenticationFactory::authenticate` skips it. Names are not trimmed, and "Local API" is skipped too. - `get_ssh_server_auth()` reads `<system><ssh>` the way `openssh_configure_do` writes sshd_config: - `server_enabled` from `enabled`; - password and challenge-response login together from `passwordauth`; - root login from `permitrootlogin`. Each is tested for presence, as `isset`. A key is always on. `password_sources` lists the same servers, because OPNsense's `System` service runs that list for `sshd`, `login`, `su` and `sudo`. - Both read config.xml over `/api/core/backup/download/this`, the download `get_config` uses. No API controller reads these settings. Tests: `tests/unit/test_login_auth.py` (17); the full suite passes (643).
christianmanivong added 1 commit 2026-11-28 07:07:12 +00:00
feat(login-auth): how people log in to the firewall, from config.xml (NetOrk/netork#662)
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Failing after 18s
driver / types (pull_request) Successful in 58s
driver / test (3.13) (pull_request) Successful in 1m1s
driver / test (3.12) (pull_request) Successful in 1m10s
driver / lowest (pull_request) Successful in 32s
driver / build (pull_request) Successful in 31s
driver / security (pull_request) Successful in 1m2s
CI / driver (pull_request) Failing after 2m21s
driver / publish (pull_request) Skipped
6c612a427b
get_web_login_auth() names the auth servers <system><webgui><authmode> tries,
in order (the Local Database when it names none), each with what it asks for:
password for local, ldap and voucher, password_otp for totp and ldap-totp,
external for radius, unknown otherwise. A name no server has is skipped, as
OPNsense skips it. get_ssh_server_auth() reads <system><ssh> as
openssh_configure_do writes sshd_config: on only with enabled, password and
challenge-response login with passwordauth, root with permitrootlogin, a key
always. An SSH password goes through the same servers (password_sources).
Needs napalm-device-types 4.50.0.
christianmanivong merged commit 2374d57b7d into main 2026-11-28 07:52:53 +00:00
christianmanivong deleted branch feature/login-auth 2026-11-28 07:52:53 +00:00
Sign in to join this conversation.