Launcher Products Bitnami Documentationimaxe CLI Blog Contact
imaxe tls certificates v1.0.0

HTTPS certificates, painlessly

Issue and renew free Let's Encrypt certificates for your server and reload them without interrupting service. One command gets it going; from then on it renews itself.

$ imaxe tls issue app.ejemplo.com --email [email protected]
Version
v1.0.0
Subcommands
6
Config
/etc/imaxe/tls.yml
Requires root
yes
Renewal
auto · timer

What this module does #

A TLS certificate is what turns http:// into https://: it encrypts the connection between your visitors and the server, and makes the browser show the padlock instead of a "not secure" warning.

The tls module handles the entire lifecycle of that certificate using certbot: it requests it from Let's Encrypt (a free, well-recognized authority), proves the domain is yours through the ACME challenge, installs the certificate where your web server expects it, and renews it automatically before it expires — without you having to remember.

Before you start

Your domain (e.g. app.ejemplo.com) must point via DNS to this server's IP, and port 80 must be reachable for the HTTP-01 challenge. Otherwise, issuance will fail at the validation step.

Quick startstep-by-step tasks

Common tasks #

Pick what you want to do. Each recipe comes with the command already written — just swap in your own domain and email, and hit Copy.

1

Issue my first certificate

Get the HTTPS padlock for your domain in a minute.

Connect to your server over SSH as the ubuntu user.

Run the command, swapping in your own domain and email (the email is only used to warn you if something is about to expire):

terminal
$ sudo imaxe tls issue app.ejemplo.com --email [email protected]

Wait a few seconds. You'll see the challenge progress and, at the end, the expiry date.

Your site now loads over https:// with the padlock. Automatic renewal is enabled — you don't have to do anything else.
2

See which ones exist and when they expire

Check the state of your certificates at a glance.

A quick summary of the overall status and the renewal timer:

terminal
$ sudo imaxe tls status

Want the detail domain by domain, with days remaining and the fullchain path? Use list:

terminal
$ sudo imaxe tls list
If you see any domain with few days left, jump to the Force a renewal recipe.
3

Force a renewal

It's usually automatic, but you can bring it forward if you need to.

Renew all certificates close to expiring (this is exactly what the timer does):

terminal
$ sudo imaxe tls renew

Want to rehearse it first without touching disk, or renew even if days remain? Add --dry-run or --force:

terminal
$ sudo imaxe tls renew --dry-run
$ sudo imaxe tls renew --force
The web server reloads itself with the new certificate. Your visitors notice no interruption.
4

Revoke a certificate

Invalidate a certificate at the authority (e.g. if the key leaked).

Revoke a domain's certificate at Let's Encrypt, giving the reason if you know it:

terminal
$ sudo imaxe tls revoke app.ejemplo.com --reason keycompromise
The certificate is no longer valid, immediately. If the domain is still in use, issue a new one with issue.
5

Delete a certificate from disk

Stop managing a domain you no longer use.

Remove the certificate and its keys from disk. Note: this does not revoke it at the authority — for that, use revoke first.

terminal
$ sudo imaxe tls delete tienda.ejemplo.com
The domain disappears from imaxe tls list and its automatic renewal stops.
Something didn't work?

The most common issue is that DNS hasn't propagated yet or port 80 is closed. Wait a few minutes and retry. If it persists, try the test mode first with --staging (see the reference) so you don't burn through your attempt quota.

CLI referencecommands, flags and files

Synopsis #

usage
imaxe tls <subcomando> [<dominio>...] [--email CORREO] [flags]

Subcommands that touch certificates require root privileges (use sudo) because they write to /etc/imaxe/ and reload system services. Add --json to list or status for machine-readable output suitable for scripting.

Subcommands #

SubcommandWhat it doesRelevant flags
issueIssues a certificate for one or more domains, resolving the ACME challenge.--email, --webroot, --standalone, --staging
renewRenews certificates close to expiring and reloads the web server. Suitable for a timer.--dry-run, --force
listLists the managed certificates with days to expiry and the fullchain path.--json
statusSummary: number of certificates, those close to expiring, and the renewal timer status.--json
revokeRevokes a certificate by domain at the authority (ACME).--reason
deleteDeletes the certificate and its keys from disk. Does not revoke at ACME.

Arguments and flags #

FlagTypeDefaultDescription
<dominio> req.string…One or more domains for the certificate. In issue, the first is the primary (CN); the rest are SANs. In revoke/delete, the domain to operate on.
--emailstringtls.ymlContact email for the ACME account. Required on the first issue; afterwards the one in tls.yml is reused.
--webrootpath/var/www/htmlRoot directory for the HTTP-01 challenge. The default method.
--standaloneboolfalseUses certbot's built-in server instead of a webroot. Requires port 80 to be free.
--stagingboolfalseUses the Let's Encrypt test environment (doesn't count toward the rate limit). The certificate won't be trusted.
--dry-runboolfalseIn renew, simulates the renewal without touching disk.
--forceboolfalseIn renew, renews even if it's not close to expiring.
--reasonenumunspecifiedIn revoke: unspecified, keycompromise, superseded, cessationofoperation.
--jsonboolfalseIn list/status, emits the result as JSON on stdout.

Files and paths #

PathContents
/etc/imaxe/tls.ymlModule configuration: default email, method (webroot/standalone), webroot, staging, auto-renewal and reload hook.
/etc/letsencrypt/live/<dominio>/Certificate (fullchain.pem) and private key (privkey.pem) managed by certbot.
/var/log/imaxe/tls.logStructured log of every issuance, renewal and revocation.
imaxe-tls.timersystemd timer that triggers renew periodically.

Example tls.yml:

/etc/imaxe/tls.yml
email: [email protected]
default_method: webroot
webroot: /var/www/html
staging: false
auto_renew: true
reload_hook: systemctl reload nginx

Exit codes and logs #

Each run returns a code you can check with echo $? — handy for chaining in scripts:

0OKOperation completed with no pending changes.
1ERRGeneric unclassified error. Check the log.
2USAGEInvalid or missing arguments.
3CHALLENGEACME validation failed (DNS/HTTP).
4RATELIMITLet's Encrypt limit reached.
5RELOADIssuance OK but the web server reload failed.

Follow the log live while debugging:

terminal
$ sudo journalctl -u imaxe-tls -f
$ sudo tail -f /var/log/imaxe/tls.log

Advanced examples #

Several domains in a single certificate

The first domain is the primary; the following ones are added as SANs, all in a single certificate:

terminal
$ sudo imaxe tls issue ejemplo.com www.ejemplo.com \
    --email [email protected]

A safe test before production

Validate the whole chain against the test environment so you don't burn through your real quota. With --standalone you don't need a configured web server:

terminal
$ sudo imaxe tls issue app.ejemplo.com \
    --email [email protected] --standalone --staging \
  || echo "falló con código $?"

Troubleshooting #

SymptomLikely causeFix
Returns CHALLENGE (code 3)The domain doesn't resolve to this host or port 80 is closed.Verify the A/AAAA record and open port 80 in the security group; retry.
Returns RATELIMIT (code 4)Too many issuances of the same domain in one week.Use --staging to test; wait for the window to free up.
HTTPS loads but with a warningIssued with --staging: the certificate isn't trusted.Reissue without --staging to get a valid one.
Returns RELOAD (code 5)The reload_hook points to a nonexistent service.Adjust reload_hook in tls.yml and run renew again.

Stuck with the TLS module?

Write to us with the output of «imaxe <module> status --json» and we'll get back to you fast.

Contact support