hive-matrix: run the homeserver in its own netns, behind a unix socket
tuwunel bound `0.0.0.0:<httpPort>` in the host netns, so the homeserver
port was open on every host address, and the gateway proxied to it on
host loopback.
The container now sets `privateNetwork = true` and hangs off the hive
bridge with a DHCP lease, the same attach the CI runner, builder and
review classifier use (resolvconf on, `networking.nameservers` the bridge
IP). tuwunel listens only on `/run/hive-matrix/tuwunel.sock`, a host
directory (root:nginx 0770) bind-mounted into the container; its primary
group is nginx's gid and the socket is 0660. The gateway's `/_matrix/`
location proxies to the socket.
The static resolv.conf goes: it existed because resolvconf's host
tracking came up empty in the shared netns.
`swarm.matrix.httpPort` and `{swarm,deploy}.matrix.openFirewall` are
removed with a message: there is no host port to choose or open. The
`.well-known/matrix/*` fallback to `<hive>:<httpPort>` is dropped with
them; it only rendered with `gatewayHost = null`, which the homeserver's
SSO assertion already rejects.
Part of #4815.
This commit is contained in:
parent
e455964cb3
commit
34e142bb5c
11 changed files with 191 additions and 163 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# The swarm's matrix homeserver as every hive sees it: the name it mints ids
|
||||
# under, the ports and URLs it is reached on, its encryption policy and the
|
||||
# under, the URLs it is reached on, its encryption policy and the
|
||||
# OIDC client id it is registered under, identical on every host. What the
|
||||
# host running it decides, and the container itself, are in ./hive-matrix.nix.
|
||||
{
|
||||
|
|
@ -49,18 +49,6 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
httpPort = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 8008;
|
||||
description = ''
|
||||
TCP port tuwunel serves the matrix client-server API on.
|
||||
Default 8008 is the matrix-spec well-known port. Sits
|
||||
outside hyperhive's claimed ranges (dashboard 7000, every
|
||||
agent in 8100..8999 via FNV-1a hash). Federation listens on
|
||||
`federationPort` separately.
|
||||
'';
|
||||
};
|
||||
|
||||
apiUrl = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = if cfg.gatewayHost == null then null else "https://${cfg.gatewayHost}";
|
||||
|
|
@ -108,8 +96,8 @@ in
|
|||
Public hostname for the matrix homeserver behind the gateway.
|
||||
Defaults to `chat.''${services.hyperhive.swarm.domain}` — the
|
||||
swarm's domain, because a swarm runs **one** homeserver. Set to
|
||||
`null` to skip the gateway vhost (tuwunel stays direct on
|
||||
`httpPort`). See `docs/networking/gateway.md` for the vhost map + matrix
|
||||
`null` to skip the gateway vhost, which leaves nothing able to
|
||||
reach the homeserver. See `docs/networking/gateway.md` for the vhost map + matrix
|
||||
discovery flow, and the federation port-8448 caveat at the
|
||||
bottom of that doc.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue