Files
lucioandClaude Opus 5 dd608e6a20 Add Aruba InstantOS certificate update tool and hermes skill
Automates pushing a renewed TLS certificate to an Aruba InstantOS AP and
pointing the Web UI certificate usage at it, replacing the manual
Maintenance -> Certificates flow.

Commands: status, check-caddy, check-ap, update. `update` is idempotent,
so it is safe to run on a schedule.

The /swarm.cgi API was reverse-engineered from the InstantOS 8.x web UI
bundle and verified against live hardware. Four behaviours documented in
the README each silently break a naive implementation:

- scalars return as <data name=".."> rather than named tags, including
  the login sid
- cert types are ServerCert/TrustedCA/ClientCert/PublicCert; the
  server_cert values in the bundle are overwritten at runtime
- uploads are synchronous and the POST body is the only real result;
  upload_status returns not_available even for uploads that succeeded
- the AP closes TLS without close_notify, which OpenSSL 3 rejects

Credentials are read from ~/.config/aruba-ap-cert/.env, outside the repo.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-07-27 03:58:14 -07:00

4.7 KiB

name, description, version, author, tags
name description version author tags
aruba-ap-cert Check and update the TLS certificate on the Aruba InstantOS AP portal (aruba.luci.ooo:4343) from Caddy's Let's Encrypt store on LU-NAS. Use for checking cert expiry on either side, or pushing a renewed wildcard cert to the AP Web UI. 1.0 hermes
aruba
instantos
tls
certificate
caddy
luci.ooo
letsencrypt

Aruba AP Certificate Update

Overview

Caddy on LU-NAS renews the *.luci.ooo wildcard certificate via Let's Encrypt. The Aruba AP does not pick this up automatically — the cert must be combined with its private key and uploaded to the AP portal by hand. This skill automates that.

Everything is in aruba_cert.py next to this file. Run it on luhpe, where /mnt/lu-nas is mounted.

The three operations

# 1. Expiry of the certificate Caddy has (no credentials needed)
python3 aruba_cert.py check-caddy

# 2. Expiry of the certificate live on the AP Web UI
python3 aruba_cert.py check-ap

# 3. Compare both side by side — start here
python3 aruba_cert.py status

# 4. Push Caddy's certificate to the AP and point the Web UI at it
python3 aruba_cert.py update

update is idempotent: if the AP already serves a certificate as new as Caddy's, it reports that and exits 0 without touching anything. Use --force to override. Always sanity-check with --dry-run first when unsure.

Configuration

Only two things ever change. Both live in ~/.config/aruba-ap-cert/.env (mode 600, deliberately outside the skills tree so it is never published):

ARUBA_HOST=10.233.33.2:4343
ARUBA_USERNAME=admin
ARUBA_PASSWORD=...

ARUBA_HOST accepts an IP or hostname, with port. Override per-run with --host. A real environment variable beats the file; --env-file points elsewhere.

Everything else is baked in: the Caddy path, PEM format, the cert,chain,key bundle order, and the ui certificate usage.

What update actually does

  1. Reads wildcard_.luci.ooo.crt + .key from Caddy's ACME store: /mnt/lu-nas/docker/caddy/data/caddy/certificates/acme-v02.api.letsencrypt.org-directory/wildcard_.luci.ooo/
  2. Verifies the key matches the certificate, then concatenates them as cert, chain, key — the private key must come after the certificate.
  3. Skips the upload if the AP already has something this new (unless --force).
  4. Uploads to /swarm.cgi (opcode=cert-upload-new, PEM, server slot), naming it after its expiry in local time — e.g. Sep2_2026, matching the existing convention on the AP.
  5. Pushes the certificate usage:
    wlan cert-assignment-profile
    pki-cert-assign application ui cert-type ServerCert certname <name>
    exit
    
  6. Prints show cert assignment to confirm, and deletes the temporary bundle (it contains the private key).

Gotchas

  • The Web UI cert only takes effect when the AP's web server restarts. If https://aruba.luci.ooo:4343 still serves the old cert after a successful update, reboot the virtual controller.
  • The AP rejects a re-upload of an identical certificate, replying Abort because Cert with same digest already exists as <name>. This is normal when Caddy has not renewed yet — the idempotency check avoids hitting it.
  • ui and captive-portal are separate usages pointing at separate certs. This skill manages ui by default; pass --application captive-portal to move that one too.
  • The AP closes TLS without a close_notify, which OpenSSL 3 treats as a truncated response. The script sets OP_IGNORE_UNEXPECTED_EOF; do not "simplify" that adapter away or every call breaks.
  • InstantOS returns scalars as <data name="...">, not as named tags. The parser normalizes those keys; the login sid arrives the same way.
  • Uploads are synchronous and the POST body is the only real result. The web UI polls opcode=upload_status&oper_id=..., but this AP answers not_available for every id — including uploads that demonstrably succeeded. Trusting that poll reports working uploads as failures. The script reads the POST body for <error>, then confirms by looking the certificate up in show cert all. Do not reintroduce polling.
  • Certificate types are ServerCert / TrustedCA / ClientCert / PublicCert. The UI bundle appears to offer server_cert, ca_cert etc., but that option list is overwritten at runtime. Sending server_cert fails with "Cert Path: cert type is unknown".

When to run

Caddy renews roughly 30 days before expiry (the ACME renewal window is in wildcard_.luci.ooo.json). A weekly status is enough to catch it; run update once Caddy shows a newer date than the AP.

python3 aruba_cert.py status && python3 aruba_cert.py update