Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
240255b2ff | ||
|
|
5c6fd90f37 | ||
|
|
64c3ae4c36 | ||
|
|
7efacfa3bb |
No files matched your search
@@ -538,12 +538,13 @@ Decision: Caddy, the `caddy` package of the Ubuntu archive and a dependency of t
|
|||||||
`127.0.0.1:9474` and rclone's WebDAV on `127.0.0.1:7446`, and Caddy calls them there. Once the
|
`127.0.0.1:9474` and rclone's WebDAV on `127.0.0.1:7446`, and Caddy calls them there. Once the
|
||||||
server is configured, `linux-manager-setup` writes `/etc/caddy/linux-manager.Caddyfile`: plain
|
server is configured, `linux-manager-setup` writes `/etc/caddy/linux-manager.Caddyfile`: plain
|
||||||
HTTP sites on `web.port` (7081), the Manager's `port` (7080) and, while metrics are on,
|
HTTP sites on `web.port` (7081), the Manager's `port` (7080) and, while metrics are on,
|
||||||
`metrics.port` (9464), on every address; while `https.enabled` is `true` and `wan.local_fqdn` is
|
`metrics.port` (9464), on every address; and always sites for the HTTPS names (ADR-65) on
|
||||||
set, sites for `wan.local_fqdn` on `https.web_port` (7444), `https.manager_port` (7443),
|
`https.web_port` (7444), `https.manager_port` (7443), `metrics.https_port` (9465) and
|
||||||
`metrics.https_port` (9465) and `sites.webdav_port` (7445). While HTTPS is on, the Manager's plain
|
`sites.webdav_port` (7445). Unless `https.disable_auto_redirect` is set, both plain HTTP sites
|
||||||
HTTP site redirects (308) to its HTTPS address unless `https.disable_auto_redirect` is set; the
|
redirect (308) a request for an HTTPS name to the same host on HTTPS, and the Manager's redirects
|
||||||
status page's never does, so monitors and clients that do not trust the server's certificate
|
every other request to the first HTTPS name; the status page stays on plain HTTP by address, so
|
||||||
keep reaching it. The `listen` settings choose the interfaces the firewall opens each plain HTTP
|
monitors and clients that do not trust the server's certificate keep reaching it, and `/pki/`
|
||||||
|
stays on plain HTTP on both, where the certificates name it. The `listen` settings choose the interfaces the firewall opens each plain HTTP
|
||||||
port on, as Caddy listens on every address. The certificate comes from `https.certificate`
|
port on, as Caddy listens on every address. The certificate comes from `https.certificate`
|
||||||
(ADR-60); with `acme`, Caddy obtains and renews it with the HTTP challenge on port 80, which the
|
(ADR-60); with `acme`, Caddy obtains and renews it with the HTTP challenge on port 80, which the
|
||||||
firewall opens on the external interface then; `auto_https disable_redirects` keeps port 80 to the
|
firewall opens on the external interface then; `auto_https disable_redirects` keeps port 80 to the
|
||||||
@@ -1704,11 +1705,12 @@ appliances, and ACME is used only when it is set to `acme`: a public name that r
|
|||||||
server and port 80 reachable from the internet are rarely ready when a server is installed. The
|
server and port 80 reachable from the internet are rarely ready when a server is installed. The
|
||||||
file a new installation writes has it empty, and that installation's first setup chooses it and
|
file a new installation writes has it empty, and that installation's first setup chooses it and
|
||||||
writes it into the file: `ca` when the Servers Issuing CA has its certificate after the PKI is
|
writes it into the file: `ca` when the Servers Issuing CA has its certificate after the PKI is
|
||||||
provisioned, as with a root the server creates, else `self-signed`. An upgrade makes no choice: a
|
provisioned, as with a root the server creates, else `self-signed`. Until a setup run has
|
||||||
configuration that names a source keeps it, and one that names none is self-signed. Whether
|
succeeded, a file that does not set it is taken as empty, so a configuration written by hand or by
|
||||||
HTTPS is on is an installer question and is always respected, and so is
|
a tool in place of the installer's file gets the same choice. An upgrade makes no choice: a
|
||||||
`https.disable_auto_redirect`, which keeps Caddy's plain HTTP site of the Manager from
|
configuration that names a source keeps it, and once a run has succeeded, one that names none is
|
||||||
redirecting to HTTPS (ADR-21).
|
self-signed. `https.disable_auto_redirect`, an installer question, is always respected; it keeps
|
||||||
|
Caddy's plain HTTP sites from redirecting to HTTPS (ADR-21).
|
||||||
|
|
||||||
Consequences: A browser trusts a self-signed certificate, or one of the server's PKI, only once
|
Consequences: A browser trusts a self-signed certificate, or one of the server's PKI, only once
|
||||||
its user trusts it or the root. An imported certificate is not renewed by the server, which warns
|
its user trusts it or the root. An imported certificate is not renewed by the server, which warns
|
||||||
@@ -1824,3 +1826,31 @@ Consequences: One file serves both kinds of slapd, so the definitions cannot dri
|
|||||||
is an ordinary one, made with its first member; until it exists, only root reads the keys, and
|
is an ordinary one, made with its first member; until it exists, only root reads the keys, and
|
||||||
renaming it takes the access away. A server whose slapd holds the PKI definitions inside
|
renaming it takes the access away. A server whose slapd holds the PKI definitions inside
|
||||||
`cn=linux-manager` is installed anew, as slapd refuses the same OIDs in a second entry.
|
`cn=linux-manager` is installed anew, as slapd refuses the same OIDs in a second entry.
|
||||||
|
|
||||||
|
## ADR-65: HTTPS is always on, for wan.local_fqdn or the host name, with IP addresses on request
|
||||||
|
|
||||||
|
Status: Accepted
|
||||||
|
|
||||||
|
Context: The status page and the Manager carry passwords, so they are to be served over HTTPS on
|
||||||
|
every server; only the redirect from plain HTTP is a choice, for labs and development, where the
|
||||||
|
name of a server behind a forward is the only way to reach it. A server without `wan.local_fqdn`,
|
||||||
|
such as the first device of a network without DNS, still needs a name for its certificate, and an
|
||||||
|
appliance that is set up by address needs a certificate that names its address.
|
||||||
|
|
||||||
|
Decision: HTTPS has no switch: `https.enabled` and the installer's question are gone, and a file
|
||||||
|
that still has the setting loads without it. The HTTPS names are `wan.local_fqdn` alone when it is
|
||||||
|
set, else the host name and `<host name>.local`, which Avahi announces with mDNS on the internal
|
||||||
|
side while there is no FQDN. `https.ip_sans`, off by default, adds the server's addresses to the
|
||||||
|
self-signed certificate and the Servers Issuing CA's, and Caddy then serves HTTPS on them too; an
|
||||||
|
ACME certificate names `wan.local_fqdn` only, which `acme` requires. Unless
|
||||||
|
`https.disable_auto_redirect` is set, a plain HTTP request for an HTTPS host is redirected to the
|
||||||
|
same host on HTTPS, on the status page's port and the Manager's; the status page stays on plain
|
||||||
|
HTTP by any other address, and `/pki/` stays on plain HTTP. A certificate whose names or addresses
|
||||||
|
differ from the current ones is made or issued again at the next setup, so a changed DHCP address
|
||||||
|
is followed. As Caddy always listens, the firewall is always set up.
|
||||||
|
|
||||||
|
Consequences: A browser warns about a self-signed certificate, or one of the server's PKI, until
|
||||||
|
its user trusts it or the root; one reached by address warns unless `https.ip_sans` is on. A server
|
||||||
|
whose addresses change gets a new certificate at each change while `https.ip_sans` is on. Avahi is
|
||||||
|
a dependency, running only while there is no FQDN; it sends its announcements on every interface,
|
||||||
|
and the firewall lets queries in on the internal side only.
|
||||||
@@ -1,5 +1,61 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.45.2 - 2026-11-24 20:41:04 +0100
|
||||||
|
|
||||||
|
fix: the copy icons of the Manager are shown only on a page opened over HTTPS, where the browser
|
||||||
|
offers the clipboard.
|
||||||
|
|
||||||
|
- The copy icons of the Addresses panel, the Remote access page and the Web Sites page, and the Copy
|
||||||
|
button of a WireGuard configuration, are left out on a page opened over plain HTTP, where they
|
||||||
|
did nothing.
|
||||||
|
|
||||||
|
## 0.45.1 - 2026-11-24 19:57:53 +0100
|
||||||
|
|
||||||
|
update: the development VM of lm-dev-vm.py keeps plain HTTP by name.
|
||||||
|
|
||||||
|
- tests/remote/configs/dev.json sets https.disable_auto_redirect, so the status page and the
|
||||||
|
Manager of the development VM answer over plain HTTP by name as well as over HTTPS.
|
||||||
|
|
||||||
|
## 0.45.0 - 2026-11-24 19:26:51 +0100
|
||||||
|
|
||||||
|
feature: HTTPS is always on, for wan.local_fqdn or, without it, the host name and its mDNS name,
|
||||||
|
optionally also for the server's addresses, and the redirect to HTTPS covers the status page by
|
||||||
|
name.
|
||||||
|
|
||||||
|
- https.enabled and the installer's question whether to serve over HTTPS are gone; a
|
||||||
|
linux-manager.json that still has https.enabled is read without it.
|
||||||
|
- The HTTPS names are wan.local_fqdn alone when it is set, else the host name and
|
||||||
|
<host name>.local, which Avahi, a new dependency, announces with mDNS on the internal side while
|
||||||
|
there is no wan.local_fqdn; the firewall opens UDP 5353 there.
|
||||||
|
- https.ip_sans, off by default and set in the HTTPS settings dialog of the Certificates page, adds
|
||||||
|
the server's addresses to the self-signed certificate and the Servers Issuing CA's, and Caddy
|
||||||
|
serves HTTPS on them too; a certificate is made again when its names or addresses change.
|
||||||
|
- https.certificate acme needs wan.local_fqdn.
|
||||||
|
- Unless https.disable_auto_redirect is true, a plain HTTP request for an HTTPS name is redirected
|
||||||
|
to HTTPS on the status page's port too; the status page stays on plain HTTP by address, and
|
||||||
|
/pki/ on plain HTTP on both ports. The Manager's redirect keeps the host it was asked for when
|
||||||
|
that is an HTTPS host.
|
||||||
|
- The Addresses panel of the Server page lists the HTTPS addresses of every HTTPS host, and the
|
||||||
|
plain HTTP addresses by name only while the redirect is off; the HTTPS row of the Certificates
|
||||||
|
page names the hosts HTTPS is served for.
|
||||||
|
- The OpenID Provider, WebDAV and the ACME servers of the issuing CAs need wan.local_fqdn no
|
||||||
|
longer; they are served on the first HTTPS name.
|
||||||
|
- The firewall is always set up, as Caddy always serves HTTPS.
|
||||||
|
|
||||||
|
## 0.44.1 - 2026-11-24 18:23:42 +0100
|
||||||
|
|
||||||
|
fix: a configuration that names no HTTPS certificate source gets the first setup's choice, and the
|
||||||
|
development VM of lm-dev-vm.py is named by --fqdn, so its HTTPS sites answer a name that resolves
|
||||||
|
to it.
|
||||||
|
|
||||||
|
- Until a setup run has succeeded, a linux-manager.json without https.certificate, such as one
|
||||||
|
written in place of the installer's, is taken as empty: the first setup chooses ca when the
|
||||||
|
Servers Issuing CA has its certificate, else self-signed, and writes it into the file. On a
|
||||||
|
server already set up, a file without it stays self-signed.
|
||||||
|
- lm-dev-vm.py --fqdn (LXD_DEV_FQDN, lm-dev.test by default) is the VM's wan.local_fqdn, the
|
||||||
|
placeholder @FQDN@ of tests/remote/configs/dev.json, and the name of the HTTPS addresses it
|
||||||
|
prints.
|
||||||
|
|
||||||
## 0.44.0 - 2026-11-24 18:06:34 +0100
|
## 0.44.0 - 2026-11-24 18:06:34 +0100
|
||||||
|
|
||||||
feature: the CA certificates and CRLs are always published over HTTP and HTTPS on the status and
|
feature: the CA certificates and CRLs are always published over HTTP and HTTPS on the status and
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ linux-manager linux-manager/internal_interface string eth1
|
|||||||
linux-manager linux-manager/int_addr string 10.1.1.4
|
linux-manager linux-manager/int_addr string 10.1.1.4
|
||||||
linux-manager linux-manager/int_gateway_ip string 10.1.1.1
|
linux-manager linux-manager/int_gateway_ip string 10.1.1.1
|
||||||
linux-manager linux-manager/local_fqdn string router.example.com
|
linux-manager linux-manager/local_fqdn string router.example.com
|
||||||
linux-manager linux-manager/https_enabled boolean true
|
|
||||||
linux-manager linux-manager/local_cidrs string 10.0.0.0/24
|
linux-manager linux-manager/local_cidrs string 10.0.0.0/24
|
||||||
linux-manager linux-manager/remote_addrs string peer.example.net
|
linux-manager linux-manager/remote_addrs string peer.example.net
|
||||||
linux-manager linux-manager/remote_id string peer.example.net
|
linux-manager linux-manager/remote_id string peer.example.net
|
||||||
@@ -146,12 +145,12 @@ must have the type shown below; an unknown section or setting is an error.
|
|||||||
| `web` | `log_files` | list | | Absolute paths of the log files `/logs` shows, at most 32 (see The /logs API) |
|
| `web` | `log_files` | list | | Absolute paths of the log files `/logs` shows, at most 32 (see The /logs API) |
|
||||||
| `web` | `shell_auth_timeout` | integer | `15` | Minutes after the last use of a shell in which a new shell opens without signing in again, 0 (always sign in) to 1440 |
|
| `web` | `shell_auth_timeout` | integer | `15` | Minutes after the last use of a shell in which a new shell opens without signing in again, 0 (always sign in) to 1440 |
|
||||||
| `ssh` | `ldap_login` | boolean | `false` | sshd accepts the directory password of the console accounts in the directory (see Console login and SSH) |
|
| `ssh` | `ldap_login` | boolean | `false` | sshd accepts the directory password of the console accounts in the directory (see Console login and SSH) |
|
||||||
| `https` | `enabled` | boolean | `true` | Caddy serves the status web service and the Manager over HTTPS for `wan.local_fqdn` |
|
|
||||||
| `https` | `email` | string | | The e-mail address of the ACME account |
|
| `https` | `email` | string | | The e-mail address of the ACME account |
|
||||||
| `https` | `web_port` | integer | `7444` | HTTPS port of the status web service |
|
| `https` | `web_port` | integer | `7444` | HTTPS port of the status web service |
|
||||||
| `https` | `manager_port` | integer | `7443` | HTTPS port of the Manager |
|
| `https` | `manager_port` | integer | `7443` | HTTPS port of the Manager |
|
||||||
| `https` | `disable_auto_redirect` | boolean | `false` | The Manager answers on its plain HTTP port instead of redirecting there to its HTTPS address while `enabled` is `true`; the status page never redirects |
|
| `https` | `disable_auto_redirect` | boolean | `false` | The status page and the Manager answer by their HTTPS names on their plain HTTP ports instead of redirecting there to HTTPS (see HTTPS) |
|
||||||
| `https` | `certificate` | string | `self-signed` | Where the certificate of `wan.local_fqdn` comes from: `self-signed`, `ca`, `acme` or `external`; empty in a new installation's file, for its first setup to choose `ca` or `self-signed` and write it here (see HTTPS) |
|
| `https` | `ip_sans` | boolean | `false` | The self-signed certificate and the one of the Servers Issuing CA also name the server's addresses, so HTTPS is reached by address too (see HTTPS) |
|
||||||
|
| `https` | `certificate` | string | `self-signed` | Where the certificate of the HTTPS names comes from: `self-signed`, `ca`, `acme` or `external`; empty in a new installation's file, or absent before the first successful setup, for its first setup to choose `ca` or `self-signed` and write it here (see HTTPS) |
|
||||||
| `https` | `self_signed_days` | integer | `365` | Days the self-signed certificate is valid, 1 to 3650 |
|
| `https` | `self_signed_days` | integer | `365` | Days the self-signed certificate is valid, 1 to 3650 |
|
||||||
| `https` | `acme_provider` | string | `letsencrypt` | The ACME CA of the server and of the web sites with `tls` `acme`: `letsencrypt`, `zerossl` or `custom` (see HTTPS) |
|
| `https` | `acme_provider` | string | `letsencrypt` | The ACME CA of the server and of the web sites with `tls` `acme`: `letsencrypt`, `zerossl` or `custom` (see HTTPS) |
|
||||||
| `https` | `acme_url` | string | | The `https://` ACME directory URL of `custom` |
|
| `https` | `acme_url` | string | | The `https://` ACME directory URL of `custom` |
|
||||||
@@ -159,10 +158,10 @@ must have the type shown below; an unknown section or setting is an error.
|
|||||||
| `https` | `acme_eab_mac_key` | string | | The EAB MAC key of `custom` |
|
| `https` | `acme_eab_mac_key` | string | | The EAB MAC key of `custom` |
|
||||||
| `https` | `zerossl_api_key` | string | | The ZeroSSL API key; without it the EAB credentials come from `email` |
|
| `https` | `zerossl_api_key` | string | | The ZeroSSL API key; without it the EAB credentials come from `email` |
|
||||||
| `https` | `acme_staging` | boolean | `false` | With `letsencrypt`, Caddy takes its certificates from Let's Encrypt's staging environment, whose certificates no browser trusts and whose rate limits are higher, for routers rebuilt often (see HTTPS) |
|
| `https` | `acme_staging` | boolean | `false` | With `letsencrypt`, Caddy takes its certificates from Let's Encrypt's staging environment, whose certificates no browser trusts and whose rate limits are higher, for routers rebuilt often (see HTTPS) |
|
||||||
| `oidc` | `enabled` | boolean | `false` | The OpenID Provider at the status web service's HTTPS site, which needs `web.enabled`, `https.enabled` and `wan.local_fqdn` (see OpenID Provider) |
|
| `oidc` | `enabled` | boolean | `false` | The OpenID Provider at the status web service's HTTPS site, which needs `web.enabled` (see OpenID Provider) |
|
||||||
| `sites` | `enabled` | boolean | `false` | Caddy serves the web sites (see Web sites) |
|
| `sites` | `enabled` | boolean | `false` | Caddy serves the web sites (see Web sites) |
|
||||||
| `sites` | `upload_max_mb` | integer | `512` | The largest upload of a site's file or zip archive, in MiB, 1 to 10240 |
|
| `sites` | `upload_max_mb` | integer | `512` | The largest upload of a site's file or zip archive, in MiB, 1 to 10240 |
|
||||||
| `sites` | `webdav` | boolean | `false` | WebDAV of the sites' folders, which needs `https.enabled` and `wan.local_fqdn` (see WebDAV) |
|
| `sites` | `webdav` | boolean | `false` | WebDAV of the sites' folders, served over HTTPS for the HTTPS names (see WebDAV) |
|
||||||
| `sites` | `webdav_port` | integer | `7445` | HTTPS port of WebDAV |
|
| `sites` | `webdav_port` | integer | `7445` | HTTPS port of WebDAV |
|
||||||
| `dns` | `enabled` | boolean | `false` | The primary name server of the server's domains, `wan.local_fqdn`, which must then be a DNS name (see Name server) |
|
| `dns` | `enabled` | boolean | `false` | The primary name server of the server's domains, `wan.local_fqdn`, which must then be a DNS name (see Name server) |
|
||||||
| `dns` | `secondary` | string | | The optional secondary name server of every domain, a host name other than `wan.local_fqdn`; it may transfer the domains; empty, `wan.local_fqdn` is the only name server |
|
| `dns` | `secondary` | string | | The optional secondary name server of every domain, a host name other than `wan.local_fqdn`; it may transfer the domains; empty, `wan.local_fqdn` is the only name server |
|
||||||
@@ -185,7 +184,7 @@ must have the type shown below; an unknown section or setting is an error.
|
|||||||
| `metrics` | `enabled` | boolean | `true` | The metrics service: collection, history and `/metrics` |
|
| `metrics` | `enabled` | boolean | `true` | The metrics service: collection, history and `/metrics` |
|
||||||
| `metrics` | `listen` | string | `internal` | The interfaces the firewall opens `metrics.port` on: `internal`, `external` or `both` |
|
| `metrics` | `listen` | string | `internal` | The interfaces the firewall opens `metrics.port` on: `internal`, `external` or `both` |
|
||||||
| `metrics` | `port` | integer | `9464` | TCP port of `/metrics`, served by Caddy over plain HTTP |
|
| `metrics` | `port` | integer | `9464` | TCP port of `/metrics`, served by Caddy over plain HTTP |
|
||||||
| `metrics` | `https_port` | integer | `9465` | HTTPS port of `/metrics`, served by Caddy while `https.enabled` is true |
|
| `metrics` | `https_port` | integer | `9465` | HTTPS port of `/metrics`, served by Caddy |
|
||||||
| `metrics` | `service_account` | string | `metrics` | The service account `/metrics` takes, which `linux-manager-setup` adds and keeps |
|
| `metrics` | `service_account` | string | `metrics` | The service account `/metrics` takes, which `linux-manager-setup` adds and keeps |
|
||||||
| `metrics` | `otlp_endpoint` | string | | An OTLP/HTTP URL the metrics are pushed to every minute, for example `https://collector.example.com:4318/v1/metrics` |
|
| `metrics` | `otlp_endpoint` | string | | An OTLP/HTTP URL the metrics are pushed to every minute, for example `https://collector.example.com:4318/v1/metrics` |
|
||||||
| `metrics` | `otlp_username` | string | | The user name of HTTP Basic authentication at the OTLP endpoint |
|
| `metrics` | `otlp_username` | string | | The user name of HTTP Basic authentication at the OTLP endpoint |
|
||||||
@@ -752,8 +751,8 @@ setup code. A retired issuing CA is revoked in Simple CA, where the server canno
|
|||||||
|
|
||||||
### ACME server
|
### ACME server
|
||||||
|
|
||||||
A general-purpose CA with `"acme": true` backs an ACME server of Caddy, while `https.enabled`, at
|
A general-purpose CA with `"acme": true` backs an ACME server of Caddy, at
|
||||||
`https://<wan.local_fqdn>:<https.web_port>/acme/<name>/directory`, so servers get and renew
|
`https://<HTTPS name>:<https.web_port>/acme/<name>/directory`, so servers get and renew
|
||||||
certificates with any ACME client:
|
certificates with any ACME client:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
@@ -1624,31 +1623,45 @@ and the facts for `/config` from `/run/linux-manager/web.json` (readable by root
|
|||||||
Caddy, a dependency of the package, serves every HTTP and HTTPS port of the server's services; the
|
Caddy, a dependency of the package, serves every HTTP and HTTPS port of the server's services; the
|
||||||
services listen on `127.0.0.1` only. Over plain HTTP it serves the status web service on
|
services listen on `127.0.0.1` only. Over plain HTTP it serves the status web service on
|
||||||
`web.port` (7081 by default), the Manager on its `port` (7080), and while metrics are enabled the
|
`web.port` (7081 by default), the Manager on its `port` (7080), and while metrics are enabled the
|
||||||
metrics service on `metrics.port` (9464). While `https.enabled` is `true` and `wan.local_fqdn` is
|
metrics service on `metrics.port` (9464). HTTPS is always on: Caddy also serves the status web
|
||||||
set, it also serves the status web service on `https.web_port` (7444), the Manager on
|
service on `https.web_port` (7444), the Manager on `https.manager_port` (7443), and while metrics
|
||||||
`https.manager_port` (7443), and while metrics are enabled the metrics service on
|
are enabled the metrics service on `metrics.https_port` (9465), all for the HTTPS names:
|
||||||
`metrics.https_port` (9465), all for `wan.local_fqdn`.
|
|
||||||
|
|
||||||
The installer asks whether to serve over HTTPS (`https_enabled`) and, with HTTPS, whether to keep
|
- `wan.local_fqdn` alone, when it is set;
|
||||||
the Manager on plain HTTP (`https_disable_auto_redirect`). While HTTPS is on, Caddy answers the
|
- without it, the host name and `<host name>.local`, which Avahi announces with mDNS on the
|
||||||
Manager's plain HTTP port with a redirect (308) to the same path at
|
internal side (the external interface of a server with one), where the firewall opens UDP 5353;
|
||||||
`https://<wan.local_fqdn>:<https.manager_port>`, unless `https.disable_auto_redirect` is `true`.
|
Avahi is stopped while `wan.local_fqdn` is set.
|
||||||
The status page never redirects and stays available over plain HTTP on `web.port` whether HTTPS
|
|
||||||
is on or not.
|
With `https.ip_sans`, the self-signed certificate and the one of the Servers Issuing CA also name
|
||||||
|
the server's addresses, those of its interfaces and `wan.public_address`, without link-local ones,
|
||||||
|
and Caddy serves HTTPS on them too. It is off by default, as a server is rarely reached by address;
|
||||||
|
a server that is the first device of a network can then be set up over HTTPS by address, once its
|
||||||
|
certificate is accepted. A client without SNI gets the certificate of the first HTTPS name. An ACME
|
||||||
|
certificate names `wan.local_fqdn` only, which `https.certificate` `acme` needs.
|
||||||
|
|
||||||
|
The installer asks whether to keep plain HTTP (`https_disable_auto_redirect`). Unless
|
||||||
|
`https.disable_auto_redirect` is `true`, Caddy answers a plain HTTP request for an HTTPS name with a
|
||||||
|
redirect (308) to the same host and path on HTTPS: on `web.port` to `https.web_port`, on the
|
||||||
|
Manager's port to `https.manager_port`; with `https.ip_sans`, a request by address is an HTTPS
|
||||||
|
host too. The status page stays available over plain HTTP by any other address; every other
|
||||||
|
request on the Manager's port is redirected to the first HTTPS name. `/pki/` stays on plain HTTP
|
||||||
|
on both ports. With the redirect off, both answer over plain HTTP by name and by address.
|
||||||
|
|
||||||
### The server's certificate
|
### The server's certificate
|
||||||
|
|
||||||
`https.certificate` says where the certificate of `wan.local_fqdn` comes from; it is `self-signed`
|
`https.certificate` says where the certificate of the HTTPS names comes from; it is `self-signed`
|
||||||
when the file does not set it, and ACME only when it is set to `acme`. The file a new installation
|
when the file of a server already set up does not set it, and ACME only when it is set to `acme`. The file a new installation
|
||||||
writes has it empty, and that installation's first setup chooses it and writes it into the file:
|
writes has it empty, and that installation's first setup chooses it and writes it into the file:
|
||||||
`ca` when the root CA and the Servers Issuing CA are available, as with a root the server creates,
|
`ca` when the root CA and the Servers Issuing CA are available, as with a root the server creates,
|
||||||
else `self-signed`, as with an offline root, a Simple CA root that has not signed yet, or a
|
else `self-signed`, as with an offline root, a Simple CA root that has not signed yet, or a
|
||||||
directory that cannot be reached. A source chosen later, in the Manager or the file, stays.
|
directory that cannot be reached. Until a setup run has succeeded, a file that does not set it,
|
||||||
|
such as one written in place of the installer's, gets the same choice. A source chosen later, in
|
||||||
|
the Manager or the file, stays.
|
||||||
|
|
||||||
| Source | The certificate |
|
| Source | The certificate |
|
||||||
|---|---|
|
|---|---|
|
||||||
| `acme` | obtained and renewed by Caddy from the ACME CA of `https.acme_provider`, with the HTTP challenge, so `wan.local_fqdn` resolves to the server's public address and port 80 is reachable from the internet; kept in `/var/lib/caddy` |
|
| `acme` | obtained and renewed by Caddy from the ACME CA of `https.acme_provider`, with the HTTP challenge, so `wan.local_fqdn` resolves to the server's public address and port 80 is reachable from the internet; kept in `/var/lib/caddy` |
|
||||||
| `self-signed` (the default) | made by the server, valid for `https.self_signed_days`, and made again when a third of it is left or `wan.local_fqdn` changes |
|
| `self-signed` (the default) | made by the server, valid for `https.self_signed_days`, and made again when a third of it is left or its names or addresses change |
|
||||||
| `ca` | issued and renewed by the Servers Issuing CA, `servers`, of the server's PKI (see Certificates), with the template `mtls` |
|
| `ca` | issued and renewed by the Servers Issuing CA, `servers`, of the server's PKI (see Certificates), with the template `mtls` |
|
||||||
| `external` | another CA's certificate, imported, from a CSR the server makes or as a PFX file |
|
| `external` | another CA's certificate, imported, from a CSR the server makes or as a PFX file |
|
||||||
|
|
||||||
@@ -1724,9 +1737,9 @@ Caddy is a dependency of the package, the `caddy` package of the Ubuntu archive,
|
|||||||
|
|
||||||
While `oidc.enabled` is `true`, the status web service is an OpenID Provider (OpenID Connect
|
While `oidc.enabled` is `true`, the status web service is an OpenID Provider (OpenID Connect
|
||||||
Core 1.0) for the users of the directory. Its issuer is the web service's HTTPS site,
|
Core 1.0) for the users of the directory. Its issuer is the web service's HTTPS site,
|
||||||
`https://<wan.local_fqdn>:<https.web_port>`, without the port when it is 443; the web service
|
`https://<HTTPS name>:<https.web_port>`, the first HTTPS name, without the port when it is 443; the
|
||||||
answers it only on `127.0.0.1`, where Caddy passes the requests, so the provider is never reached
|
web service answers it only on `127.0.0.1`, where Caddy passes the requests, so the provider is
|
||||||
over plain HTTP. The setting needs `web.enabled`, `https.enabled` and `wan.local_fqdn`.
|
never reached over plain HTTP. The setting needs `web.enabled`.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
linux-manager-config-edit set --restart oidc.enabled true
|
linux-manager-config-edit set --restart oidc.enabled true
|
||||||
|
|||||||
+8
-3
@@ -11,7 +11,9 @@ engine made from the file's otp_url, unless --no-otp is given; lm-dev-otp-code.p
|
|||||||
otp_url the file lacks, or all of them when there is no file, is generated and kept in the file, so a VM made again
|
otp_url the file lacks, or all of them when there is no file, is generated and kept in the file, so a VM made again
|
||||||
has the same password and token until they are deleted from the file.
|
has the same password and token until they are deleted from the file.
|
||||||
The VM gets a configuration from tests/remote/configs/ (--config, dev.json by default), whose @ETH0@ is the
|
The VM gets a configuration from tests/remote/configs/ (--config, dev.json by default), whose @ETH0@ is the
|
||||||
interface of its default route, @CIDR0@ its network and @PSK@ a generated key. The VM gets an AppRole of its own in the project's Vault
|
interface of its default route, @CIDR0@ its network, @FQDN@ --fqdn (LXD_DEV_FQDN, lm-dev.test by default), and @PSK@ a
|
||||||
|
generated key; the Manager and the status web service answer HTTPS for that name, which has to resolve to the
|
||||||
|
listen address. The VM gets an AppRole of its own in the project's Vault
|
||||||
(lm_dev.enrol_instance), with which it reads the debconf preseed with the admin's password and the
|
(lm_dev.enrol_instance), with which it reads the debconf preseed with the admin's password and the
|
||||||
configuration with its key, kept there as VM/preseed and VM/config, and its TOTP key, generated or from otp_url; no
|
configuration with its key, kept there as VM/preseed and VM/config, and its TOTP key, generated or from otp_url; no
|
||||||
secret is an argument or on standard input, so create needs a project with a Vault
|
secret is an argument or on standard input, so create needs a project with a Vault
|
||||||
@@ -60,6 +62,8 @@ def main():
|
|||||||
parser.add_argument('--listen', default=setting('LXD_LISTEN', None),
|
parser.add_argument('--listen', default=setting('LXD_LISTEN', None),
|
||||||
help="outside a test project, the LXD host address the proxies listen on (LXD_LISTEN, "
|
help="outside a test project, the LXD host address the proxies listen on (LXD_LISTEN, "
|
||||||
"default the IPv4 address of the remote URL's host)")
|
"default the IPv4 address of the remote URL's host)")
|
||||||
|
parser.add_argument('--fqdn', default=setting('LXD_DEV_FQDN', 'lm-dev.test'),
|
||||||
|
help='the name of the VM in its configuration, @FQDN@ (LXD_DEV_FQDN, default lm-dev.test)')
|
||||||
parser.add_argument('--forward-address', default=setting('LXD_FORWARD_ADDRESS', None),
|
parser.add_argument('--forward-address', default=setting('LXD_FORWARD_ADDRESS', None),
|
||||||
help="with create in a test project, the forward's listen address, one of the uplink's routes "
|
help="with create in a test project, the forward's listen address, one of the uplink's routes "
|
||||||
"(LXD_FORWARD_ADDRESS); without it one is allocated")
|
"(LXD_FORWARD_ADDRESS); without it one is allocated")
|
||||||
@@ -229,7 +233,8 @@ def main():
|
|||||||
sys.exit(f'the package did not install; see {log}')
|
sys.exit(f'the package did not install; see {log}')
|
||||||
|
|
||||||
# Apply the configuration twice, as the server's certificates follow the first run.
|
# Apply the configuration twice, as the server's certificates follow the first run.
|
||||||
text = config.read_text(encoding='utf-8').replace('@ETH0@', nic).replace('@CIDR0@', str(interface.network))
|
text = config.read_text(encoding='utf-8').replace('@ETH0@', nic).replace('@CIDR0@', str(interface.network))\
|
||||||
|
.replace('@FQDN@', args.fqdn)
|
||||||
problem = hand_over(args.remote, args.project, args.vm, vault, 'config', text.replace('@PSK@', psk),
|
problem = hand_over(args.remote, args.project, args.vm, vault, 'config', text.replace('@PSK@', psk),
|
||||||
'/etc/linux-manager/linux-manager.json', '0600')
|
'/etc/linux-manager/linux-manager.json', '0600')
|
||||||
if problem:
|
if problem:
|
||||||
@@ -248,7 +253,7 @@ def main():
|
|||||||
if not args.no_otp:
|
if not args.no_otp:
|
||||||
print(f'administrator TOTP: otp_url in {credentials}; codes: bin/lm-dev-otp-code.py --project {args.project} '
|
print(f'administrator TOTP: otp_url in {credentials}; codes: bin/lm-dev-otp-code.py --project {args.project} '
|
||||||
f'--vm {args.vm}')
|
f'--vm {args.vm}')
|
||||||
print(f'manager: https://{args.listen}:7443/ status: https://{args.listen}:7444/ and http://{args.listen}:7081/ '
|
print(f'manager: https://{args.fqdn}:7443/ status: https://{args.fqdn}:7444/ and http://{args.listen}:7081/ '
|
||||||
f'ssh: {args.listen} port 2222')
|
f'ssh: {args.listen} port 2222')
|
||||||
print(f'shell: lxc exec {args.remote}:{args.vm} --project {args.project} -- su -l')
|
print(f'shell: lxc exec {args.remote}:{args.vm} --project {args.project} -- su -l')
|
||||||
print(f'remove: {sys.argv[0]} remove --remote {args.remote} --project {args.project} --vm {args.vm}')
|
print(f'remove: {sys.argv[0]} remove --remote {args.remote} --project {args.project} --vm {args.vm}')
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ fi
|
|||||||
db_go || true
|
db_go || true
|
||||||
|
|
||||||
db_input high linux-manager/local_fqdn || true
|
db_input high linux-manager/local_fqdn || true
|
||||||
db_input high linux-manager/https_enabled || true
|
|
||||||
if [ "$ROUTER" = "true" ] || [ "$VPN" = "true" ]; then
|
if [ "$ROUTER" = "true" ] || [ "$VPN" = "true" ]; then
|
||||||
db_input high linux-manager/local_cidrs || true
|
db_input high linux-manager/local_cidrs || true
|
||||||
fi
|
fi
|
||||||
@@ -85,11 +84,8 @@ if [ "$VPN" = "true" ]; then
|
|||||||
fi
|
fi
|
||||||
db_go || true
|
db_go || true
|
||||||
|
|
||||||
db_get linux-manager/https_enabled
|
db_input high linux-manager/https_disable_auto_redirect || true
|
||||||
if [ "$RET" = "true" ]; then
|
db_go || true
|
||||||
db_input high linux-manager/https_disable_auto_redirect || true
|
|
||||||
db_go || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
db_get linux-manager/pki_root
|
db_get linux-manager/pki_root
|
||||||
if [ "$RET" = "local" ]; then
|
if [ "$RET" = "local" ]; then
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Depends: ${misc:Depends},
|
|||||||
python3-prometheus-client,
|
python3-prometheus-client,
|
||||||
python3-requests,
|
python3-requests,
|
||||||
caddy,
|
caddy,
|
||||||
|
avahi-daemon,
|
||||||
postgresql,
|
postgresql,
|
||||||
slapd,
|
slapd,
|
||||||
nslcd,
|
nslcd,
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ case "$1" in
|
|||||||
answer linux-manager/external_interface; LINUX_MANAGER_EXTERNAL_INTERFACE="$ANSWER"
|
answer linux-manager/external_interface; LINUX_MANAGER_EXTERNAL_INTERFACE="$ANSWER"
|
||||||
answer linux-manager/internal_interface; LINUX_MANAGER_INTERNAL_INTERFACE="$ANSWER"
|
answer linux-manager/internal_interface; LINUX_MANAGER_INTERNAL_INTERFACE="$ANSWER"
|
||||||
answer linux-manager/local_fqdn; LINUX_MANAGER_LOCAL_FQDN="$ANSWER"
|
answer linux-manager/local_fqdn; LINUX_MANAGER_LOCAL_FQDN="$ANSWER"
|
||||||
answer linux-manager/https_enabled; LINUX_MANAGER_HTTPS_ENABLED="$ANSWER"
|
|
||||||
answer linux-manager/https_disable_auto_redirect; LINUX_MANAGER_HTTPS_DISABLE_AUTO_REDIRECT="$ANSWER"
|
answer linux-manager/https_disable_auto_redirect; LINUX_MANAGER_HTTPS_DISABLE_AUTO_REDIRECT="$ANSWER"
|
||||||
answer linux-manager/local_id_mode; LINUX_MANAGER_LOCAL_ID_MODE="$ANSWER"
|
answer linux-manager/local_id_mode; LINUX_MANAGER_LOCAL_ID_MODE="$ANSWER"
|
||||||
answer linux-manager/local_cidrs; LINUX_MANAGER_LOCAL_CIDRS="$ANSWER"
|
answer linux-manager/local_cidrs; LINUX_MANAGER_LOCAL_CIDRS="$ANSWER"
|
||||||
@@ -46,7 +45,7 @@ case "$1" in
|
|||||||
LINUX_MANAGER_ROUTER_ENABLED LINUX_MANAGER_VPN_ENABLED \
|
LINUX_MANAGER_ROUTER_ENABLED LINUX_MANAGER_VPN_ENABLED \
|
||||||
LINUX_MANAGER_EXTERNAL_INTERFACE \
|
LINUX_MANAGER_EXTERNAL_INTERFACE \
|
||||||
LINUX_MANAGER_INTERNAL_INTERFACE LINUX_MANAGER_LOCAL_FQDN \
|
LINUX_MANAGER_INTERNAL_INTERFACE LINUX_MANAGER_LOCAL_FQDN \
|
||||||
LINUX_MANAGER_HTTPS_ENABLED LINUX_MANAGER_HTTPS_DISABLE_AUTO_REDIRECT \
|
LINUX_MANAGER_HTTPS_DISABLE_AUTO_REDIRECT \
|
||||||
LINUX_MANAGER_LOCAL_ID_MODE LINUX_MANAGER_LOCAL_CIDRS \
|
LINUX_MANAGER_LOCAL_ID_MODE LINUX_MANAGER_LOCAL_CIDRS \
|
||||||
LINUX_MANAGER_INT_GATEWAY_IP \
|
LINUX_MANAGER_INT_GATEWAY_IP \
|
||||||
LINUX_MANAGER_REMOTE_ADDRS LINUX_MANAGER_REMOTE_ID \
|
LINUX_MANAGER_REMOTE_ADDRS LINUX_MANAGER_REMOTE_ID \
|
||||||
|
|||||||
@@ -95,22 +95,15 @@ Description: Local router FQDN:
|
|||||||
router.example.com). Used as the IKEv2 server identity and
|
router.example.com). Used as the IKEv2 server identity and
|
||||||
certificate common name.
|
certificate common name.
|
||||||
|
|
||||||
Template: linux-manager/https_enabled
|
|
||||||
Type: boolean
|
|
||||||
Default: true
|
|
||||||
Description: Serve the status page and the Manager over HTTPS?
|
|
||||||
If enabled, Caddy serves the status page and the Manager over HTTPS for the
|
|
||||||
router FQDN, with a certificate of the Servers Issuing CA when the server
|
|
||||||
creates its root CA, and a self-signed one otherwise. The status page stays
|
|
||||||
available over plain HTTP either way.
|
|
||||||
|
|
||||||
Template: linux-manager/https_disable_auto_redirect
|
Template: linux-manager/https_disable_auto_redirect
|
||||||
Type: boolean
|
Type: boolean
|
||||||
Default: false
|
Default: false
|
||||||
Description: Keep the Manager available over plain HTTP?
|
Description: Keep the status page and the Manager available over plain HTTP?
|
||||||
If enabled, the Manager answers on its plain HTTP port. Otherwise, while
|
Caddy always serves the status page and the Manager over HTTPS, for the
|
||||||
HTTPS is on, it redirects there to its HTTPS address. The status page never
|
router FQDN or, without one, for the host name and <host name>.local. If
|
||||||
redirects.
|
enabled, both also answer on their plain HTTP ports by name. Otherwise a
|
||||||
|
request by name on those ports is redirected to HTTPS; the status page stays
|
||||||
|
available over plain HTTP by address.
|
||||||
|
|
||||||
Template: linux-manager/local_id_mode
|
Template: linux-manager/local_id_mode
|
||||||
Type: select
|
Type: select
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ ANSWERS = {
|
|||||||
'LINUX_MANAGER_EXTERNAL_INTERFACE': (('interfaces', 'external'),),
|
'LINUX_MANAGER_EXTERNAL_INTERFACE': (('interfaces', 'external'),),
|
||||||
'LINUX_MANAGER_INTERNAL_INTERFACE': (('interfaces', 'internal'),),
|
'LINUX_MANAGER_INTERNAL_INTERFACE': (('interfaces', 'internal'),),
|
||||||
'LINUX_MANAGER_LOCAL_FQDN': (('wan', 'local_fqdn'),),
|
'LINUX_MANAGER_LOCAL_FQDN': (('wan', 'local_fqdn'),),
|
||||||
'LINUX_MANAGER_HTTPS_ENABLED': (('https', 'enabled'),),
|
|
||||||
'LINUX_MANAGER_HTTPS_DISABLE_AUTO_REDIRECT': (('https', 'disable_auto_redirect'),),
|
'LINUX_MANAGER_HTTPS_DISABLE_AUTO_REDIRECT': (('https', 'disable_auto_redirect'),),
|
||||||
'LINUX_MANAGER_LOCAL_ID_MODE': ((*FIRST, 'local_id_mode'),),
|
'LINUX_MANAGER_LOCAL_ID_MODE': ((*FIRST, 'local_id_mode'),),
|
||||||
'LINUX_MANAGER_LOCAL_CIDRS': (('local', 'cidrs'), (*FIRST, 'local_cidrs')),
|
'LINUX_MANAGER_LOCAL_CIDRS': (('local', 'cidrs'), (*FIRST, 'local_cidrs')),
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import os
|
|||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
import socket
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
@@ -79,7 +80,7 @@ SCHEMA = {
|
|||||||
'status_content': 'basic', 'shell': False, 'shell_idle_minutes': 15, 'shell_auth_timeout': 15,
|
'status_content': 'basic', 'shell': False, 'shell_idle_minutes': 15, 'shell_auth_timeout': 15,
|
||||||
'log_files': []},
|
'log_files': []},
|
||||||
'ssh': {'ldap_login': False},
|
'ssh': {'ldap_login': False},
|
||||||
'https': {'enabled': True, 'email': '', 'web_port': 7444, 'manager_port': 7443,
|
'https': {'email': '', 'web_port': 7444, 'manager_port': 7443, 'ip_sans': False,
|
||||||
'disable_auto_redirect': False, 'acme_staging': False, 'certificate': 'self-signed', 'self_signed_days': 365,
|
'disable_auto_redirect': False, 'acme_staging': False, 'certificate': 'self-signed', 'self_signed_days': 365,
|
||||||
'acme_provider': 'letsencrypt', 'acme_url': '', 'acme_eab_key_id': '', 'acme_eab_mac_key': '',
|
'acme_provider': 'letsencrypt', 'acme_url': '', 'acme_eab_key_id': '', 'acme_eab_mac_key': '',
|
||||||
'zerossl_api_key': ''},
|
'zerossl_api_key': ''},
|
||||||
@@ -172,8 +173,8 @@ UPLOAD_MAX_MB = 10240
|
|||||||
|
|
||||||
#: Settings that no longer exist, section -> options, left out when the file is read so that a file of an earlier
|
#: Settings that no longer exist, section -> options, left out when the file is read so that a file of an earlier
|
||||||
#: version loads: the name server is wan.local_fqdn, a site chooses the address of its records, and the CA certificates
|
#: version loads: the name server is wan.local_fqdn, a site chooses the address of its records, and the CA certificates
|
||||||
#: and CRLs are always published.
|
#: and CRLs are always published, and HTTPS is always on.
|
||||||
RETIRED = {'dns': ('nameserver', 'addresses'), 'pki': ('publish',)}
|
RETIRED = {'dns': ('nameserver', 'addresses'), 'pki': ('publish',), 'https': ('enabled',)}
|
||||||
|
|
||||||
#: The shortest and the longest dns.ttl, in seconds.
|
#: The shortest and the longest dns.ttl, in seconds.
|
||||||
DNS_TTL_RANGE = (60, 86400)
|
DNS_TTL_RANGE = (60, 86400)
|
||||||
@@ -684,19 +685,16 @@ def validate(cfg):
|
|||||||
for option in ('email', 'acme_url', 'acme_eab_key_id', 'acme_eab_mac_key', 'zerossl_api_key'):
|
for option in ('email', 'acme_url', 'acme_eab_key_id', 'acme_eab_mac_key', 'zerossl_api_key'):
|
||||||
if any(character.isspace() or character in '{}"' for character in _get(cfg, 'https', option)):
|
if any(character.isspace() or character in '{}"' for character in _get(cfg, 'https', option)):
|
||||||
raise ConfigError(f'https.{option} must not hold spaces, braces or quotes')
|
raise ConfigError(f'https.{option} must not hold spaces, braces or quotes')
|
||||||
|
if _get(cfg, 'https', 'certificate') == 'acme' and not _get(cfg, 'wan', 'local_fqdn'):
|
||||||
|
raise ConfigError('https.certificate: an ACME CA issues the certificate of wan.local_fqdn, which is not set')
|
||||||
|
|
||||||
if _get(cfg, 'oidc', 'enabled') and not (_get(cfg, 'web', 'enabled') and _get(cfg, 'https', 'enabled')
|
if _get(cfg, 'oidc', 'enabled') and not _get(cfg, 'web', 'enabled'):
|
||||||
and _get(cfg, 'wan', 'local_fqdn')):
|
|
||||||
raise ConfigError('oidc.enabled: the OpenID Provider is the web service served by Caddy at '
|
raise ConfigError('oidc.enabled: the OpenID Provider is the web service served by Caddy at '
|
||||||
'https://<wan.local_fqdn>:<https.web_port>, which needs web.enabled, https.enabled and '
|
'https://<HTTPS name>:<https.web_port>, which needs web.enabled')
|
||||||
'wan.local_fqdn')
|
|
||||||
|
|
||||||
upload_max = _get(cfg, 'sites', 'upload_max_mb')
|
upload_max = _get(cfg, 'sites', 'upload_max_mb')
|
||||||
if not 1 <= upload_max <= UPLOAD_MAX_MB:
|
if not 1 <= upload_max <= UPLOAD_MAX_MB:
|
||||||
raise ConfigError(f'sites.upload_max_mb: {upload_max} is not between 1 and {UPLOAD_MAX_MB}')
|
raise ConfigError(f'sites.upload_max_mb: {upload_max} is not between 1 and {UPLOAD_MAX_MB}')
|
||||||
if _get(cfg, 'sites', 'webdav') and not (_get(cfg, 'https', 'enabled') and _get(cfg, 'wan', 'local_fqdn')):
|
|
||||||
raise ConfigError('sites.webdav: WebDAV is served by Caddy at https://<wan.local_fqdn>:<sites.webdav_port>, '
|
|
||||||
'which needs https.enabled and wan.local_fqdn')
|
|
||||||
|
|
||||||
_check_address(_get(cfg, 'wan', 'public_address'), 'wan.public_address')
|
_check_address(_get(cfg, 'wan', 'public_address'), 'wan.public_address')
|
||||||
dns = cfg['dns']
|
dns = cfg['dns']
|
||||||
@@ -805,8 +803,6 @@ def validate(cfg):
|
|||||||
raise ConfigError(f'{prefix}.templates: {template!r} is not a template')
|
raise ConfigError(f'{prefix}.templates: {template!r} is not a template')
|
||||||
if template in ROUTER_TEMPLATES:
|
if template in ROUTER_TEMPLATES:
|
||||||
raise ConfigError(f'{prefix}.templates: {template} is issued by the P2S CA only')
|
raise ConfigError(f'{prefix}.templates: {template} is issued by the P2S CA only')
|
||||||
if authority['acme'] and not _get(cfg, 'https', 'enabled'):
|
|
||||||
raise ConfigError(f'{prefix}.acme: the ACME server is Caddy\'s, which needs https.enabled')
|
|
||||||
|
|
||||||
taken = {web_port: 'web.port', ACME_HTTP_PORT: 'the HTTP challenge',
|
taken = {web_port: 'web.port', ACME_HTTP_PORT: 'the HTTP challenge',
|
||||||
https_ports[0]: 'https.web_port', https_ports[1]: 'https.manager_port'}
|
https_ports[0]: 'https.web_port', https_ports[1]: 'https.manager_port'}
|
||||||
@@ -898,9 +894,7 @@ def validate(cfg):
|
|||||||
f'docker.exposed_ports: {item!r} is not a port or a port range')
|
f'docker.exposed_ports: {item!r} is not a port or a port range')
|
||||||
weight += 2 if ':' in item else 1
|
weight += 2 if ':' in item else 1
|
||||||
first, _, last = item.partition(':')
|
first, _, last = item.partition(':')
|
||||||
caddy_ports = (web_port, manager_port(), _get(cfg, 'metrics', 'port'),
|
caddy_ports = (web_port, manager_port(), _get(cfg, 'metrics', 'port'), ACME_HTTP_PORT, *https_ports)
|
||||||
*((ACME_HTTP_PORT, *https_ports)
|
|
||||||
if _get(cfg, 'https', 'enabled') else ()))
|
|
||||||
for port in caddy_ports:
|
for port in caddy_ports:
|
||||||
if int(first) <= port <= int(last or first):
|
if int(first) <= port <= int(last or first):
|
||||||
raise ConfigError(f'docker.exposed_ports: {item!r} takes port {port}, which Caddy serves')
|
raise ConfigError(f'docker.exposed_ports: {item!r} takes port {port}, which Caddy serves')
|
||||||
@@ -973,9 +967,10 @@ def manager_listen():
|
|||||||
|
|
||||||
|
|
||||||
def oidc_issuer(cfg):
|
def oidc_issuer(cfg):
|
||||||
"""The issuer of the OpenID Provider: the web service's HTTPS site, without the port when it is HTTPS_DEFAULT_PORT."""
|
"""The issuer of the OpenID Provider: the web service's HTTPS site on the first HTTPS name, without the port when it
|
||||||
|
is HTTPS_DEFAULT_PORT."""
|
||||||
port = _get(cfg, 'https', 'web_port')
|
port = _get(cfg, 'https', 'web_port')
|
||||||
return f'https://{_get(cfg, "wan", "local_fqdn")}' + ('' if port == HTTPS_DEFAULT_PORT else f':{port}')
|
return f'https://{https_names(cfg)[0]}' + ('' if port == HTTPS_DEFAULT_PORT else f':{port}')
|
||||||
|
|
||||||
|
|
||||||
def resolve_psk(connection, name):
|
def resolve_psk(connection, name):
|
||||||
@@ -1177,7 +1172,9 @@ def build_context(cfg, public_ip=None):
|
|||||||
'web_enabled': _get(cfg, 'web', 'enabled'),
|
'web_enabled': _get(cfg, 'web', 'enabled'),
|
||||||
'web_port': _get(cfg, 'web', 'port'),
|
'web_port': _get(cfg, 'web', 'port'),
|
||||||
'web_listen': _get(cfg, 'web', 'listen'),
|
'web_listen': _get(cfg, 'web', 'listen'),
|
||||||
'https_enabled': _get(cfg, 'https', 'enabled'),
|
'https_names': https_names(cfg),
|
||||||
|
'https_ips': https_addresses(cfg, local_addrs, int_addr),
|
||||||
|
'mdns': not local_fqdn,
|
||||||
'https_email': _get(cfg, 'https', 'email'),
|
'https_email': _get(cfg, 'https', 'email'),
|
||||||
'https_certificate': _get(cfg, 'https', 'certificate'),
|
'https_certificate': _get(cfg, 'https', 'certificate'),
|
||||||
'https_acme_provider': _get(cfg, 'https', 'acme_provider'),
|
'https_acme_provider': _get(cfg, 'https', 'acme_provider'),
|
||||||
@@ -1241,9 +1238,30 @@ def vpn_pools(ctx):
|
|||||||
(wg_ready(ctx), ctx['wg_network'])) if ready]
|
(wg_ready(ctx), ctx['wg_network'])) if ready]
|
||||||
|
|
||||||
|
|
||||||
def https_ready(ctx):
|
def https_names(cfg):
|
||||||
"""Caddy serves HTTPS once it is enabled and wan.local_fqdn names the certificate."""
|
"""The names of the server's HTTPS certificate and sites: wan.local_fqdn alone when it is set, else the host name
|
||||||
return bool(ctx['https_enabled'] and ctx['local_fqdn'])
|
and <host name>.local, which Avahi announces with mDNS."""
|
||||||
|
fqdn = _get(cfg, 'wan', 'local_fqdn').lower()
|
||||||
|
if fqdn:
|
||||||
|
return [fqdn]
|
||||||
|
host = socket.gethostname().split('.')[0].lower()
|
||||||
|
return [host, f'{host}.local']
|
||||||
|
|
||||||
|
|
||||||
|
def https_addresses(cfg, local_addrs, int_addr):
|
||||||
|
"""The IP addresses of the server's HTTPS certificate and sites while https.ip_sans is on: those of its interfaces
|
||||||
|
and wan.public_address, without link-local ones; [] while it is off."""
|
||||||
|
if not _get(cfg, 'https', 'ip_sans'):
|
||||||
|
return []
|
||||||
|
found = []
|
||||||
|
for value in (*local_addrs, int_addr, _get(cfg, 'wan', 'public_address')):
|
||||||
|
try:
|
||||||
|
address = ipaddress.ip_address(str(value).split('/')[0])
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
if not address.is_link_local and str(address) not in found:
|
||||||
|
found.append(str(address))
|
||||||
|
return found
|
||||||
|
|
||||||
|
|
||||||
def metrics_ready(ctx):
|
def metrics_ready(ctx):
|
||||||
@@ -1252,8 +1270,8 @@ def metrics_ready(ctx):
|
|||||||
|
|
||||||
|
|
||||||
def webdav_ready(ctx):
|
def webdav_ready(ctx):
|
||||||
"""WebDAV of the sites' folders is served by Caddy, on the server's own name, while it is on and HTTPS is ready."""
|
"""WebDAV of the sites' folders is served by Caddy, on the server's HTTPS names, while it is on."""
|
||||||
return bool(ctx['webdav_enabled'] and https_ready(ctx))
|
return bool(ctx['webdav_enabled'])
|
||||||
|
|
||||||
|
|
||||||
def packages_installed(packages):
|
def packages_installed(packages):
|
||||||
|
|||||||
@@ -592,11 +592,14 @@ def is_address(value):
|
|||||||
|
|
||||||
def router_identities(name, ctx):
|
def router_identities(name, ctx):
|
||||||
"""The common name and the subject alternative names of one of the server's certificates (ROUTER_CERTS): the VPN
|
"""The common name and the subject alternative names of one of the server's certificates (ROUTER_CERTS): the VPN
|
||||||
server and the HTTPS certificates name wan.local_fqdn, and the site-to-site certificate also the local identity of each
|
server certificate names wan.local_fqdn, the HTTPS certificate its HTTPS names and addresses (https_sans), and the
|
||||||
site_to_site connection with certificate authentication, the public or the internal address of its
|
site-to-site certificate wan.local_fqdn and the local identity of each site_to_site connection with certificate
|
||||||
local_id_mode; None while such an identity is not known yet."""
|
authentication, the public or the internal address of its local_id_mode; None while such an identity is not known
|
||||||
|
yet."""
|
||||||
fqdn = ctx['local_fqdn']
|
fqdn = ctx['local_fqdn']
|
||||||
if name in ('vpn-server', 'https'):
|
if name == 'https':
|
||||||
|
return https_sans(ctx)[0], https_sans(ctx)
|
||||||
|
if name == 'vpn-server':
|
||||||
return fqdn, [fqdn]
|
return fqdn, [fqdn]
|
||||||
names = [fqdn]
|
names = [fqdn]
|
||||||
for connection in ctx['connections']:
|
for connection in ctx['connections']:
|
||||||
@@ -620,7 +623,7 @@ def ensure_router_cert(connection, cfg, ctx, name, urls):
|
|||||||
return
|
return
|
||||||
subject, sans = identities
|
subject, sans = identities
|
||||||
current = holders(connection, ca, router_condition(name))
|
current = holders(connection, ca, router_condition(name))
|
||||||
wanted = {f'IP:{value}' if is_address(value) else f'DNS:{value.lower()}' for value in sans}
|
wanted = san_set(sans)
|
||||||
if current:
|
if current:
|
||||||
_, cert, _ = current[0]
|
_, cert, _ = current[0]
|
||||||
if not renewal_due(cert) and issued_by(cert, issuer['cert']) and common_name(cert) == subject and \
|
if not renewal_due(cert) and issued_by(cert, issuer['cert']) and common_name(cert) == subject and \
|
||||||
@@ -916,10 +919,21 @@ def chain_pem(chain):
|
|||||||
return b''.join(cert_pem(cert) for cert in chain)
|
return b''.join(cert_pem(cert) for cert in chain)
|
||||||
|
|
||||||
|
|
||||||
|
def https_sans(ctx):
|
||||||
|
"""The subject alternative names of the server's HTTPS certificate, the first its common name: its HTTPS names
|
||||||
|
(linuxmanager.https_names) and, while https.ip_sans is on, its addresses (linuxmanager.https_addresses)."""
|
||||||
|
return [*ctx['https_names'], *ctx['https_ips']]
|
||||||
|
|
||||||
|
|
||||||
|
def san_set(values):
|
||||||
|
"""The SAN values of a certificate (san_values) that names the DNS names and IP addresses of values name."""
|
||||||
|
return {f'IP:{value}' if is_address(value) else f'DNS:{value.lower()}' for value in values}
|
||||||
|
|
||||||
|
|
||||||
def served_certificate(connection, cfg):
|
def served_certificate(connection, cfg):
|
||||||
"""What Caddy serves for wan.local_fqdn: (served, chain, key), served being https.certificate, or self-signed while
|
"""What Caddy serves for the HTTPS names: (served, chain, key), served being https.certificate, or self-signed while
|
||||||
the chosen certificate is not available; (acme, [], None) with acme, and (None, [], None) while there is none."""
|
the chosen certificate is not available; (acme, [], None) with acme, and (None, [], None) while there is none."""
|
||||||
source, fqdn = cfg['https']['certificate'], cfg['wan']['local_fqdn'].strip().lower()
|
source, fqdn = cfg['https']['certificate'], linuxmanager.https_names(cfg)[0]
|
||||||
if source == 'acme':
|
if source == 'acme':
|
||||||
return 'acme', [], None
|
return 'acme', [], None
|
||||||
if source == 'ca':
|
if source == 'ca':
|
||||||
@@ -935,22 +949,25 @@ def served_certificate(connection, cfg):
|
|||||||
return None, [], None
|
return None, [], None
|
||||||
|
|
||||||
|
|
||||||
def ensure_host_cert(connection, cfg):
|
def ensure_host_cert(connection, cfg, ctx):
|
||||||
"""Make the self-signed certificate of wan.local_fqdn while https.certificate is self-signed, or while the chosen
|
"""Make the self-signed certificate of the HTTPS names and addresses (https_sans) while https.certificate is
|
||||||
certificate is not available, when there is none, it is due for renewal or it names another name; the notices."""
|
self-signed, or while the chosen certificate is not available, when there is none, it is due for renewal or it names
|
||||||
source, fqdn = cfg['https']['certificate'], cfg['wan']['local_fqdn'].strip().lower()
|
other names; the notices."""
|
||||||
if source == 'acme' or not cfg['https']['enabled'] or not fqdn:
|
source, sans = cfg['https']['certificate'], https_sans(ctx)
|
||||||
|
fqdn = sans[0]
|
||||||
|
if source == 'acme':
|
||||||
return []
|
return []
|
||||||
served, _, _ = served_certificate(connection, cfg)
|
served, _, _ = served_certificate(connection, cfg)
|
||||||
if served == source and served != 'self-signed':
|
if served == source and served != 'self-signed':
|
||||||
return []
|
return []
|
||||||
entry = host_entry(connection)
|
entry = host_entry(connection)
|
||||||
current = entry['chain'][0] if entry and entry['kind'] == 'self-signed' and entry['chain'] else None
|
current = entry['chain'][0] if entry and entry['kind'] == 'self-signed' and entry['chain'] else None
|
||||||
if current is None or renewal_due(current) or not usable(current, fqdn) or common_name(current) != fqdn:
|
if current is None or renewal_due(current) or not usable(current, fqdn) or common_name(current) != fqdn or \
|
||||||
|
set(san_values(current)) != san_set(sans):
|
||||||
template = linuxmanager.pki_templates(cfg)['mtls']
|
template = linuxmanager.pki_templates(cfg)['mtls']
|
||||||
key = new_key(template['key'])
|
key = new_key(template['key'])
|
||||||
cert = sign(fqdn, key.public_key(), None, key, cfg['https']['self_signed_days'],
|
cert = sign(fqdn, key.public_key(), None, key, cfg['https']['self_signed_days'],
|
||||||
leaf_extensions(cfg, template, general_names([fqdn], {'dns'})))
|
leaf_extensions(cfg, template, general_names(sans, {'dns', 'ip'})))
|
||||||
update_host(connection, {'linuxManagerCertificateChain': cert_pem(cert), 'linuxManagerPrivateKey': key_pem(key),
|
update_host(connection, {'linuxManagerCertificateChain': cert_pem(cert), 'linuxManagerPrivateKey': key_pem(key),
|
||||||
'linuxManagerKind': b'self-signed'})
|
'linuxManagerKind': b'self-signed'})
|
||||||
if source == 'self-signed':
|
if source == 'self-signed':
|
||||||
@@ -961,7 +978,7 @@ def ensure_host_cert(connection, cfg):
|
|||||||
|
|
||||||
|
|
||||||
def https_files(cfg):
|
def https_files(cfg):
|
||||||
"""The PEM chain and key Caddy serves for wan.local_fqdn, None with https.certificate acme or while there is none."""
|
"""The PEM chain and key Caddy serves for the HTTPS names, None with https.certificate acme or while there is none."""
|
||||||
with directory() as connection:
|
with directory() as connection:
|
||||||
served, chain, key = served_certificate(connection, cfg)
|
served, chain, key = served_certificate(connection, cfg)
|
||||||
if served in (None, 'acme'):
|
if served in (None, 'acme'):
|
||||||
@@ -988,14 +1005,13 @@ def https_status(cfg):
|
|||||||
|
|
||||||
|
|
||||||
def https_csr(cfg):
|
def https_csr(cfg):
|
||||||
"""Make a key and a CSR for wan.local_fqdn, to be signed by another CA, replacing a pending one: {csr} in PEM."""
|
"""Make a key and a CSR for the HTTPS names (linuxmanager.https_names), to be signed by another CA, replacing a
|
||||||
fqdn = cfg['wan']['local_fqdn'].strip().lower()
|
pending one: {csr} in PEM."""
|
||||||
if not fqdn:
|
names = linuxmanager.https_names(cfg)
|
||||||
raise Failure('the server has no wan.local_fqdn', 4)
|
|
||||||
key = new_key(linuxmanager.pki_templates(cfg)['mtls']['key'])
|
key = new_key(linuxmanager.pki_templates(cfg)['mtls']['key'])
|
||||||
request = (x509.CertificateSigningRequestBuilder()
|
request = (x509.CertificateSigningRequestBuilder()
|
||||||
.subject_name(x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, fqdn)]))
|
.subject_name(x509.Name([x509.NameAttribute(NameOID.COMMON_NAME, names[0])]))
|
||||||
.add_extension(x509.SubjectAlternativeName([x509.DNSName(fqdn)]), False)
|
.add_extension(x509.SubjectAlternativeName(general_names(names, {'dns', 'ip'})), False)
|
||||||
.sign(key, digest(key)))
|
.sign(key, digest(key)))
|
||||||
pem = request.public_bytes(serialization.Encoding.PEM)
|
pem = request.public_bytes(serialization.Encoding.PEM)
|
||||||
with directory() as connection:
|
with directory() as connection:
|
||||||
@@ -1005,8 +1021,8 @@ def https_csr(cfg):
|
|||||||
|
|
||||||
def keep_external(connection, cfg, chain, key):
|
def keep_external(connection, cfg, chain, key):
|
||||||
"""Keep an imported certificate of another CA as the server's HTTPS certificate: it must be the key's, valid now
|
"""Keep an imported certificate of another CA as the server's HTTPS certificate: it must be the key's, valid now
|
||||||
and name wan.local_fqdn; {subject, issuer, expires}."""
|
and name the first HTTPS name (linuxmanager.https_names); {subject, issuer, expires}."""
|
||||||
fqdn = cfg['wan']['local_fqdn'].strip().lower()
|
fqdn = linuxmanager.https_names(cfg)[0]
|
||||||
if cfg['https']['certificate'] != 'external':
|
if cfg['https']['certificate'] != 'external':
|
||||||
raise Failure('https.certificate is not external', 4)
|
raise Failure('https.certificate is not external', 4)
|
||||||
cert = chain[0]
|
cert = chain[0]
|
||||||
@@ -1160,11 +1176,11 @@ def provision(cfg, ctx):
|
|||||||
if not cfg['https']['certificate']:
|
if not cfg['https']['certificate']:
|
||||||
servers = authority(connection, 'servers')
|
servers = authority(connection, 'servers')
|
||||||
linuxmanager.choose_https_certificate(cfg, ctx, 'ca' if servers and servers['cert'] is not None else 'self-signed')
|
linuxmanager.choose_https_certificate(cfg, ctx, 'ca' if servers and servers['cert'] is not None else 'self-signed')
|
||||||
https_ca = cfg['https']['enabled'] and cfg['https']['certificate'] == 'ca'
|
https_ca = cfg['https']['certificate'] == 'ca'
|
||||||
for name in ROUTER_CERTS:
|
for name in ROUTER_CERTS:
|
||||||
if component_on(ROUTER_CERTS[name][0]) and (name != 'https' or https_ca):
|
if component_on(ROUTER_CERTS[name][0]) and (name != 'https' or https_ca):
|
||||||
ensure_router_cert(connection, cfg, ctx, name, urls)
|
ensure_router_cert(connection, cfg, ctx, name, urls)
|
||||||
notices.extend(ensure_host_cert(connection, cfg))
|
notices.extend(ensure_host_cert(connection, cfg, ctx))
|
||||||
publish(connection)
|
publish(connection)
|
||||||
p2s = authority(connection, 'p2s')
|
p2s = authority(connection, 'p2s')
|
||||||
missing = connection.search_s(linuxmanager_ldap.USERS, ldap.SCOPE_ONELEVEL,
|
missing = connection.search_s(linuxmanager_ldap.USERS, ldap.SCOPE_ONELEVEL,
|
||||||
@@ -1589,7 +1605,7 @@ def maintain(cfg):
|
|||||||
|
|
||||||
def acme_url(cfg, name):
|
def acme_url(cfg, name):
|
||||||
"""The ACME directory of an issuing CA served by Caddy's ACME server."""
|
"""The ACME directory of an issuing CA served by Caddy's ACME server."""
|
||||||
return f'https://{cfg["wan"]["local_fqdn"].strip()}:{cfg["https"]["web_port"]}/acme/{name}/directory'
|
return f'https://{linuxmanager.https_names(cfg)[0]}:{cfg["https"]["web_port"]}/acme/{name}/directory'
|
||||||
|
|
||||||
|
|
||||||
def status(cfg):
|
def status(cfg):
|
||||||
@@ -1691,7 +1707,7 @@ def status(cfg):
|
|||||||
if utc(cert, 'not_valid_after') <= soon:
|
if utc(cert, 'not_valid_after') <= soon:
|
||||||
warnings.append(f'the server certificate {common_name(cert)} expires on {iso(utc(cert, "not_valid_after"))}')
|
warnings.append(f'the server certificate {common_name(cert)} expires on {iso(utc(cert, "not_valid_after"))}')
|
||||||
https_source = cfg['https']['certificate']
|
https_source = cfg['https']['certificate']
|
||||||
if cfg['https']['enabled'] and https_source != 'acme':
|
if https_source != 'acme':
|
||||||
if served != https_source:
|
if served != https_source:
|
||||||
warnings.append(f'the HTTPS certificate is {"self-signed" if served else "missing"} until the https.certificate '
|
warnings.append(f'the HTTPS certificate is {"self-signed" if served else "missing"} until the https.certificate '
|
||||||
f'{https_source} certificate is available')
|
f'{https_source} certificate is available')
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import linuxmanager_pki
|
|||||||
from .common import PKI_STATUS, section_change
|
from .common import PKI_STATUS, section_change
|
||||||
|
|
||||||
#: The settings of the https section PUT /https/settings changes.
|
#: The settings of the https section PUT /https/settings changes.
|
||||||
CHANGEABLE = ('acme_staging', 'certificate', 'self_signed_days', 'acme_provider', 'acme_url', 'acme_eab_key_id',
|
CHANGEABLE = ('acme_staging', 'certificate', 'self_signed_days', 'ip_sans', 'acme_provider', 'acme_url', 'acme_eab_key_id',
|
||||||
'acme_eab_mac_key', 'zerossl_api_key')
|
'acme_eab_mac_key', 'zerossl_api_key')
|
||||||
|
|
||||||
#: The secrets of the https section, which the answers give as <name>_set instead.
|
#: The secrets of the https section, which the answers give as <name>_set instead.
|
||||||
@@ -34,7 +34,7 @@ def https(method, path, body):
|
|||||||
server's HTTPS certificate (linuxmanager_pki.https_status)
|
server's HTTPS certificate (linuxmanager_pki.https_status)
|
||||||
PUT /https/settings change any of CHANGEABLE; the other settings of the section are changed on the server
|
PUT /https/settings change any of CHANGEABLE; the other settings of the section are changed on the server
|
||||||
with linux-manager-config-edit, and a body naming one is 400
|
with linux-manager-config-edit, and a body naming one is 400
|
||||||
POST /https/csr make a key and a CSR for wan.local_fqdn: {"csr"}
|
POST /https/csr make a key and a CSR for the HTTPS names: {"csr"}
|
||||||
PUT /https/certificate take the certificate another CA signed for the CSR, PEM with its chain: {"certificate"}
|
PUT /https/certificate take the certificate another CA signed for the CSR, PEM with its chain: {"certificate"}
|
||||||
PUT /https/pfx take a PKCS#12 file of another CA's certificate: {"pfx" in base64, "password"}
|
PUT /https/pfx take a PKCS#12 file of another CA's certificate: {"pfx" in base64, "password"}
|
||||||
|
|
||||||
|
|||||||
@@ -80,9 +80,15 @@ CADDY_PKI_DIR = pathlib.Path('/etc/caddy/linux-manager-pki')
|
|||||||
#: The certificates and keys of the sites of tls file, <site>/cert.pem and key.pem.
|
#: The certificates and keys of the sites of tls file, <site>/cert.pem and key.pem.
|
||||||
CADDY_SITES_DIR = pathlib.Path('/etc/caddy/linux-manager-sites')
|
CADDY_SITES_DIR = pathlib.Path('/etc/caddy/linux-manager-sites')
|
||||||
|
|
||||||
#: The certificate and key of wan.local_fqdn Caddy serves when they come from no ACME CA.
|
#: The certificate and key of the HTTPS names Caddy serves when they come from no ACME CA.
|
||||||
CADDY_HTTPS_DIR = pathlib.Path('/etc/caddy/linux-manager-https')
|
CADDY_HTTPS_DIR = pathlib.Path('/etc/caddy/linux-manager-https')
|
||||||
|
|
||||||
|
#: The units of Avahi, which announces <host name>.local with mDNS while wan.local_fqdn is not set.
|
||||||
|
AVAHI_UNITS = ('avahi-daemon.socket', 'avahi-daemon.service')
|
||||||
|
|
||||||
|
#: The UDP port of mDNS.
|
||||||
|
MDNS_PORT = 5353
|
||||||
|
|
||||||
#: The unit of dnsmasq, the resolver of the remote access clients.
|
#: The unit of dnsmasq, the resolver of the remote access clients.
|
||||||
RESOLVER_UNIT = 'linux-manager-resolver.service'
|
RESOLVER_UNIT = 'linux-manager-resolver.service'
|
||||||
|
|
||||||
@@ -122,6 +128,7 @@ BLOCKS = (
|
|||||||
('# BOOTSTRAP RULES START', '# BOOTSTRAP RULES END'),
|
('# BOOTSTRAP RULES START', '# BOOTSTRAP RULES END'),
|
||||||
('# MANAGER RULES START', '# MANAGER RULES END'),
|
('# MANAGER RULES START', '# MANAGER RULES END'),
|
||||||
('# HTTPS RULES START', '# HTTPS RULES END'),
|
('# HTTPS RULES START', '# HTTPS RULES END'),
|
||||||
|
('# MDNS RULES START', '# MDNS RULES END'),
|
||||||
('# METRICS RULES START', '# METRICS RULES END'),
|
('# METRICS RULES START', '# METRICS RULES END'),
|
||||||
('# SITES RULES START', '# SITES RULES END'),
|
('# SITES RULES START', '# SITES RULES END'),
|
||||||
('# DNS RULES START', '# DNS RULES END'),
|
('# DNS RULES START', '# DNS RULES END'),
|
||||||
@@ -200,19 +207,6 @@ def strip_blocks(text):
|
|||||||
return ''.join(out)
|
return ''.join(out)
|
||||||
|
|
||||||
|
|
||||||
def is_configured(ctx):
|
|
||||||
"""True once any feature is actually configured: routing, a VPN system, or a listener of the core.
|
|
||||||
|
|
||||||
While nothing is configured the package leaves the firewall alone: an
|
|
||||||
install that has not been filled in yet must not start blocking traffic on
|
|
||||||
a host that was working before.
|
|
||||||
"""
|
|
||||||
return any((linuxmanager.s2s_ready(ctx), linuxmanager.routing_ready(ctx),
|
|
||||||
linuxmanager.p2s_ready(ctx), linuxmanager.wg_ready(ctx),
|
|
||||||
linuxmanager.openvpn_ready(ctx), ctx['web_enabled'], linuxmanager.https_ready(ctx),
|
|
||||||
linuxmanager.metrics_ready(ctx), linuxmanager.dns_ready(ctx), bool(ctx['sites'])))
|
|
||||||
|
|
||||||
|
|
||||||
def filter_block(ctx):
|
def filter_block(ctx):
|
||||||
lines = []
|
lines = []
|
||||||
|
|
||||||
@@ -277,6 +271,11 @@ def filter_block(ctx):
|
|||||||
if ctx['web_enabled']:
|
if ctx['web_enabled']:
|
||||||
lines += ['', '# WEB RULES START', *opened(ctx['web_listen'], ctx['web_port']), '# WEB RULES END']
|
lines += ['', '# WEB RULES START', *opened(ctx['web_listen'], ctx['web_port']), '# WEB RULES END']
|
||||||
|
|
||||||
|
# Without wan.local_fqdn, Avahi answers mDNS queries for <host name>.local on the internal side.
|
||||||
|
if ctx['mdns'] and internal:
|
||||||
|
lines += ['', '# MDNS RULES START', f'-A ufw-before-input -i {internal} -p udp --dport {MDNS_PORT} -j ACCEPT',
|
||||||
|
'# MDNS RULES END']
|
||||||
|
|
||||||
if not SETUP_DONE.exists() and ctx['int_iface']:
|
if not SETUP_DONE.exists() and ctx['int_iface']:
|
||||||
lines += [
|
lines += [
|
||||||
'',
|
'',
|
||||||
@@ -295,7 +294,7 @@ def filter_block(ctx):
|
|||||||
|
|
||||||
# The ACME CA reaches the HTTP challenge on the external interface while it issues the server's certificate; the
|
# The ACME CA reaches the HTTP challenge on the external interface while it issues the server's certificate; the
|
||||||
# HTTPS ports are open on both.
|
# HTTPS ports are open on both.
|
||||||
if linuxmanager.https_ready(ctx) and interfaces:
|
if interfaces:
|
||||||
ports = [port for wanted, port in ((ctx['web_enabled'] or ctx['pki_acme'], ctx['https_web_port']),
|
ports = [port for wanted, port in ((ctx['web_enabled'] or ctx['pki_acme'], ctx['https_web_port']),
|
||||||
(True, ctx['https_manager_port']),
|
(True, ctx['https_manager_port']),
|
||||||
(linuxmanager.metrics_ready(ctx), ctx['metrics_https_port']),
|
(linuxmanager.metrics_ready(ctx), ctx['metrics_https_port']),
|
||||||
@@ -431,17 +430,6 @@ def setup_ufw(ctx):
|
|||||||
if not BEFORE_RULES.is_file():
|
if not BEFORE_RULES.is_file():
|
||||||
fail(f'{BEFORE_RULES} does not exist')
|
fail(f'{BEFORE_RULES} does not exist')
|
||||||
|
|
||||||
# Nothing configured: remove anything left from an earlier configuration
|
|
||||||
# and touch nothing else.
|
|
||||||
if not is_configured(ctx):
|
|
||||||
original = BEFORE_RULES.read_text(encoding='utf-8')
|
|
||||||
text = strip_blocks(original)
|
|
||||||
if text == original:
|
|
||||||
return False
|
|
||||||
BEFORE_RULES.write_text(text, encoding='utf-8')
|
|
||||||
remove_stale_nat(original, text)
|
|
||||||
return True
|
|
||||||
|
|
||||||
if UFW_DEFAULTS.is_file():
|
if UFW_DEFAULTS.is_file():
|
||||||
text = UFW_DEFAULTS.read_text(encoding='utf-8')
|
text = UFW_DEFAULTS.read_text(encoding='utf-8')
|
||||||
updated = ''.join(
|
updated = ''.join(
|
||||||
@@ -728,6 +716,16 @@ def caddy_address(host, port, tls):
|
|||||||
return f'{"http://" if tls == "none" else ""}{host}:{port}'
|
return f'{"http://" if tls == "none" else ""}{host}:{port}'
|
||||||
|
|
||||||
|
|
||||||
|
def manage_mdns(ctx):
|
||||||
|
"""Run Avahi, which announces <host name>.local, one of the HTTPS names, with mDNS, while wan.local_fqdn is not set,
|
||||||
|
and stop it while it is."""
|
||||||
|
active = unit_is_active(AVAHI_UNITS[1])
|
||||||
|
if ctx['mdns'] and not active:
|
||||||
|
run(['systemctl', 'enable', '--now', *AVAHI_UNITS], check=False)
|
||||||
|
elif not ctx['mdns'] and active:
|
||||||
|
run(['systemctl', 'disable', '--now', *AVAHI_UNITS], check=False)
|
||||||
|
|
||||||
|
|
||||||
def manage_resolver(changed):
|
def manage_resolver(changed):
|
||||||
"""Run dnsmasq, the resolver of the remote access clients, while configure wrote its configuration, restarting it when
|
"""Run dnsmasq, the resolver of the remote access clients, while configure wrote its configuration, restarting it when
|
||||||
that changed, and stop it when not. It starts after systemd-resolved has left the addresses it takes."""
|
that changed, and stop it when not. It starts after systemd-resolved has left the addresses it takes."""
|
||||||
@@ -745,11 +743,14 @@ def manage_caddy(cfg, ctx):
|
|||||||
"""Run Caddy, a dependency of the package, which serves every HTTP and HTTPS port of the server's services and the
|
"""Run Caddy, a dependency of the package, which serves every HTTP and HTTPS port of the server's services and the
|
||||||
web sites; the services listen on loopback only.
|
web sites; the services listen on loopback only.
|
||||||
|
|
||||||
CADDYFILE serves over plain HTTP the web service on web.port while it is enabled, the manager on its port, or a
|
CADDYFILE serves over plain HTTP the web service on web.port while it is enabled and the manager on its port, and
|
||||||
redirect (308) to its HTTPS address while HTTPS is ready and https.disable_auto_redirect is off, and while metrics
|
while metrics are enabled the metrics service on metrics.port. While https.disable_auto_redirect is off, a request
|
||||||
are enabled the metrics service on metrics.port. While HTTPS is ready, it serves the web service on
|
of the web service for an HTTPS host is redirected (308) to https.web_port, and every request of the manager to
|
||||||
https.web_port, the manager on https.manager_port, while metrics are enabled the metrics service on
|
https.manager_port, on the host it named when that is an HTTPS host, else on the first HTTPS name. It serves the
|
||||||
metrics.https_port, and while WebDAV is ready WebDAV on sites.webdav_port, all for wan.local_fqdn. Every site calls
|
web service on https.web_port, the manager on https.manager_port, while metrics are enabled the metrics service on
|
||||||
|
metrics.https_port, and while WebDAV is ready WebDAV on sites.webdav_port, all for the HTTPS hosts: the HTTPS names
|
||||||
|
(linuxmanager.https_names) and, with https.ip_sans and a certificate of its own, the addresses its certificate
|
||||||
|
names; a client without SNI gets the certificate of the first HTTPS name. Every site calls
|
||||||
its service on its loopback port. The certificate comes from the ACME CA of https.acme_provider, the global issuer,
|
its service on its loopback port. The certificate comes from the ACME CA of https.acme_provider, the global issuer,
|
||||||
with https.certificate acme, and otherwise is the one linuxmanager_pki.https_files gives, written to
|
with https.certificate acme, and otherwise is the one linuxmanager_pki.https_files gives, written to
|
||||||
CADDY_HTTPS_DIR; while that cannot be read, the HTTPS sites are left out, so that no ACME CA is asked for it. It
|
CADDY_HTTPS_DIR; while that cannot be read, the HTTPS sites are left out, so that no ACME CA is asked for it. It
|
||||||
@@ -774,7 +775,7 @@ def manage_caddy(cfg, ctx):
|
|||||||
group = grp.getgrnam(CADDY_GROUP).gr_gid
|
group = grp.getgrnam(CADDY_GROUP).gr_gid
|
||||||
except KeyError:
|
except KeyError:
|
||||||
fail(f'the group {CADDY_GROUP} does not exist; is the caddy package installed?')
|
fail(f'the group {CADDY_GROUP} does not exist; is the caddy package installed?')
|
||||||
https = linuxmanager.https_ready(ctx)
|
https = True
|
||||||
own = None
|
own = None
|
||||||
if https and cfg['https']['certificate'] != 'acme':
|
if https and cfg['https']['certificate'] != 'acme':
|
||||||
try:
|
try:
|
||||||
@@ -832,8 +833,12 @@ def manage_caddy(cfg, ctx):
|
|||||||
os.chown(folder / file, 0, group)
|
os.chown(folder / file, 0, group)
|
||||||
linuxmanager_sites.ensure_folders(site['name'] for site in sites)
|
linuxmanager_sites.ensure_folders(site['name'] for site in sites)
|
||||||
names = linuxmanager.issuing_cas(cfg)
|
names = linuxmanager.issuing_cas(cfg)
|
||||||
|
hosts = [*ctx['https_names'], *(ctx['https_ips'] if own is not None else [])]
|
||||||
caddy_ctx = dict(ctx, https=https, manager_port=linuxmanager.manager_port(),
|
caddy_ctx = dict(ctx, https=https, manager_port=linuxmanager.manager_port(),
|
||||||
redirect=https and not cfg['https']['disable_auto_redirect'],
|
redirect=https and not cfg['https']['disable_auto_redirect'],
|
||||||
|
https_name=ctx['https_names'][0],
|
||||||
|
https_hosts=[f'[{host}]' if ':' in host else host for host in hosts],
|
||||||
|
redirect_hosts=[host for host in hosts if ':' not in host],
|
||||||
web_loopback_port=linuxmanager.WEB_LOOPBACK_PORT,
|
web_loopback_port=linuxmanager.WEB_LOOPBACK_PORT,
|
||||||
manager_loopback_port=linuxmanager.MANAGER_LOOPBACK_PORT,
|
manager_loopback_port=linuxmanager.MANAGER_LOOPBACK_PORT,
|
||||||
metrics_loopback_port=linuxmanager.METRICS_LOOPBACK_PORT,
|
metrics_loopback_port=linuxmanager.METRICS_LOOPBACK_PORT,
|
||||||
@@ -1043,6 +1048,8 @@ def refresh_web(cfg, ctx):
|
|||||||
'external_addresses': ctx['local_addr_list'],
|
'external_addresses': ctx['local_addr_list'],
|
||||||
'internal_address': ctx['int_addr'],
|
'internal_address': ctx['int_addr'],
|
||||||
'internal_gateway': ctx['int_gateway_ip'],
|
'internal_gateway': ctx['int_gateway_ip'],
|
||||||
|
'https_names': ctx['https_names'],
|
||||||
|
'https_addresses': ctx['https_ips'],
|
||||||
'local_cidrs': ctx['local_cidr_list'],
|
'local_cidrs': ctx['local_cidr_list'],
|
||||||
'client_dns': ctx['p2s_resolver_addrs'] if linuxmanager.RESOLVER_CONF.exists() else [],
|
'client_dns': ctx['p2s_resolver_addrs'] if linuxmanager.RESOLVER_CONF.exists() else [],
|
||||||
'site_to_site': [{
|
'site_to_site': [{
|
||||||
@@ -1095,6 +1102,9 @@ def main():
|
|||||||
f'set general.platform in {linuxmanager.CONFIG_FILE}')
|
f'set general.platform in {linuxmanager.CONFIG_FILE}')
|
||||||
progress('deferred', 'configuration', f'general.platform is none; set it in {linuxmanager.CONFIG_FILE}')
|
progress('deferred', 'configuration', f'general.platform is none; set it in {linuxmanager.CONFIG_FILE}')
|
||||||
return 0
|
return 0
|
||||||
|
# Until a run has succeeded, a file that names no HTTPS certificate source leaves the choice to this run.
|
||||||
|
if not SETUP_DONE.exists() and not linuxmanager.read_settings().get('https', {}).get('certificate'):
|
||||||
|
cfg['https']['certificate'] = ''
|
||||||
|
|
||||||
# The directory holds the PKI, which the configuration needs; its problem ends setup only after every other step.
|
# The directory holds the PKI, which the configuration needs; its problem ends setup only after every other step.
|
||||||
failed_step = 'user directory'
|
failed_step = 'user directory'
|
||||||
@@ -1133,16 +1143,13 @@ def main():
|
|||||||
|
|
||||||
progress('running', 'firewall')
|
progress('running', 'firewall')
|
||||||
rules_changed = setup_ufw(ctx)
|
rules_changed = setup_ufw(ctx)
|
||||||
if is_configured(ctx):
|
status = run(['ufw', 'status'], check=False)
|
||||||
status = run(['ufw', 'status'], check=False)
|
if not status.stdout.startswith('Status: active'):
|
||||||
if not status.stdout.startswith('Status: active'):
|
# Only ever enable the firewall after making sure SSH survives it.
|
||||||
# Only ever enable the firewall after making sure SSH survives it.
|
run(['ufw', 'allow', '22/tcp'], check=False)
|
||||||
run(['ufw', 'allow', '22/tcp'], check=False)
|
run(['ufw', '--force', 'enable'])
|
||||||
run(['ufw', '--force', 'enable'])
|
|
||||||
elif rules_changed:
|
|
||||||
run(['ufw', 'reload'])
|
|
||||||
elif rules_changed:
|
elif rules_changed:
|
||||||
run(['ufw', 'reload'], check=False)
|
run(['ufw', 'reload'])
|
||||||
|
|
||||||
progress('running', 'strongSwan')
|
progress('running', 'strongSwan')
|
||||||
manage_strongswan(ctx, changed)
|
manage_strongswan(ctx, changed)
|
||||||
@@ -1165,6 +1172,8 @@ def main():
|
|||||||
manage_openvpn(ctx, changed)
|
manage_openvpn(ctx, changed)
|
||||||
progress('running', 'HTTPS proxy')
|
progress('running', 'HTTPS proxy')
|
||||||
manage_caddy(cfg, ctx)
|
manage_caddy(cfg, ctx)
|
||||||
|
progress('running', 'mDNS')
|
||||||
|
manage_mdns(ctx)
|
||||||
progress('running', 'WebDAV')
|
progress('running', 'WebDAV')
|
||||||
manage_webdav(ctx)
|
manage_webdav(ctx)
|
||||||
progress('running', 'name server')
|
progress('running', 'name server')
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
# Written by linux-manager-setup from /etc/linux-manager/linux-manager.json and the web sites; edits are overwritten.
|
# Written by linux-manager-setup from /etc/linux-manager/linux-manager.json and the web sites; edits are overwritten.
|
||||||
{
|
{
|
||||||
auto_https disable_redirects
|
auto_https disable_redirects
|
||||||
|
{%- if https_tls %}
|
||||||
|
default_sni {{ https_name }}
|
||||||
|
{%- endif %}
|
||||||
{%- if https_email %}
|
{%- if https_email %}
|
||||||
email {{ https_email }}
|
email {{ https_email }}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
@@ -44,10 +47,18 @@
|
|||||||
file_server
|
file_server
|
||||||
}
|
}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
{#- The addresses of an HTTPS site on port: the HTTPS hosts. #}
|
||||||
|
{%- macro https_site(port) %}{% for host in https_hosts %}{{ host }}:{{ port }}{{ ', ' if not loop.last else '' }}{% endfor %}{% endmacro %}
|
||||||
{% if web_enabled %}
|
{% if web_enabled %}
|
||||||
http://:{{ web_port }} {
|
http://:{{ web_port }} {
|
||||||
header -Server
|
header -Server
|
||||||
{{- pki_files(pki_publish_dir) }}
|
{{- pki_files(pki_publish_dir) }}
|
||||||
|
{%- if redirect %}
|
||||||
|
@https host {{ redirect_hosts | join(' ') }}
|
||||||
|
handle @https {
|
||||||
|
redir https://{host}:{{ https_web_port }}{uri} 308
|
||||||
|
}
|
||||||
|
{%- endif %}
|
||||||
handle {
|
handle {
|
||||||
reverse_proxy {{ loopback }}:{{ web_loopback_port }} {
|
reverse_proxy {{ loopback }}:{{ web_loopback_port }} {
|
||||||
header_down -Server
|
header_down -Server
|
||||||
@@ -58,9 +69,15 @@ http://:{{ web_port }} {
|
|||||||
http://:{{ manager_port }} {
|
http://:{{ manager_port }} {
|
||||||
header -Server
|
header -Server
|
||||||
{{- pki_files(pki_publish_dir) }}
|
{{- pki_files(pki_publish_dir) }}
|
||||||
|
{%- if redirect %}
|
||||||
|
@https host {{ redirect_hosts | join(' ') }}
|
||||||
|
handle @https {
|
||||||
|
redir https://{host}:{{ https_manager_port }}{uri} 308
|
||||||
|
}
|
||||||
|
{%- endif %}
|
||||||
handle {
|
handle {
|
||||||
{%- if redirect %}
|
{%- if redirect %}
|
||||||
redir https://{{ local_fqdn }}:{{ https_manager_port }}{uri} 308
|
redir https://{{ https_name }}:{{ https_manager_port }}{uri} 308
|
||||||
{%- else %}
|
{%- else %}
|
||||||
reverse_proxy {{ loopback }}:{{ manager_loopback_port }} {
|
reverse_proxy {{ loopback }}:{{ manager_loopback_port }} {
|
||||||
header_down -Server
|
header_down -Server
|
||||||
@@ -77,7 +94,7 @@ http://:{{ metrics_port }} {
|
|||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- if https and (web_enabled or acme_cas) %}
|
{%- if https and (web_enabled or acme_cas) %}
|
||||||
{{ local_fqdn }}:{{ https_web_port }} {
|
{{ https_site(https_web_port) }} {
|
||||||
header -Server
|
header -Server
|
||||||
{%- if https_tls %}
|
{%- if https_tls %}
|
||||||
tls {{ https_tls.cert }} {{ https_tls.key }}
|
tls {{ https_tls.cert }} {{ https_tls.key }}
|
||||||
@@ -102,7 +119,7 @@ http://:{{ metrics_port }} {
|
|||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- if https %}
|
{%- if https %}
|
||||||
{{ local_fqdn }}:{{ https_manager_port }} {
|
{{ https_site(https_manager_port) }} {
|
||||||
header -Server
|
header -Server
|
||||||
{%- if https_tls %}
|
{%- if https_tls %}
|
||||||
tls {{ https_tls.cert }} {{ https_tls.key }}
|
tls {{ https_tls.cert }} {{ https_tls.key }}
|
||||||
@@ -116,7 +133,7 @@ http://:{{ metrics_port }} {
|
|||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- if https and metrics_enabled %}
|
{%- if https and metrics_enabled %}
|
||||||
{{ local_fqdn }}:{{ metrics_https_port }} {
|
{{ https_site(metrics_https_port) }} {
|
||||||
header -Server
|
header -Server
|
||||||
{%- if https_tls %}
|
{%- if https_tls %}
|
||||||
tls {{ https_tls.cert }} {{ https_tls.key }}
|
tls {{ https_tls.cert }} {{ https_tls.key }}
|
||||||
@@ -127,7 +144,7 @@ http://:{{ metrics_port }} {
|
|||||||
}
|
}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{%- if webdav %}
|
{%- if webdav %}
|
||||||
{{ local_fqdn }}:{{ webdav_port }} {
|
{{ https_site(webdav_port) }} {
|
||||||
header -Server
|
header -Server
|
||||||
{%- if https_tls %}
|
{%- if https_tls %}
|
||||||
tls {{ https_tls.cert }} {{ https_tls.key }}
|
tls {{ https_tls.cert }} {{ https_tls.key }}
|
||||||
|
|||||||
+11
-7
@@ -16,8 +16,8 @@ Issue and Settings are on every tab but Server.
|
|||||||
|
|
||||||
## Tabs
|
## Tabs
|
||||||
|
|
||||||
- **Server:** the first tab, shown also while the PKI cannot be read: HTTPS and the name it is
|
- **Server:** the first tab, shown also while the PKI cannot be read: HTTPS and the names and
|
||||||
for, with a chip while the server's certificate has a source other than ACME, and a settings
|
addresses it is for, with a chip while the server's certificate has a source other than ACME, and a settings
|
||||||
button; the server's certificate, when it is not ACME's, with its issuer and expiry; the ACME
|
button; the server's certificate, when it is not ACME's, with its issuer and expiry; the ACME
|
||||||
CA, with a chip while it is Let's Encrypt's staging environment, and a settings button (see
|
CA, with a chip while it is Let's Encrypt's staging environment, and a settings button (see
|
||||||
Server HTTPS below); and Caddy, which serves every HTTP and HTTPS port of the server, with its
|
Server HTTPS below); and Caddy, which serves every HTTP and HTTPS port of the server, with its
|
||||||
@@ -47,15 +47,19 @@ Issue and Settings are on every tab but Server.
|
|||||||
## Server HTTPS
|
## Server HTTPS
|
||||||
|
|
||||||
The settings button of the HTTPS row sets the **certificate of the server**: ACME; self-signed,
|
The settings button of the HTTPS row sets the **certificate of the server**: ACME; self-signed,
|
||||||
with its validity in days; the Servers Issuing CA of the server's PKI; or another CA. Until the
|
with its validity in days; the Servers Issuing CA of the server's PKI; or another CA. Without
|
||||||
chosen certificate is available, the server serves a self-signed one and warns.
|
ACME, a checkbox also names the server's IP addresses in the certificate, to reach it over HTTPS
|
||||||
|
by address. Until the chosen certificate is available, the server serves a self-signed one and warns.
|
||||||
|
|
||||||
The source is self-signed unless the configuration names another; ACME is used only when it is
|
The source is self-signed unless the configuration names another; ACME is used only when it is
|
||||||
chosen. The first setup of a new installation chooses the Servers Issuing CA when the root CA and
|
chosen. The first setup of a new installation chooses the Servers Issuing CA when the root CA and
|
||||||
that CA are available, as with a root the server creates, else self-signed.
|
that CA are available, as with a root the server creates, else self-signed; it does so also when
|
||||||
While HTTPS is on, the Manager's plain HTTP address redirects to its HTTPS address, unless the
|
the configuration it is given names no source.
|
||||||
|
HTTPS is always on, for `wan.local_fqdn` or, without it, the host name and `<host name>.local`;
|
||||||
|
with `https.ip_sans` the certificate also names the server's addresses. A plain HTTP request for
|
||||||
|
those names is redirected to HTTPS, on the status page's port and the Manager's, unless the
|
||||||
installer's `https_disable_auto_redirect` or `https.disable_auto_redirect` says otherwise; the
|
installer's `https_disable_auto_redirect` or `https.disable_auto_redirect` says otherwise; the
|
||||||
status page never redirects.
|
status page stays on plain HTTP by address, and `/pki/` on plain HTTP always.
|
||||||
|
|
||||||
The settings button of the ACME CA row sets the ACME CA of the server's certificate with ACME, and
|
The settings button of the ACME CA row sets the ACME CA of the server's certificate with ACME, and
|
||||||
of the web sites with TLS ACME: Let's Encrypt, with **Staging environment** for routers rebuilt
|
of the web sites with TLS ACME: Let's Encrypt, with **Staging environment** for routers rebuilt
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ their password and, when enrolled, the code.
|
|||||||
- The eye opens the device's configuration; the download gives `<user>-<n>.conf`, with a
|
- The eye opens the device's configuration; the download gives `<user>-<n>.conf`, with a
|
||||||
placeholder for the device's private key, which the server never has.
|
placeholder for the device's private key, which the server never has.
|
||||||
- The remove button removes a peer after a confirmation.
|
- The remove button removes a peer after a confirmation.
|
||||||
- **Server:** the server's public key with a copy icon, the endpoint and the allowed IPs a device
|
- **Server:** the server's public key with a copy icon on a page opened over HTTPS, the endpoint
|
||||||
needs; **Show config** opens a device configuration with placeholders.
|
and the allowed IPs a device needs; **Show config** opens a device configuration with
|
||||||
|
placeholders, with a Copy button over HTTPS.
|
||||||
- In the configuration dialogs a switch leaves out the `[Interface]` and `PrivateKey` lines, which
|
- In the configuration dialogs a switch leaves out the `[Interface]` and `PrivateKey` lines, which
|
||||||
WireGuard for Windows fills in for a new empty tunnel.
|
WireGuard for Windows fills in for a new empty tunnel.
|
||||||
+5
-3
@@ -11,9 +11,11 @@ The Overview tab shows the state of the server, read every 10 seconds by default
|
|||||||
IKEv2, OpenVPN and WireGuard; and the status web service and its port.
|
IKEv2, OpenVPN and WireGuard; and the status web service and its port.
|
||||||
- **Services:** the state of each of the server's systemd services and of Caddy; the chip on the
|
- **Services:** the state of each of the server's systemd services and of Caddy; the chip on the
|
||||||
title bar tells whether the server's services are active.
|
title bar tells whether the server's services are active.
|
||||||
- **Addresses:** links to the status page over HTTPS and over plain HTTP, and to the
|
- **Addresses:** links to the status page and the Manager over HTTPS for the server's names (and
|
||||||
Manager over HTTPS, each opening in a new tab; and the issuer and the discovery URL of the
|
its addresses with `https.ip_sans`), and over plain HTTP: the status page by address, and both
|
||||||
server's OpenID Provider, each with a copy icon, or off while the provider is disabled (see
|
by name and the Manager by address too while the redirect to HTTPS is off; each opens in a new
|
||||||
|
tab. Then the issuer and the discovery URL of the server's OpenID Provider, each with a copy
|
||||||
|
icon over HTTPS, or off while the provider is disabled (see
|
||||||
[Service accounts](service-accounts.md#openid-provider)).
|
[Service accounts](service-accounts.md#openid-provider)).
|
||||||
- **Backup:** the result of the last run, the next run and Run now (see [Backup](backup.md)).
|
- **Backup:** the result of the last run, the next run and Run now (see [Backup](backup.md)).
|
||||||
- **PostgreSQL:** each cluster with its main settings and its databases with their sizes.
|
- **PostgreSQL:** each cluster with its main settings and its databases with their sizes.
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ Collector reading the server's metrics. They cannot sign in to the Manager.
|
|||||||
## OpenID Provider
|
## OpenID Provider
|
||||||
|
|
||||||
The server can sign its users in to other systems with OpenID Connect. Its issuer and discovery
|
The server can sign its users in to other systems with OpenID Connect. Its issuer and discovery
|
||||||
URL are on the Addresses panel of the [Overview](router.md), each with a copy icon, and while it is
|
URL are on the Addresses panel of the [Overview](router.md), each with a copy icon on a page
|
||||||
enabled the title of the list has the number of its clients. It is turned on on the server as
|
opened over HTTPS, and while it is enabled the title of the list has the number of its clients.
|
||||||
root:
|
It is turned on on the server as root:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
linux-manager-config-edit set --restart oidc.enabled true
|
linux-manager-config-edit set --restart oidc.enabled true
|
||||||
|
|||||||
+2
-2
@@ -8,8 +8,8 @@ and the name server of their domain on the [DNS](dns.md) page.
|
|||||||
|
|
||||||
- **State:** whether the sites are served.
|
- **State:** whether the sites are served.
|
||||||
- **Largest upload:** the largest file or zip archive the Files tab and the server's API take.
|
- **Largest upload:** the largest file or zip archive the Files tab and the server's API take.
|
||||||
- **WebDAV:** whether the folders are served over WebDAV, and its URL with a copy icon. WebDAV is
|
- **WebDAV:** whether the folders are served over WebDAV, and its URL with a copy icon over HTTPS.
|
||||||
switched on the [System](system.md) tab, which installs rclone.
|
WebDAV is switched on the [System](system.md) tab, which installs rclone.
|
||||||
|
|
||||||
**Settings** edits the state, the largest upload and the WebDAV port.
|
**Settings** edits the state, the largest upload and the WebDAV port.
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,8 @@ The configurations in `configs/` have placeholders that are filled in for each s
|
|||||||
|
|
||||||
- `@PSK@`: the pre-shared key, filled in on the Mac; the file reaches the server through the Vault;
|
- `@PSK@`: the pre-shared key, filled in on the Mac; the file reaches the server through the Vault;
|
||||||
- `@ETH0@` and `@ETH1@`: the names of its interfaces;
|
- `@ETH0@` and `@ETH1@`: the names of its interfaces;
|
||||||
- `@CIDR0@`: the network of its first address.
|
- `@CIDR0@`: the network of its first address;
|
||||||
|
- `@FQDN@`: in `dev.json`, the name of the dev VM, `--fqdn` of `lm-dev-vm.py`.
|
||||||
|
|
||||||
## Secrets
|
## Secrets
|
||||||
|
|
||||||
@@ -115,7 +116,8 @@ default, such as `LXD_REMOTE`, is required: without its option, the script stops
|
|||||||
{
|
{
|
||||||
"LXD_REMOTE": "my-remote",
|
"LXD_REMOTE": "my-remote",
|
||||||
"LXD_POOL": "default",
|
"LXD_POOL": "default",
|
||||||
"LXD_FORWARD_ADDRESS": "192.0.2.10"
|
"LXD_FORWARD_ADDRESS": "192.0.2.10",
|
||||||
|
"LXD_DEV_FQDN": "lm-dev.example.org"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -126,7 +128,8 @@ it running. The VM is created in a project, the test project `lm-dev` by default
|
|||||||
project's default profile, and takes its address from DHCP. It gets the package with the
|
project's default profile, and takes its address from DHCP. It gets the package with the
|
||||||
administrator `admin`, whose password and TOTP token, unless `--no-otp` is given, are `password` and
|
administrator `admin`, whose password and TOTP token, unless `--no-otp` is given, are `password` and
|
||||||
`otp_url` of `.lm-dev-config/vm-<project>-<vm>.json`, and a configuration from `configs/`,
|
`otp_url` of `.lm-dev-config/vm-<project>-<vm>.json`, and a configuration from `configs/`,
|
||||||
`dev.json` by default; `@ETH0@` is the interface of the VM's default route. A password or
|
`dev.json` by default, which keeps the status page and the Manager on plain HTTP by name too
|
||||||
|
(`https.disable_auto_redirect`); `@ETH0@` is the interface of the VM's default route. A password or
|
||||||
`otp_url` the file lacks, or both when there is no file, is generated and kept in the file, so a VM
|
`otp_url` the file lacks, or both when there is no file, is generated and kept in the file, so a VM
|
||||||
made again has the same password and token; delete one from the file to have a new one made.
|
made again has the same password and token; delete one from the file to have a new one made.
|
||||||
|
|
||||||
@@ -171,6 +174,7 @@ generate it. `remove` deletes the VM, its forward and what the Vault keeps for i
|
|||||||
| `--config` | | `dev.json` | The configuration from `configs/` |
|
| `--config` | | `dev.json` | The configuration from `configs/` |
|
||||||
| `--listen` | `LXD_LISTEN` | the remote URL's host | Outside a test project, the address the proxies listen on |
|
| `--listen` | `LXD_LISTEN` | the remote URL's host | Outside a test project, the address the proxies listen on |
|
||||||
| `--forward-address` | `LXD_FORWARD_ADDRESS` | allocated | In a test project, the forward's listen address, one of the uplink's routes, so a recreated VM keeps it |
|
| `--forward-address` | `LXD_FORWARD_ADDRESS` | allocated | In a test project, the forward's listen address, one of the uplink's routes, so a recreated VM keeps it |
|
||||||
|
| `--fqdn` | `LXD_DEV_FQDN` | `lm-dev.test` | The name of the VM, `@FQDN@` of `dev.json`: the Manager and the status web service answer HTTPS for it, so it has to resolve to the forward or proxy address |
|
||||||
| `--no-otp` | | off | With `create`, enrol no TOTP token for `admin` |
|
| `--no-otp` | | off | With `create`, enrol no TOTP token for `admin` |
|
||||||
| `--deb` | | the package built last | Outside a test project, the package to install |
|
| `--deb` | | the package built last | Outside a test project, the package to install |
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"general": {"platform": "generic"},
|
"general": {"platform": "generic"},
|
||||||
"interfaces": {"external": "@ETH0@"},
|
"interfaces": {"external": "@ETH0@"},
|
||||||
"wan": {"local_fqdn": "lm-dev.test"}
|
"wan": {"local_fqdn": "@FQDN@"},
|
||||||
|
"https": {"disable_auto_redirect": true}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
import { Alert, Button, Dialog, DialogActions, DialogContent, DialogTitle, MenuItem, Stack, TextField, Typography } from '@mui/material'
|
import { Alert, Button, Checkbox, Dialog, DialogActions, DialogContent, DialogTitle, FormControlLabel, MenuItem, Stack, TextField, Typography } from '@mui/material'
|
||||||
import { useState, type FormEvent } from 'react'
|
import { useState, type FormEvent } from 'react'
|
||||||
import { HTTPS_CERTIFICATES, type HttpsCertificateSource, type HttpsChange, type HttpsSettings } from './api.ts'
|
import { HTTPS_CERTIFICATES, type HttpsCertificateSource, type HttpsChange, type HttpsSettings } from './api.ts'
|
||||||
import { CERTIFICATE_LABELS } from './https.ts'
|
import { CERTIFICATE_LABELS } from './https.ts'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dialog that edits where the certificate of the server's FQDN comes from, https.certificate: the ACME CA of
|
* A dialog that edits where the certificate of the server's HTTPS names comes from, https.certificate: the ACME CA of
|
||||||
* AcmeSettingsDialog, a self-signed certificate valid for https.self_signed_days, the Servers Issuing CA, or another
|
* AcmeSettingsDialog, a self-signed certificate valid for https.self_signed_days, the Servers Issuing CA, or another
|
||||||
* CA's certificate, imported on the Server tab of the Certificates page; self-signed is selected while the first setup
|
* CA's certificate, imported on the Server tab of the Certificates page; self-signed is selected while the first setup
|
||||||
* has not chosen one. onSave sends the source and the validity
|
* has not chosen one. Without ACME, https.ip_sans adds the server's addresses to the self-signed certificate and the
|
||||||
* only; the dialog closes when it succeeds and shows the server's message when it fails.
|
* Servers Issuing CA's. onSave sends the source, the validity and ip_sans only; the dialog closes when it succeeds and
|
||||||
|
* shows the server's message when it fails.
|
||||||
*/
|
*/
|
||||||
export default function HttpsSettingsDialog(props: {
|
export default function HttpsSettingsDialog(props: {
|
||||||
current: HttpsSettings
|
current: HttpsSettings
|
||||||
@@ -17,6 +18,7 @@ export default function HttpsSettingsDialog(props: {
|
|||||||
}) {
|
}) {
|
||||||
const [certificate, setCertificate] = useState<HttpsCertificateSource>(props.current.certificate || 'self-signed')
|
const [certificate, setCertificate] = useState<HttpsCertificateSource>(props.current.certificate || 'self-signed')
|
||||||
const [days, setDays] = useState(String(props.current.self_signed_days))
|
const [days, setDays] = useState(String(props.current.self_signed_days))
|
||||||
|
const [ipSans, setIpSans] = useState(props.current.ip_sans)
|
||||||
const [saving, setSaving] = useState(false)
|
const [saving, setSaving] = useState(false)
|
||||||
const [error, setError] = useState<string | null>(null)
|
const [error, setError] = useState<string | null>(null)
|
||||||
|
|
||||||
@@ -31,7 +33,8 @@ export default function HttpsSettingsDialog(props: {
|
|||||||
setSaving(true)
|
setSaving(true)
|
||||||
setError(null)
|
setError(null)
|
||||||
try {
|
try {
|
||||||
await props.onSave(certificate === 'self-signed' ? { certificate, self_signed_days: Number(days) } : { certificate })
|
await props.onSave(certificate === 'self-signed' ? { certificate, self_signed_days: Number(days), ip_sans: ipSans }
|
||||||
|
: certificate === 'acme' ? { certificate } : { certificate, ip_sans: ipSans })
|
||||||
} catch (caught) {
|
} catch (caught) {
|
||||||
setError((caught as Error).message)
|
setError((caught as Error).message)
|
||||||
setSaving(false)
|
setSaving(false)
|
||||||
@@ -62,6 +65,12 @@ export default function HttpsSettingsDialog(props: {
|
|||||||
onChange={(event) => setDays(event.target.value.trim())}
|
onChange={(event) => setDays(event.target.value.trim())}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{(certificate === 'self-signed' || certificate === 'ca') && (
|
||||||
|
<FormControlLabel
|
||||||
|
control={<Checkbox checked={ipSans} onChange={(event) => setIpSans(event.target.checked)} />}
|
||||||
|
label="Also name the server's IP addresses, to reach it over HTTPS by address"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{certificate === 'external' && (
|
{certificate === 'external' && (
|
||||||
<Typography variant="body2" color="text.secondary">
|
<Typography variant="body2" color="text.secondary">
|
||||||
The certificate is imported on this tab, from a CSR the server makes or as a PFX file. The server serves a self-signed certificate until then.
|
The certificate is imported on this tab, from a CSR the server makes or as a PFX file. The server serves a self-signed certificate until then.
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import {
|
|||||||
} from './api.ts'
|
} from './api.ts'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Server tab of the Certificates page, the server's HTTPS from /config and /https/settings: whether HTTPS is on and
|
* The Server tab of the Certificates page, the server's HTTPS from /config and /https/settings: the names and addresses
|
||||||
* for which name, with a chip while the certificate has another source than ACME and a button that opens
|
* HTTPS is served for, with a chip while the certificate has another source than ACME and a button that opens
|
||||||
* HttpsSettingsDialog; the certificate of a source other than ACME, and, for one of another CA, Generate CSR, Import
|
* HttpsSettingsDialog; the certificate of a source other than ACME, and, for one of another CA, Generate CSR, Import
|
||||||
* certificate and Import PFX; the ACME CA with a chip while it is Let's Encrypt's staging environment and a button that
|
* certificate and Import PFX; the ACME CA with a chip while it is Let's Encrypt's staging environment and a button that
|
||||||
* opens AcmeSettingsDialog; and Caddy, its version and the state of caddy.service. Until the first setup
|
* opens AcmeSettingsDialog; and Caddy, its version and the state of caddy.service. Until the first setup
|
||||||
@@ -89,10 +89,9 @@ export default function ServerCertificatePanel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const https = details?.configuration.https
|
const https = details?.configuration.https
|
||||||
const fqdn = String(details?.configuration.wan?.local_fqdn ?? '')
|
const hosts = [...(details?.network.https_names ?? []), ...(details?.network.https_addresses ?? [])]
|
||||||
const httpsOn = https?.enabled === true
|
|
||||||
const chosen = certificate !== null && certificate.source !== ''
|
const chosen = certificate !== null && certificate.source !== ''
|
||||||
const other = httpsOn && certificate !== null && certificate.source !== 'acme'
|
const other = certificate !== null && certificate.source !== 'acme'
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
@@ -106,9 +105,9 @@ export default function ServerCertificatePanel() {
|
|||||||
rows={[
|
rows={[
|
||||||
['HTTPS', (
|
['HTTPS', (
|
||||||
<Stack key="https" direction="row" sx={{ alignItems: 'center', gap: 1, flexWrap: 'wrap' }}>
|
<Stack key="https" direction="row" sx={{ alignItems: 'center', gap: 1, flexWrap: 'wrap' }}>
|
||||||
<span>{httpsOn ? (fqdn ? `on, for ${fqdn}` : 'on, but wan.local_fqdn is not set') : 'off'}</span>
|
<span>{hosts.length > 0 ? `for ${hosts.join(', ')}` : 'on'}</span>
|
||||||
{other && certificate.source !== '' && <Chip size="small" label={CERTIFICATE_LABELS[certificate.source]} color={certificate.served === certificate.source ? 'default' : 'warning'} />}
|
{other && certificate.source !== '' && <Chip size="small" label={CERTIFICATE_LABELS[certificate.source]} color={certificate.served === certificate.source ? 'default' : 'warning'} />}
|
||||||
{httpsOn && !chosen && <Typography variant="body2" color="text.secondary">certificate chosen by the next setup</Typography>}
|
{!chosen && <Typography variant="body2" color="text.secondary">certificate chosen by the next setup</Typography>}
|
||||||
<Tooltip title="HTTPS certificate">
|
<Tooltip title="HTTPS certificate">
|
||||||
<IconButton size="small" aria-label="HTTPS certificate" onClick={() => void open('https')}>
|
<IconButton size="small" aria-label="HTTPS certificate" onClick={() => void open('https')}>
|
||||||
<Settings fontSize="small" />
|
<Settings fontSize="small" />
|
||||||
|
|||||||
+26
-17
@@ -23,9 +23,9 @@ const LAYOUT_KEY = 'linux-manager-ui.router-layout'
|
|||||||
* The server's state: its status, ok or degraded on the title bar of the Status panel, with the update information of
|
* The server's state: its status, ok or degraded on the title bar of the Status panel, with the update information of
|
||||||
* its packages (UpdatesNotice) at the top of that panel, its remote access clients, and from /config the status web
|
* its packages (UpdatesNotice) at the top of that panel, its remote access clients, and from /config the status web
|
||||||
* service; the state of each of its systemd services and of Caddy in the Services panel; the Addresses panel's links
|
* service; the state of each of its systemd services and of Caddy in the Services panel; the Addresses panel's links
|
||||||
* to the status page, over HTTPS for wan.local_fqdn and over plain HTTP on the addresses web.listen names, and to the
|
* to the status page and the Manager over HTTPS for the HTTPS names and addresses, and over plain HTTP: the status page
|
||||||
* Manager over HTTPS, and over plain HTTP on the addresses of its listen from /api/info while Caddy does not redirect
|
* on the addresses web.listen names, the Manager on the addresses of its listen from /api/info only while the redirect
|
||||||
* it, each address once, and the
|
* to HTTPS is off, and both by their HTTPS names only while it is off, each address once, and the
|
||||||
* OpenID Provider's issuer and discovery URL, each with a copy icon, or off while it is disabled; its
|
* OpenID Provider's issuer and discovery URL, each with a copy icon, or off while it is disabled; its
|
||||||
* backups with Run now, and its non-public details as tables and command output, with a panel per PostgreSQL
|
* backups with Run now, and its non-public details as tables and command output, with a panel per PostgreSQL
|
||||||
* cluster: its settings from /config and its databases with their sizes from /postgresql. Read at once, then as the
|
* cluster: its settings from /config and its databases with their sizes from /postgresql. Read at once, then as the
|
||||||
@@ -106,18 +106,22 @@ export default function ServerPanel() {
|
|||||||
const network = details?.network
|
const network = details?.network
|
||||||
const web = details?.configuration.web
|
const web = details?.configuration.web
|
||||||
const https = details?.configuration.https
|
const https = details?.configuration.https
|
||||||
const fqdn = String(details?.configuration.wan?.local_fqdn ?? '')
|
// The hosts HTTPS is served for: its names, then its addresses while https.ip_sans is on.
|
||||||
const httpsOn = https?.enabled === true
|
const httpsNames = network?.https_names ?? []
|
||||||
|
const httpsHosts = [...httpsNames, ...(network?.https_addresses ?? [])].map((host) => (host.includes(':') ? `[${host}]` : host))
|
||||||
|
const redirectOff = https?.disable_auto_redirect === true
|
||||||
|
const httpsUrls = (port: unknown) => httpsHosts.map((host) => `https://${host}:${text(port)}`)
|
||||||
|
// A request by name on a plain HTTP port is redirected to HTTPS unless the redirect is off.
|
||||||
|
const plainNames = (port: unknown) => (redirectOff ? httpsNames.map((name) => `http://${name}:${text(port)}`) : [])
|
||||||
// The plain HTTP URLs of a port on the addresses of the interfaces a listen setting names, each address once: without
|
// The plain HTTP URLs of a port on the addresses of the interfaces a listen setting names, each address once: without
|
||||||
// the router the internal address is the external one.
|
// the router the internal address is the external one.
|
||||||
const plainUrls = (listen: string, port: unknown) => [...new Set([
|
const plainUrls = (listen: string, port: unknown) => [...new Set([
|
||||||
...(listen !== 'external' && network?.internal_address ? [network.internal_address] : []),
|
...(listen !== 'external' && network?.internal_address ? [network.internal_address] : []),
|
||||||
...(listen !== 'internal' ? network?.external_addresses ?? [] : []),
|
...(listen !== 'internal' ? network?.external_addresses ?? [] : []),
|
||||||
].map((address) => String(address).split('/')[0]))].map((address) => `http://${address}:${text(port)}`)
|
].map((address) => String(address).split('/')[0]))].map((address) => `http://${address}:${text(port)}`)
|
||||||
const plain = web?.enabled === false ? [] : plainUrls(String(web?.listen ?? 'both'), web?.port)
|
// The status page stays on plain HTTP by address; the Manager only while the redirect is off.
|
||||||
// The Manager over plain HTTP while Caddy does not redirect it to HTTPS.
|
const plain = web?.enabled === false ? [] : [...plainNames(web?.port), ...plainUrls(String(web?.listen ?? 'both'), web?.port)]
|
||||||
const managerPlain = manager && (!httpsOn || !fqdn || https?.disable_auto_redirect === true)
|
const managerPlain = manager && redirectOff ? [...plainNames(manager.port), ...plainUrls(manager.listen, manager.port)] : []
|
||||||
? plainUrls(manager.listen, manager.port) : []
|
|
||||||
|
|
||||||
// The panels in their default order; a panel without data is left out, and keeps its place in the layout.
|
// The panels in their default order; a panel without data is left out, and keeps its place in the layout.
|
||||||
const panels: BoardPanel[] = []
|
const panels: BoardPanel[] = []
|
||||||
@@ -258,8 +262,8 @@ export default function ServerPanel() {
|
|||||||
content: (
|
content: (
|
||||||
<Pairs
|
<Pairs
|
||||||
rows={[
|
rows={[
|
||||||
['Status page', <Links key="status" urls={[...(httpsOn && fqdn ? [`https://${fqdn}:${text(https?.web_port)}`] : []), ...plain]} />],
|
['Status page', <Links key="status" urls={[...(web?.enabled === false ? [] : httpsUrls(https?.web_port)), ...plain]} />],
|
||||||
['Ubuntu Linux Manager', <Links key="manager" urls={[...(httpsOn && fqdn ? [`https://${fqdn}:${text(https?.manager_port)}`] : []), ...managerPlain]} />],
|
['Ubuntu Linux Manager', <Links key="manager" urls={[...httpsUrls(https?.manager_port), ...managerPlain]} />],
|
||||||
...(details.oidc?.issuer
|
...(details.oidc?.issuer
|
||||||
? [
|
? [
|
||||||
['OpenID Provider', <Copyable key="issuer" value={details.oidc.issuer} label="issuer" />],
|
['OpenID Provider', <Copyable key="issuer" value={details.oidc.issuer} label="issuer" />],
|
||||||
@@ -400,16 +404,21 @@ export function Pairs(props: { rows: [string, string | ReactNode][] }) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A value in monospace for Pairs with an action icon that puts it on the clipboard; label names it in the tooltip. */
|
/**
|
||||||
|
* A value in monospace for Pairs with an action icon that puts it on the clipboard, shown only on a page served over
|
||||||
|
* HTTPS, where the browser offers the clipboard; label names it in the tooltip.
|
||||||
|
*/
|
||||||
export function Copyable(props: { value: string; label: string }) {
|
export function Copyable(props: { value: string; label: string }) {
|
||||||
return (
|
return (
|
||||||
<Stack direction="row" sx={{ alignItems: 'center', gap: 1 }}>
|
<Stack direction="row" sx={{ alignItems: 'center', gap: 1 }}>
|
||||||
<Box component="span" sx={{ fontFamily: 'monospace', fontSize: 13, wordBreak: 'break-all' }}>{props.value}</Box>
|
<Box component="span" sx={{ fontFamily: 'monospace', fontSize: 13, wordBreak: 'break-all' }}>{props.value}</Box>
|
||||||
<Tooltip title={`Copy the ${props.label}`}>
|
{window.isSecureContext && (
|
||||||
<IconButton size="small" aria-label={`copy the ${props.label}`} onClick={() => void navigator.clipboard.writeText(props.value)}>
|
<Tooltip title={`Copy the ${props.label}`}>
|
||||||
<ContentCopy fontSize="small" />
|
<IconButton size="small" aria-label={`copy the ${props.label}`} onClick={() => void navigator.clipboard.writeText(props.value)}>
|
||||||
</IconButton>
|
<ContentCopy fontSize="small" />
|
||||||
</Tooltip>
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
</Stack>
|
</Stack>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ const PREFILLED_LINES = 2
|
|||||||
* device's address, its peer's IPs, or a placeholder without them (ips null). The device's private key is a
|
* device's address, its peer's IPs, or a placeholder without them (ips null). The device's private key is a
|
||||||
* placeholder, which the server never has; a switch leaves out the [Interface] and PrivateKey lines, which a client such
|
* placeholder, which the server never has; a switch leaves out the [Interface] and PrivateKey lines, which a client such
|
||||||
* as WireGuard for Windows fills in for a new empty tunnel, and keeps its position in the browser's settings. Copy
|
* as WireGuard for Windows fills in for a new empty tunnel, and keeps its position in the browser's settings. Copy
|
||||||
* puts the configuration as shown on the clipboard.
|
* puts the configuration as shown on the clipboard; it is shown only on a page served over HTTPS, where the browser
|
||||||
|
* offers the clipboard.
|
||||||
*/
|
*/
|
||||||
export default function WireGuardConfigDialog(props: { title: string; server: WireGuardServer; ips: string[] | null; onClose: () => void }) {
|
export default function WireGuardConfigDialog(props: { title: string; server: WireGuardServer; ips: string[] | null; onClose: () => void }) {
|
||||||
const [copied, setCopied] = useState(false)
|
const [copied, setCopied] = useState(false)
|
||||||
@@ -43,9 +44,11 @@ export default function WireGuardConfigDialog(props: { title: string; server: Wi
|
|||||||
</Box>
|
</Box>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
<DialogActions>
|
<DialogActions>
|
||||||
<Button startIcon={copied ? <Check /> : <ContentCopy />} onClick={() => void navigator.clipboard.writeText(text).then(() => setCopied(true))}>
|
{window.isSecureContext && (
|
||||||
{copied ? 'Copied' : 'Copy'}
|
<Button startIcon={copied ? <Check /> : <ContentCopy />} onClick={() => void navigator.clipboard.writeText(text).then(() => setCopied(true))}>
|
||||||
</Button>
|
{copied ? 'Copied' : 'Copy'}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
<Button variant="contained" onClick={props.onClose}>Close</Button>
|
<Button variant="contained" onClick={props.onClose}>Close</Button>
|
||||||
</DialogActions>
|
</DialogActions>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|||||||
+10
-4
@@ -91,6 +91,10 @@ export type RouterDetails = {
|
|||||||
external_addresses?: string[]
|
external_addresses?: string[]
|
||||||
internal_address?: string
|
internal_address?: string
|
||||||
internal_gateway?: string
|
internal_gateway?: string
|
||||||
|
/** The names HTTPS is served for: wan.local_fqdn, or the host name and <host name>.local without it. */
|
||||||
|
https_names?: string[]
|
||||||
|
/** The addresses HTTPS is served for while https.ip_sans is on. */
|
||||||
|
https_addresses?: string[]
|
||||||
local_cidrs?: string[]
|
local_cidrs?: string[]
|
||||||
/** Each site-to-site connection with the identities and subnets the server resolved for it. */
|
/** Each site-to-site connection with the identities and subnets the server resolved for it. */
|
||||||
site_to_site?: { name: string; local_identity: string; remote_identity: string; local_cidrs: string[]; remote_cidrs: string[] }[]
|
site_to_site?: { name: string; local_identity: string; remote_identity: string; local_cidrs: string[]; remote_cidrs: string[] }[]
|
||||||
@@ -502,10 +506,10 @@ export type AcmeProvider = (typeof ACME_PROVIDERS)[number]
|
|||||||
* the certificate source, '' until the first setup chooses it, and the ACME settings.
|
* the certificate source, '' until the first setup chooses it, and the ACME settings.
|
||||||
*/
|
*/
|
||||||
export type HttpsSettings = {
|
export type HttpsSettings = {
|
||||||
enabled: boolean
|
|
||||||
email: string
|
email: string
|
||||||
web_port: number
|
web_port: number
|
||||||
manager_port: number
|
manager_port: number
|
||||||
|
ip_sans: boolean
|
||||||
acme_staging: boolean
|
acme_staging: boolean
|
||||||
certificate: HttpsCertificateSource | ''
|
certificate: HttpsCertificateSource | ''
|
||||||
self_signed_days: number
|
self_signed_days: number
|
||||||
@@ -517,8 +521,8 @@ export type HttpsSettings = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** The changes PUT /https/settings takes; a secret left out keeps its value. */
|
/** The changes PUT /https/settings takes; a secret left out keeps its value. */
|
||||||
export type HttpsChange = Partial<Pick<HttpsSettings, 'acme_staging' | 'certificate' | 'self_signed_days' | 'acme_provider' |
|
export type HttpsChange = Partial<Pick<HttpsSettings, 'acme_staging' | 'certificate' | 'self_signed_days' | 'ip_sans' |
|
||||||
'acme_url' | 'acme_eab_key_id'>> & { acme_eab_mac_key?: string; zerossl_api_key?: string }
|
'acme_provider' | 'acme_url' | 'acme_eab_key_id'>> & { acme_eab_mac_key?: string; zerossl_api_key?: string }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The server's HTTPS certificate: the chosen source, '' until the first setup chooses it, the one served (self-signed while the chosen one is not
|
* The server's HTTPS certificate: the chosen source, '' until the first setup chooses it, the one served (self-signed while the chosen one is not
|
||||||
@@ -700,6 +704,8 @@ export const DETAILS_SHAPE = object({
|
|||||||
external_addresses: optional(list(string)),
|
external_addresses: optional(list(string)),
|
||||||
internal_address: optional(string),
|
internal_address: optional(string),
|
||||||
internal_gateway: optional(string),
|
internal_gateway: optional(string),
|
||||||
|
https_names: optional(list(string)),
|
||||||
|
https_addresses: optional(list(string)),
|
||||||
local_cidrs: optional(list(string)),
|
local_cidrs: optional(list(string)),
|
||||||
site_to_site: optional(list(object({
|
site_to_site: optional(list(object({
|
||||||
name: string,
|
name: string,
|
||||||
@@ -1154,10 +1160,10 @@ export const METRICS_SETTINGS_SHAPE = object({
|
|||||||
/** The shape of GET and PUT /https/settings; GET also has the certificate. */
|
/** The shape of GET and PUT /https/settings; GET also has the certificate. */
|
||||||
export const HTTPS_SETTINGS_SHAPE = object({
|
export const HTTPS_SETTINGS_SHAPE = object({
|
||||||
settings: object({
|
settings: object({
|
||||||
enabled: boolean,
|
|
||||||
email: string,
|
email: string,
|
||||||
web_port: number,
|
web_port: number,
|
||||||
manager_port: number,
|
manager_port: number,
|
||||||
|
ip_sans: boolean,
|
||||||
acme_staging: boolean,
|
acme_staging: boolean,
|
||||||
certificate: string,
|
certificate: string,
|
||||||
self_signed_days: number,
|
self_signed_days: number,
|
||||||
|
|||||||
Reference in new issue
Block a user