GoAdmio Command Line: sslsync with /go/sslsync

/go/sslsync copies the SSL certificates of this server to another server, so that the other server can serve the same domains over HTTPS right away, for example when you move sites to a new server. It: It copies everything in /etc/letsencrypt, not only the certificates of one account. That includes the private keys. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

/go/sslsync 203.0.113.20 'RemoteRootPassword'

Put the password in single quotes, so special characters such as $ are passed unchanged.

Options

This command has no options. It takes three positional arguments.

Argument Required Default Notes
<remote-server> Yes — IP address or hostname of the destination server.
<root-password> Yes — The root password of the destination server.
[port] No 22 The SSH port of the destination server.

Nothing checks the arguments. If one is missing, the copy fails with an SSH or rsync error.

The destination server needs rsync, and it must allow root to log in over SSH with a password. See permitrootlogin. This server needs sshpass and rsync.

Examples

# Copy the certificates to a server on the default SSH port
/go/sslsync 203.0.113.20 'RemoteRootPassword'

# The destination server uses SSH port 2222
/go/sslsync 203.0.113.20 'RemoteRootPassword' 2222

# Afterwards, check what arrived on the destination server (run it there)
ls /etc/letsencrypt/live

Output

The command prints Copying SSL to <remote-server>..., followed by the progress of rsync (the file list and a progress line for each file). There is no success message.

[!NOTE]
The command always ends with exit status 0, and it always writes the marker file, even when the copy fails (for example because of a wrong password). In scripts, read the output and check the destination.

Every run is also recorded in /var/log/go/sslsync.log, including the password (see Security).

Security

[!WARNING]

  • The password is logged. The command writes all of its arguments to /var/log/go/sslsync.log, so the remote root password is stored there in plain text. It is also visible in your shell history and, while the command runs, in the process list. After use, remove the password from the log (edit or delete /var/log/go/sslsync.log), clear it from your shell history, and change the remote root password when the migration is finished.
  • The remote server is not verified. The connection turns off host key checking, so it accepts any server that answers at the address. If the address is wrong or the connection is intercepted, your private keys go to the wrong place. Check the address carefully, and run it only over a network you trust.
  • Private keys are copied. /etc/letsencrypt contains the private keys of all certificates and the keys of your Let’s Encrypt account. Treat the destination server as fully trusted.

See the full reference at /go/sslsync 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 *