How-to guide
Install the Sovrain binary
Install the static Linux binary with its systemd unit on any distribution, write /etc/sovrain/sovrain.env and run Sovrain behind your own reverse proxy.
This guide installs the Linux binary of a release with its systemd unit. The binary is static, so it runs on any distribution and version. Your own reverse proxy answers HTTPS and passes the requests on to Sovrain. On Debian, Ubuntu, RHEL and their relatives, the package does the same steps for you.
Before you start
You need:
- Linux on x86_64 or aarch64 with systemd;
- a reverse proxy on the same server that serves HTTPS with certificates for the two names below;
- a domain where you can add DNS records;
- a mail account that sends over SMTP on port 465 with TLS; see Configure outgoing mail.
Install the binary
Download the archive and the checksums, check the archive, unpack it and install the binary and its unit. On x86_64:
curl -fsSLO https://releases.sovrain.app/download/1.0.0-rc.1/sovrain-linux-x86_64.tar.gz
curl -fsSLO https://releases.sovrain.app/download/1.0.0-rc.1/SHA256SUMS
sha256sum --ignore-missing -c SHA256SUMS
tar -xzf sovrain-linux-x86_64.tar.gz
sudo install -m 755 sovrain /usr/local/bin/sovrain
sudo install -m 644 sovrain.service /etc/systemd/system/sovrain.service
On ARM, use sovrain-linux-aarch64.tar.gz. The archive holds two files: the binary sovrain and its systemd unit
sovrain.service, which runs /usr/local/bin/sovrain as the user sovrain, reads /etc/sovrain/sovrain.env,
listens on 127.0.0.1:8080 and may write only to /var/lib/sovrain.
Point DNS at the server
Sovrain needs two names: the sign-up address and the address of your organization, one level below it. Choose the
organization’s short name now, here acme, and add two A records that point at the server:
auth.example.com A 203.0.113.10
acme.auth.example.com A 203.0.113.10
Create the user and the configuration
Create the system user sovrain with its data directory /var/lib/sovrain, and write the configuration file with a
new master key. Replace the address and the mail values with your own:
sudo useradd --system --home /var/lib/sovrain --create-home sovrain
sudo mkdir -p /etc/sovrain
sudo tee /etc/sovrain/sovrain.env >/dev/null <<EOF
SPRING_PROFILES_ACTIVE=selfhost
IDP_DATABASE_DIRECTORY=/var/lib/sovrain
IDP_BASE_URL=https://auth.example.com
IDP_MEK=$(openssl rand -base64 32)
IDP_CSRF_SECRET=$(openssl rand -base64 32)
IDP_SMTP_HOST=smtp.example.com
IDP_SMTP_USERNAME=sovrain@example.com
IDP_SMTP_PASSWORD=change-me
EOF
sudo chmod 600 /etc/sovrain/sovrain.env
Run this once. Running it again replaces IDP_MEK, and Sovrain can no longer read the data it has stored.
Start the service
sudo systemctl daemon-reload
sudo systemctl enable --now sovrain
journalctl -u sovrain -f
Within a few seconds the log contains idp listening on 127.0.0.1:8080, data in /var/lib/sovrain.
Put your reverse proxy in front
Configure your proxy to serve HTTPS on both names and pass every request to http://127.0.0.1:8080, with the original
Host header and X-Forwarded-For set to the client’s address. Examples for Caddy and nginx:
Run the image behind your own proxy.
Create your organization
Open https://auth.example.com/register and create the first organization with the short name from the DNS step, as
in Run Sovrain on your server. After that,
sign-up closes and more people join by invitation.
Until the first organization exists, anyone who reaches https://auth.example.com/register can create it. Create
yours as soon as the proxy works.
Keep a copy of the master key
Copy /etc/sovrain/sovrain.env into your password manager, somewhere other than the server and its backups. Without
IDP_MEK, nobody can read the data again, not even from a backup.
The 30-day trial has started. Before it ends, activate a license.
Related
- Back up Sovrain and Upgrade Sovrain
- Every setting of the configuration file: Server configuration