Serve HTTPS
By default, Vigie speaks plain HTTP. With server.tls, it speaks HTTPS only, on the same listen_addr. Use it when
clients reach Vigie over a network you don’t trust, so they can check that the endpointsOne IP address and port that a service gives, with its load balancing weight. See HTTP API. come from your server.
Vigie doesn’t check the certificates of its clients. To restrict who can read it, require a password or filter the port with a firewall.
Before you start
Section titled “Before you start”You need a certificate for the name the clients use to reach Vigie, and its private key, both in PEM. The certificate file can hold the chain after the certificate of the server.
Turn HTTPS on
Section titled “Turn HTTPS on”-
Put the files where the user that runs Vigie can read them, and only that user for the key.
Terminal window sudo install -m 0644 vigie.crt /etc/vigie/vigie.crtsudo install -m 0600 -o vigie vigie.key /etc/vigie/vigie.keyWith the dynamic user of the systemd unit of the repository, add
LoadCredential=to the unit, or a fixedUser=, so the key can stay private. -
Set
server.tlsin the configuration.config.yml serverserverType object · Required no · Default none
Settings of the HTTP server. A change needs a restart, a reload doesn’t apply it.
:listen_addrserver.listen_addrType string · Required no · Default
:8080Address the server listens on.
: :8443tlsserver.tlsType object · Required no · Default none
Turns HTTPS on, with the certificate and its key. Without it, the server speaks plain HTTP.
:cert_fileserver.tls.cert_fileType path · Required with
server.tls· Default noneCertificate of the server, in PEM.
: /etc/vigie/vigie.crtkey_fileserver.tls.key_fileType path · Required with
server.tls· Default nonePrivate key of the certificate, in PEM.
: /etc/vigie/vigie.keyservicesservicesType list · Required yes · Default none
Services the server answers for, at least one.
:- nameservices[].nameType string · Required yes · Default none
Name clients ask for. A request without a name gets the service named
: webdefault.default_portservices[].default_portType integer · Required no · Default
80Port of the endpoints that don’t give their own.
: 8080fileservices[].fileType object · Required one source · Default none
Reads the endpoints from a local file.
:pathservices[].file.pathType path · Required yes · Default none
File holding one endpoint line per line.
: /etc/vigie/web-endpoints.txt -
Check the file and restart Vigie. A reloadReading the configuration file again to replace the services, on
SIGHUPorPOST /reload. See Reload the services. doesn’t apply a change toserver.Terminal window vigie check-config -c /etc/vigie/config.ymlsudo systemctl restart vigie
Vigie reads the certificate once at start, so a renewed certificate also needs a restart.
Check the result
Section titled “Check the result”curl -s --cacert ca.crt 'https://vigie.example.com:8443/services?service_name=web'--cacert gives the CA that signed the certificate, when the system doesn’t trust it already. The clients need the same
CA, such as the ca field of a Flock backend.
| Error | Cause |
|---|---|
server tls: cert_file and key_file are required | server.tls is set with an empty cert_file or key_file. |
open /etc/vigie/vigie.key: permission denied at start | The user that runs Vigie can’t read the key. |
tls: private key does not match public key at start | The key isn’t the key of the certificate. |