forge, matrix: SSO is not optional
Both services carried an `sso.enable` defaulting to false, so a swarm's own forge and homeserver shipped with their identity provider switched off unless an operator remembered two lines. Grafana never had the toggle and is the shape the other two now match. Behaves as if the setting were true: `ssoLocal` loses one conjunct, the three assertions become unconditional, and the login source and identity_provider render always. The option is removed rather than defaulted, so a config that turned SSO OFF fails where that line is instead of silently gaining a login provider on the next rebuild.
This commit is contained in:
parent
d65edc5ac0
commit
792d7f503f
4 changed files with 94 additions and 84 deletions
|
|
@ -29,7 +29,7 @@ let
|
|||
# authelia, so the secret can be moved without an operator. The other
|
||||
# two cases (swarm side via swarmctl, remote hive) leave
|
||||
# `clientSecretFile` to be set explicitly — see docs/swarm/.
|
||||
ssoLocal = cfg.sso.enable && autheliaCfg.enable;
|
||||
ssoLocal = autheliaCfg.enable;
|
||||
|
||||
# Where the plaintext lands inside the forge container. Under
|
||||
# /var/lib rather than /run: the forge may start before the delivery
|
||||
|
|
@ -124,6 +124,16 @@ in
|
|||
[ "services" "hyperhive" "forge" ]
|
||||
[ "services" "hyperhive" "swarm" "forge" ]
|
||||
)
|
||||
(lib.mkRemovedOptionModule [ "services" "hyperhive" "swarm" "forge" "sso" "enable" ] ''
|
||||
SSO is no longer optional: the forge always registers the swarm's
|
||||
authelia as a login source.
|
||||
|
||||
Removed rather than defaulted to true so a config that turned it
|
||||
OFF fails here, where the line is, instead of silently gaining a
|
||||
login provider on the next rebuild. Drop the line; if it was
|
||||
false, set services.hyperhive.swarm.forge.sso.clientSecretFile and
|
||||
services.hyperhive.swarm.authelia.url as the assertions describe.
|
||||
'')
|
||||
];
|
||||
|
||||
# The internal forge is mandatory — it's the canonical store for the
|
||||
|
|
@ -348,23 +358,16 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
# The swarm's authelia is always registered as an OpenID Connect
|
||||
# login source here — there is no toggle, for the same reason the
|
||||
# forge itself has none.
|
||||
#
|
||||
# **Additive, never exclusive.** Forgejo keeps its local password
|
||||
# database and gains an extra "sign in with" button; this does not
|
||||
# disable local login. Deliberate: an identity provider that can take
|
||||
# the forge offline when it hiccups is a worse forge than one with
|
||||
# two ways in — which is also what makes always-on safe.
|
||||
sso = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
example = true;
|
||||
description = ''
|
||||
Register the swarm's authelia as an OpenID Connect login
|
||||
source on this forge.
|
||||
|
||||
**Additive, never exclusive.** Forgejo keeps its local
|
||||
password database and gains an extra "sign in with" button;
|
||||
this does not disable local login. Deliberate: an identity
|
||||
provider that can take the forge offline when it hiccups is a
|
||||
worse forge than one with two ways in.
|
||||
'';
|
||||
};
|
||||
|
||||
clientId = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "forgejo";
|
||||
|
|
@ -529,11 +532,12 @@ in
|
|||
{
|
||||
# Fail at EVAL, not at boot. The alternative failure is a login
|
||||
# button that always 401s, three layers from the missing file.
|
||||
assertion = !cfg.sso.enable || cfg.sso.clientSecretFile != null;
|
||||
assertion = cfg.sso.clientSecretFile != null;
|
||||
message = ''
|
||||
services.hyperhive.swarm.forge.sso.enable requires
|
||||
sso.clientSecretFile — the path (inside the forge container)
|
||||
holding the OIDC client secret's plaintext.
|
||||
The forge's SSO login source requires
|
||||
services.hyperhive.swarm.forge.sso.clientSecretFile — the path
|
||||
(inside the forge container) holding the OIDC client secret's
|
||||
plaintext.
|
||||
|
||||
On a hive that also runs the swarm's authelia this is wired up
|
||||
for you. Set it explicitly when authelia lives on another
|
||||
|
|
@ -543,9 +547,9 @@ in
|
|||
{
|
||||
# Without a provider URL there is nothing to discover against,
|
||||
# and the rendered unit would ask `null/.well-known/…`.
|
||||
assertion = !cfg.sso.enable || autheliaUrl != null;
|
||||
assertion = autheliaUrl != null;
|
||||
message = ''
|
||||
services.hyperhive.swarm.forge.sso.enable requires
|
||||
The forge's SSO login source requires
|
||||
services.hyperhive.swarm.authelia.url — the base URL of the
|
||||
swarm's SSO provider.
|
||||
|
||||
|
|
@ -670,7 +674,10 @@ in
|
|||
(caTrust.trustBundle {
|
||||
inherit pkgs;
|
||||
name = "hive-forge";
|
||||
consumers = [ "forgejo" ] ++ lib.optional cfg.sso.enable "forgejo-sso-source";
|
||||
consumers = [
|
||||
"forgejo"
|
||||
"forgejo-sso-source"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
|
|
@ -941,7 +948,7 @@ in
|
|||
# spelled out for the GPG key above: a stamp survives a state
|
||||
# wipe that took the thing it claims exists, and then suppresses
|
||||
# the repair.
|
||||
systemd.services.forgejo-sso-source = lib.mkIf cfg.sso.enable {
|
||||
systemd.services.forgejo-sso-source = {
|
||||
description = "register authelia as Forgejo's OIDC login source";
|
||||
after = [ "forgejo.service" ];
|
||||
requires = [ "forgejo.service" ];
|
||||
|
|
|
|||
Loading…
Reference in a new issue