Free ACME scripts / Windows
PRTG certificate renewal script for simple-acme
Deploys Simple-ACME PEM files to PRTG Network Monitor.
The scripts are made for simple-acme and lego, which FairSSL, the company behind sslbrain, sponsors.
- Version
- 1.2
- Language
- PowerShell
- SHA-256
- 1a8c7650f4bcb9750551b959ba49bc5307de327ef141da8aaccc02f4af53ff26
- Licence
- Apache-2.0, copyright FairSSL A/S
Download it on the server, check the SHA-256 and keep it as C:\simple-acme\Scripts\ImportPRTG.ps1, so a newer version later replaces it without a change to your renewal:
# Windows PowerShell 5.1 needs TLS 1.2 switched on for this session
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -UseBasicParsing -Uri 'https://sslbrain.com/free-acme-scripts/files/prtg-1.2.ps1' -OutFile 'C:\simple-acme\Scripts\ImportPRTG.ps1'
(Get-FileHash 'C:\simple-acme\Scripts\ImportPRTG.ps1' -Algorithm SHA256).Hash -eq '1A8C7650F4BCB9750551B959BA49BC5307DE327EF141DA8AACCC02F4AF53FF26'
Unblock-File 'C:\simple-acme\Scripts\ImportPRTG.ps1' What it does
Use this as a Simple-ACME installation script together with the pemfiles store plugin. The script does not request or renew certificates. It only copies the certificate files that Simple-ACME already created.
PRTG expects these files in the cert folder below the PRTG program directory: prtg.crt prtg.key root.pem
Requirements
- Windows Server with Windows PowerShell 5.1, run as Administrator
- simple-acme, which runs the script after each issuance and renewal
Parameters
| -StorePath | The PEM output base folder from Simple-ACME. |
|---|---|
| -FilePrefix | The --pemfilesname value used when the renewal was created. |
| -PrtgCertPath | Optional explicit path to the PRTG cert folder. Leave empty to auto-detect: the cert folder below the folder that holds "64 bit" or "32 bit" with the PRTG Core Server, whatever that folder is called (PRTG may be installed in a folder of the customer's own choice, such as D:\PRTG). |
Get a certificate and run the script
Made for simple-acme; works with win-acme too.
Run simple-acme's wacs.exe from its folder (here C:\simple-acme) as Administrator. It orders the
certificate, saves it in the Windows certificate store and as PEM files, runs the script, and creates the scheduled task that
renews the certificate and runs the script again. Replace www.example.com, the e-mail address and
the script's parameters (see Parameters; simple-acme fills in tokens such as
{CertThumbprint}, {StorePath} and {RenewalId}).
--validation selfhosting answers the CA's HTTP challenge on port 80; on a web server use
--validation filesystem --webroot <site folder> instead.
.\wacs.exe `
--baseuri "https://acme-v02.api.letsencrypt.org/directory" `
--accepttos --emailaddress "you@example.com" `
--source manual --host "www.example.com" `
--validation selfhosting `
--store certificatestore,pemfiles --pemfilespath "C:\simple-acme\Certificates" `
--installation script `
--script ".\Scripts\ImportPRTG.ps1" `
--scriptparameters "<parameters>" Choose the ACME server
The command uses Let's Encrypt. For another ACME server, put its options in place of
--baseuri "…"; for acme.sslbrain.com, --validation none replaces --validation selfhosting.
| Let's Encrypt | --baseuri "https://acme-v02.api.letsencrypt.org/directory" No account to create: the client registers one with your e-mail address. Let's Encrypt documentation |
|---|---|
| Google Trust Services | --baseuri "https://dv.acme-v02.api.pki.goog/directory" --eab-key-identifier "EAB_KID" --eab-key "EAB_HMAC" Create an EAB key in a Google Cloud project (gcloud publicca external-account-keys create). Put the key's id and HMAC in place of EAB_KID and EAB_HMAC. Google Public CA tutorial |
| ZeroSSL | --baseuri "https://acme.zerossl.com/v2/DV90" --eab-key-identifier "EAB_KID" --eab-key "EAB_HMAC" Copy the EAB credentials from the Developer section of your ZeroSSL account. Put the key's id and HMAC in place of EAB_KID and EAB_HMAC. ZeroSSL ACME documentation |
| acme.sslbrain.com | --baseuri "https://acme.sslbrain.com/acme/directory" --eab-key-identifier "EAB_KID" --eab-key "EAB_HMAC" --validation none Create an EAB key in sslbrain Cloud (Basic or higher) under ACME clients, Connect a client. sslbrain Cloud validates the domain through a CNAME redirect, a DNS API or pre-validation, not your ACME client. Put the key's id and HMAC in place of EAB_KID and EAB_HMAC. sslbrain plans |
Licence and credits
Copyright FairSSL A/S, licensed under the Apache License 2.0: use it, change it and share it, also commercially.
Runs in simple-acme (formerly win-acme), Apache-2.0.
Writing a guide or answering a question? Link to this page instead of copying the script: it always has the newest version and its SHA-256.
[PRTG certificate renewal script for simple-acme](https://sslbrain.com/free-acme-scripts/prtg/) <a href="https://sslbrain.com/free-acme-scripts/prtg/">PRTG certificate renewal script for simple-acme</a> One script per server, or sslbrain does it for all your servers without scripts.
Feedback and improvements are welcome: info@fairssl.dk