Free ACME scripts

Report format

What a script sends to your own receiver after each installation, so you can see every server's certificate in one place.

Turn it on

Reporting is off until you give the script an HTTPS address: -ReportUrl on the PowerShell scripts, --report-url on the bash scripts, or the report address variable at the top of the script. An empty address sends nothing. The scripts that can report:

The scripts that install a certificate in the background (Deploy-FortiGate.ps1, Deploy-FortiMail.ps1, Deploy-FortiManager.ps1, Deploy-FortiADC.ps1, Deploy-FortiNAC.ps1, Deploy-FortiWeb.ps1, Deploy-PaloAlto.ps1, fairssl-fortigate, fairssl-fortimail) and FairSSLResultNotification.ps1 can report each result to an address of your choice, so one place shows what every server installed and what failed.

Turning it on

A script reports when it has a report address, and sends nothing when it has none.

ScriptReport address
PowerShell-ReportUrl https://reports.example.com/acme in the command, or the line $DefaultReportUrl = '' near the top of the file
Bash--report-url https://reports.example.com/acme in setup, or the line DEFAULT_REPORT_URL="" near the top of the file

The scripts in this library have an empty address. The copies in FairSSL’s simple-acme download have FairSSL’s address on that line, and FairSSL’s guides for the Linux scripts give it with --report-url; that line is the only difference. In PowerShell, -ReportUrl '' turns reporting off for one command. Only an https address is used.

The request

POST <report address>
Content-Type: application/json
Accept: application/json

The body is one JSON object in UTF-8. There is no authentication: a receiver treats a report as a claim and checks it against what it knows (FairSSL compares the account, the domain and the certificate with its own ACME orders). A report is sent only when the script finds the ACME account of the certificate.

FieldTypeSentMeaning
kidstringalwaysThe ACME account URL the certificate was ordered with
renewal_idstringalwaysThe renewal on this server: simple-acme’s renewal id, or the id setup made for the Linux scripts
domainstringalwaysThe certificate’s primary name
statusstringalwaysResult of the certificate order: success, failure or unknown
install_statusstring or nullwhen knownResult of the installation: success, failure, unknown; null while a worker is still trying
install_error_codestringon failureA short code such as CONNECT_FAILED, NO_ACCESS, ROLLED_BACK, POSH_SSH_MISSING
install_error_stringstringon failureOne sentence, at most 500 characters
thumbprintstringwhen readSHA-1 fingerprint of the certificate
certificate_sha256stringwhen readSHA-256 fingerprint of the certificate
expiry_atstringwhen readExpiry, ISO 8601 UTC
key_typestringwhen readRSA 2048, ECDSA P-256
machine_namestringalwaysThe server’s name
client_versionstringwhen readThe ACME client: 2.4.1 (simple-acme), lego 4.x
script_versionstringalwaysThe script’s own version
installationsarrayalwaysOne entry per installation step: plugin and, for a script, script (file name), script_version and (PowerShell) script_sha256 of the file as it lies on the server
storesarraynotification scriptsimple-acme’s store plugins of the renewal
os_version, powershell_versionstringwhen readThe server’s operating system and PowerShell
device_model, device_versionstringwhen readWhat the appliance says it is: FortiGate-VM64, v7.4.13
metaobjectalwaysDetails for a person: the worker’s log of the attempt (log), the appliance address, attempt number, simple-acme’s error messages

The scripts never send a password, an API key, a private key, a certificate, their own parameters or simple-acme’s log.

The answer

A report is delivered when the answer’s body is JSON with "ok": true:

{"ok": true}
AnswerWhat the script does
"ok": trueDeletes the report.
No answer, an HTTP error, a body without "ok": trueKeeps the report and sends it again: the notification script after 1, 5 and 15 minutes and then every hour, the workers with each attempt and then on their own schedule. There is no limit on time or attempts, and a restart of the server does not lose a report.
A body with "errors"The receiver read the report and refused its content. Deploy-FortiGate.ps1, Deploy-FortiMail.ps1, Deploy-FortiManager.ps1, Deploy-FortiADC.ps1, Deploy-FortiNAC.ps1, Deploy-FortiWeb.ps1 and the Linux scripts move it to a folder refused beside their outbox and do not send it again, so it cannot hold up the reports behind it. Deploy-PaloAlto.ps1 and FairSSLResultNotification.ps1 keep sending it.

A receiver therefore answers "ok": true to every report it has stored, also one it has seen before: the same report can arrive twice when an answer was lost on the way. A receiver that is busy answers anything else, and the report comes back.

A minimal receiver

Any HTTPS endpoint that stores the body and answers {"ok": true} is a receiver. Reports are small: a few kilobytes, and tens of kilobytes when a worker’s log of a long attempt is in it.

One script per server, or sslbrain does it for all your servers without scripts.

See how sslbrain works

Feedback and improvements are welcome: info@fairssl.dk