Certificate Scripts: Validate and Deploy

The Automation Scripts section on the certificate page has two slots: an issuing script automates validation (for example adding the DNS record), and a post-issuance script sends the new certificate where it needs to go after every issue and every renewal (a cloud provider, another server, a CDN). This guide explains what each slot does, how to enter keys safely and which scripts need an administrator's approval in the panel, then walks through four examples (Cloudflare, AWS, Tencent Cloud and SSH), and points to the separate SSL Script Development Guide for writing your own.

Cover of the SSL certificate and script automation video Video: certificates and script automation (scripts in the second half)YouTube · 7:35 · opens in a new tab
Who this is for

Anyone who can already request certificates in the panel and wants validation and deployment to happen by themselves, for example when the certificate is also used on AWS CloudFront, Tencent Cloud CDN or another server.

What you need
  • Certificates already work in your panel (if not, start with the free SSL certificate guide)
  • An account where the certificate goes: Cloudflare, AWS, Tencent Cloud, or SSH access to the other server
  • Scripts that deploy to another server need an administrator's approval: have an administrator account ready
What you will have
  • DNS validation done for you: no more adding records at renewal
  • After every issue and renewal, the new certificate shows up on the cloud service or the other server
  • Every run's result and failure reason in the panel

What the two script slots do

SlotWhen it runsWhat it is for
During issuance scriptWhile the certificate is being validatedAutomates validation. The typical case is adding the validation CNAME record through your DNS provider's API. With Auto Renew on, you no longer add a record by hand at every renewal.
Post-issuance scriptAfter every successful issue, renewals includedDeploys the new certificate: imports it into a cloud certificate service, writes it to another server and reloads the service, or makes a CDN switch to it. It runs again after each renewal, so the copy in the cloud or on the other server stays current.

Both slots are optional, and each takes one script. Once you pick a script, the parameters it needs appear below it. For the rest of the Add Certificate dialog (domain, validation method, storage paths, auto renew and so on), see Free certificates: request, validate and bind to a site.

Terms explained
Issuing script
Runs during validation and helps the CA validate, for example by adding a DNS record.
Post-issuance script
Runs after the certificate is issued and after every renewal, and sends the new certificate somewhere else.
API token / access key
A user name and password that a cloud service gives to programs. The script uses it to call the service's API (add a DNS record, upload a certificate).
  1. Open Add Certificate and find Automation Scripts

    In the left menu go to Domain Management → Certificate Management and click Add Certificate at the top right. At the bottom of the dialog, Automation Scripts has two dropdowns: During issuance script on the left and Post-issuance script on the right, both showing Select a script by default.

    The Automation Scripts area at the bottom of the Add Certificate dialog: a short description, then the During issuance script and Post-issuance script dropdowns on the left and right, both showing Select a script
  2. Pick a script and fill in its parameters

    After you pick a script, a one-line description and its parameters appear under the dropdown (required ones are marked with a red *). The screenshot shows the post-issuance script LNMP Nginx Reload, which needs no parameters and only shows its description.

    The post-issuance dropdown set to LNMP Nginx Reload, with the line 'Reload Nginx via lnmp to apply newly issued certificates' below it

Read this first: keys go into the panel (stored encrypted, shown masked); scripts that reach other machines need approval

Scripts run as root on the server where Nodekeeper runs, and any member with the permission can choose any script in shell/ssl on the certificate page. So two things need protecting: cloud account keys, and scripts that reach other machines or paths.

  • Cloud keys are typed straight into the certificate form. In the AWS ACM, Tencent Cloud and Baidu Cloud CDN (Secret Key) scripts the key inputs are password fields: not echoed, and the browser does not autofill them. The key is stored encrypted in Nodekeeper's database, shown afterwards only as ****** (the audit log masks it too), and handed to the script through an environment variable, never on the command line, so other users on the machine cannot see it. You do not create any credential file on the server.
  • Give the key least privilege. Use a dedicated sub-account: AWS gets only the permission to import certificates and Tencent Cloud only SSL certificate permissions (the examples below do exactly that); never use the root account's keys.
  • Scripts that reach other machines or paths need administrator approval. SSH deploy and FTP upload are examples: such a script declares "approval required" in its header, and every parameter set must be approved once by an administrator with the approval permission, in the panel, without logging in to the server. If the certificate, its owner, its domains, the script or any parameter changes, it needs approval again. Scripts that only call a cloud API (AWS, Tencent Cloud, Baidu Cloud, Cloudflare and so on) need no approval.
  • The run details are in the panel. In the certificate details, the Post-issue script section shows the approval state and the last run: time, result, exit code and the output (the last ~4 KiB, keys masked).

The approval flow for SSH deploy is in "Post-issuance script 3" below; how to write your own script and make it require approval is in the "SSL script development guide" at the end.

Terms explained
Least privilege
Give a key only the rights this job needs, such as importing certificates or editing one domain's DNS. If it leaks, the damage stays small.
Approval
An administrator checks the script and every parameter in the panel; the script only runs after Approve and run.
Masking
Replacing a secret with ****** before it is shown or recorded: in the panel, the audit log and the run output.
Environment variable
A name=value pair handed to a program that only the program itself sees, unlike command-line arguments, which other users on the machine can see.

Issuing script example: Cloudflare adds the DNS validation record

If your domain's DNS is hosted at Cloudflare, use the Cloudflare DNS validation script (shown as "Cloudflare DNS验证" in the panel). Nodekeeper adds the validation CNAME record to Cloudflare itself. The script first looks up the existing records with the same name and type in Cloudflare and deletes them, then adds the new validation record; on renewals it swaps the record the same way. After validation the record stays in Cloudflare and is not deleted automatically. This script supports DNS validation only. For other DNS providers, see "The other bundled scripts" below. For the rest of the Add Certificate dialog, see Free certificates: request, validate and bind to a site.

The token input of this script is an ordinary field (not a password field), so give the token below DNS edit rights on this one domain only, and don't use the global API key.

  1. Create an API token in Cloudflare

    Sign in to Cloudflare, open dash.cloudflare.com/profile/api-tokens, click Create Token, and use the Edit zone DNS template or set the permissions yourself:

    • Zone - DNS - Edit (lets it change DNS records);
    • Zone - Zone - Read (used to look up the Zone ID when you leave it blank);
    • under Zone Resources, pick only the domain you are issuing for.

    Copy the token after creating it. It is shown only once, so store it safely.

  2. Choose DNS validation and the Cloudflare script

    In Add Certificate, enter the domain and keep Free Certificate (API) selected at the top. Then, in the second Validation Method dropdown below it, choose DNS Validation (the dialog has two controls called Validation Method: the first is the certificate source, the second is the dropdown). Then in Automation Scripts, set During issuance script to Cloudflare DNS验证.

    Top part of the Add Certificate dialog: an example domain entered, the first Validation Method set to Free Certificate (API) and the second Validation Method dropdown set to DNS Validation
  3. Enter the token

    Two parameters appear under the script: Cloudflare API Token (required), where you paste the token, and Zone ID (leave blank to look it up automatically), which you can usually leave empty. Click Next Step.

    After Next Step the dialog shows the CNAME record this certificate needs. With the script selected you do not add it yourself: close the dialog, and the certificate is in the list with the status Pending.

    During issuance script set to Cloudflare DNS验证, with its description and two empty inputs: Cloudflare API Token (required) and Zone ID (leave blank to get it automatically)
  4. Click Validate and let the script add the record

    In the certificate list, click Validate on this certificate, and click Validate again in the confirmation dialog. Nodekeeper asks the certificate authority to continue validation, and the script adds the validation record to Cloudflare. Done by hand, it would be the CNAME in the screenshot, but you don't need to. When the status changes from Pending to Issued, you're done. In the AWS, Tencent Cloud and SSH examples below, this step is the same.

    Cloudflare's Add record dialog: type CNAME, a validation host name starting with an underscore, the target given by the certificate authority, proxy status DNS only. This is what you would enter by hand; the script does it for you

    With Auto Renew on, every renewal uses this script again: it first replaces the old record with the same name, then adds the new one and validates, with nothing for you to do.

Post-issuance script 1: import the certificate into AWS ACM (for CloudFront / ALB)

After every issue or renewal, the script imports the certificate into AWS Certificate Manager (ACM). The first time it creates the certificate; every later run re-imports into the same certificate, so the bindings on CloudFront or your load balancer stay as they are. There are four parts: create an IAM user that can only import certificates, get an access key, pick the script in the panel and enter the key there.

A few terms: ACM is AWS's certificate management service; IAM is AWS's service for users and permissions; an ARN is the unique ID AWS gives each resource, such as one certificate.

The AWS console screenshots are in Chinese. In the English console, look for the matching menu names.

  1. Create a user in IAM

    Sign in to the AWS console, open IAM, choose Users on the left, and click Create user at the top right.

    The AWS IAM users list, empty, with the Create user button at the top right (console shown in Chinese)
  2. Pick any user name and don't enable console access

    Use a name you will recognize, such as nk-acm-import. Leave unchecked "Provide user access to the AWS Management Console": this user is for a program and never needs to sign in to the console.

    Create user, step 1: the user name field says nk-acm-import and the option to provide console access is unchecked (console shown in Chinese)
  3. Don't pick permissions yet, create the user

    On Set permissions, choose Attach policies directly but select no policy at all, click Next, check the user name on the review page and click Create user. In the next step we add an inline policy that only allows importing certificates.

    Set permissions page: Attach policies directly is selected and no policy is chosen (console shown in Chinese)
    Review and create page: user name nk-acm-import, console password type None, and an empty permissions summary (console shown in Chinese)
  4. Add an inline policy that only allows importing certificates

    Open the user you just created, and on the Permissions tab click Add permissions → Create inline policy. Switch the editor to JSON and paste the policy below. Replace <account ID> with your own 12-digit AWS account ID, give the policy any name, and save it.

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "NodekeeperAcmImport",
          "Effect": "Allow",
          "Action": [
            "acm:ImportCertificate",
            "acm:DescribeCertificate"
          ],
          "Resource": "arn:aws:acm:*:<account ID>:certificate/*"
        }
      ]
    }

    It allows only importing and describing certificates, and only for ACM certificates in your own account.

    This lineWhat it does and why
    "Effect": "Allow"Allows the actions listed below and nothing else.
    "acm:ImportCertificate"Import (or re-import) a certificate: the only permission the script needs.
    "acm:DescribeCertificate"Read certificate details; the script uses it to read the import back. Optional: without it the import still works and the read-back is skipped.
    "Resource": "arn:aws:acm:*:<account ID>:certificate/*"Only ACM certificates in your own account; no other service. Replace <account ID> with your 12-digit account ID.
    The Permissions tab of the user: the permissions policies list with an Add permissions dropdown at the top right (console shown in Chinese)
    The inline policy JSON editor: it allows acm:ImportCertificate and acm:DescribeCertificate, with a resource that starts with arn:aws:acm, the account ID blurred, and ends in certificate/* (console shown in Chinese)
  5. Check that the policy is attached

    After saving, the user's permissions policies list has one policy of type customer inline. That means it worked.

    One row of the permissions policies list: the type is customer inline and the attached-via column says inline (the policy name column is not in the picture; console shown in Chinese)
  6. Create an access key

    On the user page open the Security credentials tab (or use Create access key under Access key 1 in the summary), choose the use case Application running outside AWS, and click Next. AWS shows a recommended-alternatives notice; it is a generic hint and doesn't stop you.

    First step of creating an access key: of the six use cases, Application running outside AWS is selected (console shown in Chinese)
  7. Add a description and create it

    The description tag is optional. Write what it is for so you can rotate it later, for example Nodekeeper ACM import. Click Create access key.

    Step 2 of creating an access key, Set description tag - optional: the page explains that the description is attached to the user as a tag (the input box and the Create access key button are not in the picture; console shown in Chinese)
  8. Save the access key (the secret is shown only once)

    The page says this is the only chance to view or download the secret access key. The Access key (access key ID) is the string that starts with AKIA; the Secret access key shows as stars until you click Show. You need both in the next step, so close this page only after you have entered them in the panel and saved the certificate.

    Retrieve access key page: a green banner says this is the only time you can view the secret access key; the access key is blurred and the secret shows as stars with a Show link beside it (console shown in Chinese)

    The keys are only for the panel form (a password field, stored encrypted). Don't send them to anyone or paste them into chats or tickets.

  9. Pick the script in the panel and enter the key

    In Add Certificate, enter the domain, choose a validation method, and in Automation Scripts set Post-issuance script to AWS ACM 证书导入 / AWS ACM Certificate Import. Fill in the parameters like this:

    • AWS Access Key ID: the access key you just saved (it starts with AKIA);
    • AWS Secret Access Key: the secret access key. This is a password field: not echoed, stored encrypted, and shown only as ****** after saving;
    • AWS Region: for CloudFront it must be us-east-1 (CloudFront only uses that region); for an ALB, use the region of the load balancer;
    • ACM certificate ARN: leave blank. The first run creates the certificate and remembers its ARN (as explained above, the ARN is the certificate's ID in AWS), and later runs import into that same one.

    This script only calls AWS's API and does not touch your servers, so it needs no administrator approval.

  10. Click Next Step, then Validate

    As in the Cloudflare example, click Next Step to submit, click Validate on this certificate in the list, and click Validate again in the confirmation dialog. When the certificate is issued its status becomes Issued, and the post-issuance script runs automatically.

    The confirmation dialog: it says the system will contact the CA right away to continue validation, with the domain and Cancel and Validate buttons (panel shown in Chinese)
    The certificate's status in the list is Issued (panel shown in Chinese)
  11. Check the result in ACM

    In the AWS console open Certificate Manager, switch the region at the top right to US East (N. Virginia) us-east-1, and the domain is in the certificate list: type Imported, key algorithm ECDSA P 256.

    The ACM certificate list: one issued certificate with the example domain as its name, type Imported, in use No, key algorithm ECDSA P 256 (console shown in Chinese)
    Certificate details: status Issued, type Imported; the 'can be used with' field lists CloudFront and Elastic Load Balancing, and there is a Re-import button at the top right (console shown in Chinese)
  12. Bind it in CloudFront or the ALB, once

    The import only puts the certificate into ACM. The first time, select this certificate yourself in your CloudFront distribution or ALB listener; once is enough. After that, every renewal re-imports into the same ARN, the binding stays as it is, and you don't touch it again.

    ACM shows 'In use: No' only because nothing is bound to it yet.

Post-issuance script 2: upload to Tencent Cloud SSL

After every issue or renewal, the script uploads the certificate to Tencent Cloud's SSL Certificates service, into My Certificates. Uploading the same certificate again returns the existing certificate ID, so no duplicates appear. It can also swap the old certificate on cloud resources such as a CDN for the new one (see the end of this section).

A term: CAM (Cloud Access Management) is Tencent Cloud's service for users and permissions; below you use it to create a dedicated sub-user.

The Tencent Cloud console screenshots are in Chinese. International-site accounts follow the same steps; look for the matching menu names.

  1. Create a sub-user in Access Management (CAM)

    Sign in to the Tencent Cloud console, go to Access Management → Users → User List and click New User. Don't use the root account's keys: create a dedicated sub-user.

    The Tencent Cloud Access Management user list with the blue New User button at the top left and one root account row and one sub-user row (account details blurred; console shown in Chinese)
  2. Choose Custom Creation

    On the New User page click Custom Creation.

    The New User page with three buttons: Quick Creation, Custom Creation and WeChat / WeCom import (console shown in Chinese)
  3. Pick the type that can access resources

    In step 1, Select type, choose Accessible resources and message receiving and click Next.

    New sub-user step 1, Select type: 'Accessible resources and message receiving' is selected; the other option is 'Message receiving only' (console shown in Chinese)
  4. Any user name, and tick only Programmatic access

    Use a name you will recognize, such as nk-ssl-upload. Under access method tick only Programmatic access (it generates a SecretId and SecretKey), and leave Tencent Cloud console access unticked. Click Next. Tencent Cloud asks you to pass a captcha when creating the user.

    Fill in user information: user name nk-ssl-upload with a remark, access method Programmatic access ticked and console access unticked (console shown in Chinese)
  5. Select only the SSL permission, and be careful not to over-select

    In Set user permissions, search for and tick only QcloudSSLFullAccess (full read-write access to SSL certificates). If you also want the script to swap the certificate on your CDN, add QcloudCDNFullAccess. Nothing else.

    Before saving, check the Selected list on the right once more. The list contains high-risk policies such as AdministratorAccess, QCloudResourceFullAccess and QCloudFinanceFullAccess. Selecting a whole page by accident, or clicking the wrong row, hands out rights that have nothing to do with certificates, such as finance or administrator access.

    Set user permissions: the policy list on the left includes AdministratorAccess, QCloudResourceFullAccess and QCloudFinanceFullAccess, all marked high risk, and ReadOnlyAccess in between; the Selected list on the right is empty. The hint says to follow the least-privilege principle (console shown in Chinese)
  6. Finish creating and save the SecretId and SecretKey

    You can skip the tag step; confirm on the review page and create the user. The success page shows the SecretId and SecretKey, and the SecretKey is shown only once, so copy it, ready for the panel form in the next step. Afterwards, the user's API Keys tab shows only the SecretId and you can't get the SecretKey back (if you lose it, create a new key). The screenshot shows that API Keys tab when you come back to it later: only the SecretId is there.

    The API Keys tab of the sub-user: the key list has only the SecretId (blurred), creation time and status, and no SecretKey (console shown in Chinese)

    Put the SecretKey only into the SecretKey password field in the panel (stored encrypted, shown afterwards as ******). Never paste it into chats, tickets or notes. Close the success page once you have entered it and saved the certificate.

  7. Double-check the permissions

    On the sub-user's Permissions tab, check that the policies list has only the one or two policies you chose.

    The sub-user's policies list: only QcloudCDNFullAccess and QcloudSSLFullAccess, both preset policies attached directly (console shown in Chinese)
  8. Pick the script in the panel and enter the SecretId and SecretKey

    In Add Certificate → Automation Scripts, set Post-issuance script to 腾讯云 SSL 证书上传与云资源更新 / Tencent Cloud SSL upload & resource update. To only upload the certificate, fill in SecretId and SecretKey (the SecretKey is a password field, stored encrypted and shown only as ****** after saving) and leave every other parameter empty, including the resource types.

    This script only calls Tencent Cloud's API and does not touch your servers, so it needs no administrator approval.

  9. Submit and validate

    As before, click Next Step, then Validate in the list and confirm. When the status becomes Issued, the script runs automatically.

    The certificate's status in the list is Issued (panel shown in Chinese)
  10. See the result in My Certificates

    Open SSL Certificates → My Certificates in Tencent Cloud and you will see a new certificate: remark nk-<domain>-<date>, source Uploaded certificate, status Issued. When it uploads again after a renewal, the same certificate doesn't show up twice.

    The first row of Tencent Cloud's My Certificates list: certificate ID, a remark starting with nk- plus the domain and date, source Uploaded certificate, the bound domain and expiry, status Issued (console shown in Chinese)
  11. Optional: swap the old certificate on cloud resources automatically

    If the certificate is already bound to Tencent Cloud resources such as CDN, EdgeOne, CLB, WAF or live streaming, the script can replace it after each renewal. The parameters (all in the same script's form):

    ParameterHow to fill it
    Resource types to updateComma separated, from cdn,teo,clb,waf,live. Upload only means this and the first-deployment CDN domains are both empty. If you fill in only CDN domains, the certificate is deployed to the CDN too.
    CDN domains for the first deploymentUsed only the first time; the domains must be covered by this certificate. After that, the automatic swap takes over.
    RegionsNeeded for regional resources such as CLB and WAF, for example ap-guangzhou,ap-shanghai.
    Old certificate IDOptional. The ID, from My Certificates, of the certificate your resources use now; the next run moves the resources bound to it onto the new certificate. Each value is used once. It works only together with the resource types field.
    API endpointFor international-site accounts use ssl.intl.tencentcloudapi.com; the default is the China-site address.

    If you fill in resource types but there is no old certificate on record and no CDN domain, the first run logs one error asking you to bind the certificate once in the console. After that, every renewal swaps it automatically.

    We have not demonstrated the resource swap on a real CDN (mainland China CDN requires a filed domain). The table above is based on the script's own documentation, so try it on an unimportant resource first.

Post-issuance script 3: deploy the certificate to another server over SSH

After every issue or renewal, the script writes the certificate and private key to another server over SSH (or, if you enter local, to a folder on this machine, for example one mounted into a container), then runs the reload command you entered. The reload command is up to you; the script never restarts anything by itself.

Because it can use root's SSH private key on this server to log in to other machines, it has one more safeguard, administrator approval: every parameter set must be checked and approved once by an administrator in the panel before the script runs, with no server login. A certificate created by an administrator is approved automatically.

  1. Prepare the SSH login

    If the SSH target is local (write to this machine), skip this whole step.

    Otherwise, on the Nodekeeper server generate an SSH key just for this deployment; don't reuse the key root uses to log in to other machines. The script runs unattended and can't type a passphrase, so leave the passphrase empty. The private key must be owned by root with mode 600. Put the public key in a low-privilege account on the target server: it only needs to be able to write the two certificate files and run your reload command, and it should not be root on the target. Its login shell must be sh, bash, dash, zsh or similar (csh/tcsh are not supported). The commands (replace user@host with the target account):

    ssh-keygen -t ed25519 -f /root/.ssh/nk_deploy_ed25519 -N ''
    ssh-copy-id -i /root/.ssh/nk_deploy_ed25519.pub user@host
  2. Pick the script in the panel and fill in the parameters

    Set Post-issuance script to SSH 部署证书到其它服务器 / Deploy certificate over SSH. The parameters:

    ParameterWhat it is
    SSH target (required)user@host[:port]; for IPv6 write user@[addr]:port; enter local to write to this machine.
    SSH private key pathThe key file on this machine; the default is /root/.ssh/id_ed25519. Better to enter the dedicated key from the previous step, /root/.ssh/nk_deploy_ed25519.
    Certificate path on the target (required)An absolute path on the target; the full chain (fullchain) is written there.
    Private key path on the target (required)An absolute path on the target.
    Reload commandRun on the target after writing; optional. Example: nginx -t && systemctl reload nginx.
    Leaf-only path / intermediate-chain-only pathOptional. Fill them only if the service wants the site certificate and the intermediates stored separately.
    known_hosts fileOptional. Left blank, the target's host key is recorded and trusted on first contact, and a later change is refused. The risk is in that first contact: if the machine you reach at that moment is an impostor, it receives the certificate and private key. So it is better to check the target's fingerprint yourself, make a known_hosts file, and enter its path here, so the check is strict every time.
    allow_untrusted (the last one)Default false. The script requires the certificate to validate against the system root certificates on this machine (so nobody can swap in a self-signed certificate); set it to true only for a self-signed or private-CA certificate. It is part of the approved parameters, so changing it needs a new approval.
    The SSH deploy script's parameters (demo with local): SSH target set to local, the default key path, certificate and key paths in an example folder, a reload command that just lists that folder with ls -l, and the optional fields empty
  3. After saving, the script waits for approval

    Click Next Step, then Validate. Once the certificate is issued, this script does not run right away: it declares "approval required", so an administrator must first approve the parameter set you entered, in the panel. You will see:

    • in the certificate list, a yellow Awaiting approval badge under the expiry time;
    • in the certificate details (click View), the Post-issue script section says Awaiting administrator approval, and the last run reads Awaiting approval (not run).

    If an administrator created this certificate, it is approved automatically when saved (the details show that administrator as the approver, with "approved by the certificate owner") and you can skip the next step.

    The Post-issue script section of the certificate details: a yellow Awaiting administrator approval badge with the note that the script does not run before approval; Approve..., Run now and Refresh run record buttons at the top right

    The certificate itself was issued successfully; only the deployment script is waiting, so the certificate status stays Issued. Ordinary members also see Awaiting administrator approval, without the approve button; ask an administrator to approve.

  4. The administrator approves it in the panel

    An administrator with the approval permission (by default only the administrator group) opens the certificate details and clicks Approve... in the Post-issue script section. The dialog lists the whole set being approved: the script, the owner, the domains, every parameter (secret parameters shown as ******; a private key path is not a secret and is shown, so you can check which key is used) and a fingerprint. Check each item:

    • the SSH target, the key path and the two target paths are what you want;
    • the reload command is one you recognize: it will run on the target;
    • the last item, allow_untrusted, is false, unless this really is a self-signed or private-CA certificate.

    If everything is right, click Approve and run. If the certificate is already issued and the script has not succeeded yet, it starts in the background at once. What you approve is exactly what you saw: if anything changed after you opened the dialog, the approval is refused and the new set is shown, so review it again.

    • Any change needs a new approval: the certificate, its owner, its domains, the script or any parameter. The state becomes "Changed since approval - needs approval again" and the script does not run until it is approved again.
    • An administrator can click Revoke approval at any time; the script then stops running until approved again. Approving and revoking use a normal confirmation dialog and are written to the audit log.
    The approval dialog: a notice that the whole set is being approved, then the script, the owner (redacted), the domains and every parameter, with the key path /root/.ssh/id_ed25519 shown in plain text; Approve and run at the bottom right
  5. Read the run details, then check the target

    If the certificate is already issued and the script has not succeeded yet, approving starts it at once in the background; if it already ran, click Run now to run it again. If it fails it is retried every minute (see "Retries and where to see results" below). The Last run part of the certificate details shows the run time, the result (Succeeded / Failed / Timed out), the exit code and the end of the output, so you can read the reason without logging in to the server; Copy output copies it, and Refresh run record reloads the latest result. To run it again right away, click Run now (certificate owner and administrators; at most once per 30 seconds per certificate).

    Then look at the files on the target: the certificate and the key are updated, and a newly created key file is mode 600.

    How it writes: first to hidden temporary files in the same folder, then everything is renamed into place; the file being replaced is kept once as .bak (only the previous version); a file whose content did not change is left alone; existing files keep their owner and permissions. Don't make the target folder writable by other users.

    The certificate details after approval: status Approved with the approver and time; Last run shows the run time, result Succeeded, exit code 0 and the end of the script output (writing, checksums, reload command, done)
  6. How to fill the parameters for common setups

    The table shows typical setups. They are examples to adapt to the real paths and services on your machine; try them on an unimportant service first. We have not tested these on real Signal-TLS-Proxy and fnOS systems; for the other rows too, confirm the paths and commands on your machine before you rely on them.

    SetupCertificate / key pathsReload command
    Another Nginx serverThe two files that ssl_certificate and ssl_certificate_key point to in the Nginx confignginx -t && systemctl reload nginx
    Another Apache serverThe two files that SSLCertificateFile and SSLCertificateKeyFile point toDepends on your system, for example apachectl configtest && systemctl reload apache2
    Proxmox VEThe certificate files the PVE web interface uses; confirm the real paths on the machine first. The usual ones are /etc/pve/local/pveproxy-ssl.pem and /etc/pve/local/pveproxy-ssl.keysystemctl restart pveproxy
    Signal-TLS-ProxyThe two files the proxy actually reads its certificate and key fromWhatever reloads or restarts the proxy in your setup
    fnOSWhere the system certificate lives is not an official interface and can change between versions, so confirm the real paths on the machine firstWhatever makes that system re-read the certificate
    A containerSet the SSH target to local and use two files in the folder that is mounted into the containerYour own command to reload or restart that container (or leave it empty)

The other bundled scripts

All of these can be chosen in Add Certificate. The Slot column says which dropdown to use. Script names are given here exactly as the dropdown shows them.

ScriptSlotWhat it doesWhat to prepare
Cloudflare DNS验证During issuanceAdds the DNS validation record (the example above)A Cloudflare API token
DNSPod DNS验证During issuanceAdds the validation record through the DNSPod (Tencent Cloud DNS) APIA DNSPod API ID and Token (created on the key page at console.dnspod.cn)
Namecheap DNS验证During issuanceAdds the validation record through Namecheap's DNS API. Namecheap replaces the whole record set on every submit, so the script reads the existing records first and submits them together with the new oneTurn on API Access at Namecheap and add this server's public IP to the Namecheap whitelist. All three panel fields are required: the account user name (Namecheap账户用户名), the API key (Namecheap API密钥) and the whitelisted public IP (API白名单IP地址)
PowerDNS MySQL DNS验证During issuanceAdds the validation record through an API in front of your own PowerDNS (MySQL backend)Deploy pdns_api.php on a web server, set its MySQL connection and a strong API key, then enter the API URL and key in the panel
Nginx HTTP验证During issuanceHTTP / HTTPS validation only: finds the server block for the right port in the Nginx config, temporarily adds the validation location, and reloads NginxFill in the Service config path (the Nginx config file) when adding the certificate
Nginx配置清理Post-issuanceThe partner of the one above: after issuance it removes the validation location, cleans backup files and reloads NginxThe Nginx config file path
LNMP Nginx ReloadPost-issuanceRuns lnmp nginx reload so Nginx picks up the new certificateThe lnmp command must exist on the server; without it the script fails and exits
百度云CDN证书更新 (Baidu Cloud CDN certificate update)Post-issuanceUploads the certificate to Baidu AI Cloud's certificate service and switches the given CDN domains to it. Leave the CDN domains blank to use the certificate's own domains; separate several with commasA Baidu AI Cloud Access Key / Secret Key, from an account with CDN permission (preferably a least-privilege sub-account)
AWS ACM 证书导入 / AWS ACM Certificate Import
腾讯云 SSL 证书上传与云资源更新 / Tencent Cloud SSL upload & resource update
SSH 部署证书到其它服务器 / Deploy certificate over SSH
Post-issuanceThe three detailed examples in this guideSee above

For the DNSPod, Namecheap and PowerDNS scripts, the keys are entered in the panel parameters and handed to the script as command-line arguments (ordinary inputs), so use an account with least privilege for them. The Baidu Cloud CDN Secret Key is a password field like the AWS and Tencent Cloud ones: it goes through the environment, never on the command line; only its Access Key ID is a command-line argument.

Retries and where to see results

Failures are retried by themselves. If a post-issuance script fails (say the cloud account lacks a permission, or the network is down), Nodekeeper runs it again at the next minute's check, until it succeeds. (For the Tencent Cloud script, an error that will not fix itself, such as missing permission or rejected parameters, is retried with a growing delay, up to 1 hour, and Tencent Cloud is not called again in between; changing the parameters or the certificate retries at once.) A script that needs approval and takes longer than 15 minutes is terminated and recorded as Timed out (older scripts without the approval line have no such limit). A script that needs approval does not run at all before it is approved. In our testing AWS failed once because the import permission was missing; after the policy was fixed we did nothing else and the script succeeded on its own.

Where to look.

  • In the panel (first choice): click View to open the certificate details and look at the Post-issue script section. Last run has the time, the result (Succeeded / Failed / Timed out / Awaiting approval), the exit code and the last ~4 KiB of the output (keys masked); the certificate owner and administrators can see it, and there are Copy output and Refresh run record buttons. In the certificate list, a certificate whose script failed has a red Script failed badge under the expiry time, and one waiting for approval has a yellow Awaiting approval badge.
  • Log: the log under logs/ in the Nodekeeper install directory has more complete records.
  • Success: check the target itself, for example whether the certificate is in ACM or in Tencent Cloud's My Certificates, or whether the certificate files on the target server are updated.

Something wrong? Check this table

What you seeWhyWhat to do
A red Script failed badge under the certificate in the listThe post-issuance script's last run failed.Click View and read the end of the output in Last run under Post-issue script; fix the cause. The script retries every minute, so nothing else is needed once it is fixed.
The AWS script fails and the output says permission is missingThe IAM user lacks the import permission.Add the inline policy as in the AWS section above; the script succeeds by itself on the next retry.
The Tencent Cloud script waits a long time before retryingFor errors that won't fix themselves (missing permission, rejected parameter) the retry interval grows, up to 1 hour.It retries at once after you fix the permission or parameters.
A yellow Awaiting approval badge and the script never runsThe script needs an administrator's approval and does not run before it.Ask an administrator to open the details and click Approve...
The result is Timed outA script that needs approval ran for more than 15 minutes and was stopped.See where the output stops; check the target server's network and the reload command.

Write your own: SSL script development guide

Need to send certificates somewhere the bundled scripts don't cover (FTP upload, an SMB share, your own release tool), or validate with a DNS provider the panel doesn't support? See the SSL Script Development Guide: where scripts live, the header, the arguments a script receives, passing keys safely, exit codes and retries, which scripts need approval, and complete examples for a post-issuance script (FTPS upload) and an issuing script (DNS validation).

Frequently asked questions

Do certificates renew automatically without scripts?
Yes. Certificates with HTTP validation, or with Built-in DNS validation on, renew by themselves. Scripts solve two other problems: adding DNS records when your DNS is at Cloudflare or similar, and sending the certificate elsewhere.
Can other people see the keys I enter?
The AWS, Tencent Cloud and Baidu Cloud CDN secret keys are password fields: stored encrypted, shown as ****** in the panel and the audit log, and passed to the script through the environment. DNSPod, Namecheap and PowerDNS keys are ordinary fields passed as command-line arguments; give them least-privilege accounts.
Why does SSH deploy need approval and AWS not?
SSH deploy logs in to another machine and runs commands from its parameters; the script runs as root, so without approval whoever fills the parameters would control it. AWS and Tencent Cloud scripts only call cloud APIs with the key you enter and can't touch your machines.
If a post-issuance script fails, can I still use the certificate?
Yes. The certificate in Nodekeeper is issued and in use; the script retries every minute, and until it succeeds the target (cloud service, other server) keeps the old certificate.
Can one certificate be deployed to several places?
Each certificate has one post-issuance script. To deploy to several places, write a script that does all the steps; see the SSL Script Development Guide.
Can I add a script to an existing certificate?
The script is chosen in Add Certificate; an existing certificate cannot be changed. Add another certificate for the domain with the script selected.