Created
September 15, 2025 08:45
-
-
Save Reiner030/110863ee0e7054902633daa8590caed9 to your computer and use it in GitHub Desktop.
OPNSense ACME plugin check within /conf/config.xml by listing all certificates with their action tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| CFG="/conf/config.xml" | |
| for cuuid in $(xmllint --xpath "//AcmeClient/certificates/certificate/@uuid" "$CFG" \ | |
| | sed 's/uuid="/\n/g' | sed 's/"//g' | awk NF); do | |
| csv=$(xmllint --xpath "string(//AcmeClient/certificates/certificate[@uuid='$cuuid']/restartActions)" "$CFG" 2>/dev/null) | |
| [ -z "$csv" ] && continue | |
| echo "Certificate $cuuid:" | |
| OLDIFS=$IFS | |
| IFS=, | |
| for u in $csv; do | |
| u=$(echo "$u" | tr -d '[:space:]') | |
| name=$(xmllint --xpath "normalize-space(//AcmeClient/actions/action[@uuid='$u']/name)" "$CFG" 2>/dev/null) | |
| [ -z "$name" ] && name="<unknown>" | |
| echo " $u ($name)" | |
| done | |
| IFS=$OLDIFS | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OPNsense ACME Client – Automation Order Helper Scripts
These helper scripts address a bug in the OPNsense ACME client plugin (os-acme-client 4.9 on OPNsense Business 25.4.3) where the GUI does not preserve the order of automations.
On save/re-open, the
<restartActions>list in/conf/config.xmlmay be reordered (often UUID-driven), causingReload-*actions to run beforeCopy-/Sent-*.That can lead to services reloading with old certificates still in place.
The issue is tracked here: opnsense/plugins#4940
Scripts
Show current order
acme_show_certificate_orders.shLists all certificates, their automation UUIDs, and the mapped action names in the current execution order.
Sort
<restartActions>orderacme_reorder_sorted_certificate_tasks.shRewrites
/conf/config.xmlto enforce this stable order:Copy-*Sent-*Reload-*Restart-*(e.g. WebGUI)Each run makes a backup of
/conf/config.xmland reloads configd.Usage
Show current order
Example output:
Sort order
Dry run (no changes):
Apply (writes backup + new order):
Target a single certificate only:
Automate with cron
Run regularly to correct after GUI edits:
The script automatically aborts if
acme.shis currently running.Example Diff
Before:
After:
Notes