/go/ssl: ssl from the Command Line

/go/ssl gets a free HTTPS certificate from Let's Encrypt for a hosted site using certbot, then rebuilds the site's web server configuration so the certificate is used. Other GoAdmio commands call it for you: create schedules it for each new account, and renew runs it every time. It works in four modes: Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Issue or re-issue the certificate for one domain
/go/ssl example.com

# Issue certificates for every domain that has none
/go/ssl all

Options

Option Applies to Effect
--www One domain, all Names: the domain and www. only.
--limit One domain Same as --www. Used by bulk.
--go One domain, all Names: the domain, www., and go..
--webmail One domain, all Names: the domain, www., and webmail..
--force all Also processes domains that already have a certificate.
--create ssl all When a domain fails, creates the file /home/<domain>/www/ssl, so later all runs skip it.
--zerossl One domain, all Uses ZeroSSL’s ACME server instead of Let’s Encrypt.
--standalone or --quick One domain, all Uses certbot’s own temporary web server, which needs port 80 to be free.
--skipbackupssl Any Skips the daily SSL backup at the end.
--progress One domain Also prints 100 on success and 1 on a failure, for GoAdmio’s progress display.

If more than one of --www, --go, and --webmail is given, --www wins, then --go.

Which names are in the certificate

Situation Names
Main domain, no name option The domain, www., go., webmail., smtp., imap.
--www or --limit The domain and www.
--go The domain, www., go.
--webmail The domain, www., webmail.
A subdomain The subdomain only
Alias domains of the account <alias> and www.<alias>, only if their DNS points to this server

A name counts as a main domain when it has one dot, or when it is a known two-part domain such as example.co.uk, or when it has its own zone in your Cloudflare account. Anything else is treated as a subdomain.

Examples

# One domain
/go/ssl example.com

# One domain, only the domain and www
/go/ssl example.com --www

# Every domain without a certificate, and mark the ones that fail so they're skipped next time
/go/ssl all --create ssl

# Re-issue every certificate, without the daily backup
/go/ssl all --force --skipbackupssl

# Let a skipped domain be tried again
rm -f /home/example.com/www/ssl
/go/ssl example.com

# Check what certbot has
certbot certificates -d example.com

# Stop a stuck certificate request
/go/ssl stop

Output

Outcome What you get
Success (one domain) SSL Certificate Installed Successfully (<domain> - <N> Months)...
Success (all) [<n>/<total>] SSL Certificate Installed Successfully (<domain> - <N> Months)
Fewer names than usual NOTICE: This certificate will NOT cover (webmail, go, smtp, imap) or NOTICE: This certificate will ONLY cover (webmail.<domain>)
Failure Error: Can not Install SSL Certificate (<domain>)... followed by DNS hints
DNS hint Domain <name> Points To <ip> (Expected <server ip>), or Domain <name> Does Not Resolve
Missing Cloudflare record CNAME Record <name> does not exist, for www, webmail, go, smtp, and imap
Paid certificate present Paid SSL Certificate already installed. and how to delete it with openssl
all skips a domain SKIPPING: SSL certificate installation for <domain> and how to remove the ssl file
Not a hosted domain Domain <name> does not exist...
Daily backup Backup SSL...

Notes on the output:

  • certbot is run quietly, so Let’s Encrypt’s own error is not shown. The DNS hints are the command’s guess. The real reason is in /var/log/letsencrypt/letsencrypt.log.
  • With all, domains that already have a certificate are skipped without any message.
  • With --progress, the numbers 100 and 1 are printed after the messages.
  • Exit status is 0, except bulk, stop, and the paid-certificate case, which exit with status 1.
  • Every run is logged with a timestamp and its arguments to /var/log/go/ssl.log.

See the full reference at /go/ssl and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *