feat(certificates): get_certificates on both drivers, with ACME, 0.15.0 (NetOrk/netork#2656) #75

Merged
christianmanivong merged 4 commits from feature/certificates-2656 into main 2026-11-26 18:46:01 +00:00
Owner

get_certificates() on both drivers, for NetOrk/netork#2656: the node's TLS certificates in netOrk's certificate contract, so netOrk's expiry warnings cover a Proxmox VE node's and a backup server's web UI and API certificate.

What it reads

  • GET /nodes/{node}/certificates/info (PBS: /nodes/localhost/certificates/info), each row as {name, issuer, valid_from, valid_to, in_use_by} (the shape the OPNsense driver set; Unix timestamps), plus subject, fingerprint and acme. name is the file name (pve-root-ca.pem, pve-ssl.pem, pveproxy-ssl.pem; proxy.pem on PBS), issuer and subject the common names, in_use_by 1 for the certificate the proxy serves (pveproxy-ssl.pem before pve-ssl.pem). The PEM is not returned.
  • ACME with one more call, GET /nodes/{node}/config: acme is true for the certificate an ACME order writes (pveproxy-ssl.pem, PBS proxy.pem) when a domain is configured (acmedomainN, or domains= in the older acme property). An unreadable config reads as no ACME.
  • Unreadable certificates are [], as on OPNsense, so a token without Sys.Audit does not fail the poll.

New module napalm_proxmox/certificates.py (ProxmoxCertificatesMixin, PbsCertificatesMixin with the backup server's file names), mixed into both drivers.

Tests

tests/test_certificates.py (written first): the contract shape for all three PVE files, integer timestamps, which file is served with and without pveproxy-ssl.pem, ACME in both config forms, an account without domains, ACME never on pve-ssl.pem, an unreadable config, unreadable certificates, PBS from the recorded fake, and both drivers having the method. Ran with test_connection, test_pbs_connection, test_time_sync, test_fix_templates, test_get_facts, test_pbs_host (103 passed; after the merge with main the whole suite, 752); ruff check and format; mypy on the new module.

Version

0.15.0 (chore(release): 0.15.0 on this branch), README and CHANGELOG updated. 0.14.0 went to #76 (PVE 9.3) meanwhile: main (4b42322) is merged into this branch, the driver keeps all three new mixins (certificates, credential expiry, update history), and this entry moved to its own 0.15.0 section. With that merge the driver requires napalm-device-types >= 4.44.0, as main does. The whole suite (752), napalm-standard check and napalm-standard ratchet pass on the merged tree. netOrk pins this branch's commit in its PR for NetOrk/netork#2656.

`get_certificates()` on both drivers, for NetOrk/netork#2656: the node's TLS certificates in netOrk's certificate contract, so netOrk's expiry warnings cover a Proxmox VE node's and a backup server's web UI and API certificate. ## What it reads - `GET /nodes/{node}/certificates/info` (PBS: `/nodes/localhost/certificates/info`), each row as `{name, issuer, valid_from, valid_to, in_use_by}` (the shape the OPNsense driver set; Unix timestamps), plus `subject`, `fingerprint` and `acme`. `name` is the file name (`pve-root-ca.pem`, `pve-ssl.pem`, `pveproxy-ssl.pem`; `proxy.pem` on PBS), `issuer` and `subject` the common names, `in_use_by` 1 for the certificate the proxy serves (`pveproxy-ssl.pem` before `pve-ssl.pem`). The PEM is not returned. - ACME with one more call, `GET /nodes/{node}/config`: `acme` is true for the certificate an ACME order writes (`pveproxy-ssl.pem`, PBS `proxy.pem`) when a domain is configured (`acmedomainN`, or `domains=` in the older `acme` property). An unreadable config reads as no ACME. - Unreadable certificates are `[]`, as on OPNsense, so a token without `Sys.Audit` does not fail the poll. New module `napalm_proxmox/certificates.py` (`ProxmoxCertificatesMixin`, `PbsCertificatesMixin` with the backup server's file names), mixed into both drivers. ## Tests `tests/test_certificates.py` (written first): the contract shape for all three PVE files, integer timestamps, which file is served with and without `pveproxy-ssl.pem`, ACME in both config forms, an account without domains, ACME never on `pve-ssl.pem`, an unreadable config, unreadable certificates, PBS from the recorded fake, and both drivers having the method. Ran with `test_connection`, `test_pbs_connection`, `test_time_sync`, `test_fix_templates`, `test_get_facts`, `test_pbs_host` (103 passed; after the merge with main the whole suite, 752); ruff check and format; mypy on the new module. ## Version 0.15.0 (`chore(release): 0.15.0` on this branch), README and CHANGELOG updated. 0.14.0 went to #76 (PVE 9.3) meanwhile: `main` (4b42322) is merged into this branch, the driver keeps all three new mixins (certificates, credential expiry, update history), and this entry moved to its own 0.15.0 section. With that merge the driver requires napalm-device-types >= 4.44.0, as `main` does. The whole suite (752), `napalm-standard check` and `napalm-standard ratchet` pass on the merged tree. netOrk pins this branch's commit in its PR for NetOrk/netork#2656.
christianmanivong added 2 commits 2026-11-26 17:00:03 +00:00
The node's TLS certificates from GET /nodes/{node}/certificates/info (PBS:
/nodes/localhost/certificates/info) in netOrk's certificate contract,
{name, issuer, valid_from, valid_to, in_use_by} with Unix timestamps, so
netOrk's expiry warnings cover a node's web UI and API certificate.

One more call, the node's config, says whether ACME renews the certificate
the proxy serves (acme). The PEM is not returned; unreadable certificates
are [] and an unreadable config reads as no ACME.
chore(release): 0.14.0
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 17s
driver / types (pull_request) Successful in 50s
driver / test (3.13) (pull_request) Successful in 1m2s
driver / test (3.12) (pull_request) Successful in 1m7s
driver / lowest (pull_request) Successful in 33s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m2s
CI / driver (pull_request) Successful in 2m21s
driver / publish (pull_request) Skipped
1db3fb329f
Author
Owner

Version note: main is 0.14.0 since #76 was merged, so this PR needs another number when it is rebased. #77 (services that still run replaced code, NetOrk/netork#2750) took 0.16.0 and leaves 0.15.0 for this one.

Version note: `main` is 0.14.0 since #76 was merged, so this PR needs another number when it is rebased. #77 (services that still run replaced code, NetOrk/netork#2750) took **0.16.0** and leaves 0.15.0 for this one.
christianmanivong added 2 commits 2026-11-26 18:26:30 +00:00
# Conflicts:
#	CHANGELOG.md
#	napalm_proxmox/driver.py
chore(release): 0.15.0
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 57s
driver / test (3.12) (pull_request) Successful in 1m10s
driver / test (3.13) (pull_request) Successful in 1m5s
driver / lowest (pull_request) Successful in 34s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m4s
CI / driver (pull_request) Successful in 2m35s
driver / publish (pull_request) Skipped
bc5127b80f
christianmanivong changed title from feat(certificates): get_certificates on both drivers, with ACME (NetOrk/netork#2656) to feat(certificates): get_certificates on both drivers, with ACME, 0.15.0 (NetOrk/netork#2656) 2026-11-26 18:26:43 +00:00
christianmanivong merged commit ca44e4405d into main 2026-11-26 18:46:01 +00:00
christianmanivong deleted branch feature/certificates-2656 2026-11-26 18:46:01 +00:00
Sign in to join this conversation.