add assertion to avoid issue with authelia and ldap

This commit is contained in:
ibizaman 2025-03-17 00:59:13 +01:00 committed by Pierre Penninckx
parent c7b8529502
commit cf944bee37
2 changed files with 7 additions and 1 deletions

View file

@ -115,7 +115,7 @@
subdomain = "auth";
ssl = config.shb.certs.certs.selfsigned.n;
ldapPort = config.shb.ldap.ldapPort;
ldapHostname = "ldap://127.0.0.1";
ldapHostname = "127.0.0.1";
dcdomain = config.shb.ldap.dcdomain;
secrets = {

View file

@ -11,6 +11,8 @@ let
fqdnWithPort = if isNull cfg.port then fqdn else "${fqdn}:${toString cfg.port}";
autheliaCfg = config.services.authelia.instances.${fqdn};
inherit (lib) hasPrefix;
in
{
options.shb.authelia = {
@ -309,6 +311,10 @@ in
assertion = builtins.length cfg.oidcClients > 0;
message = "Must have at least one oidc client otherwise Authelia refuses to start.";
}
{
assertion = !(hasPrefix "ldap://" cfg.ldapHostname);
message = "LDAP hostname should be the bare host name and not start with ldap://";
}
];
# Overriding the user name so we don't allow any weird characters anywhere. For example, postgres users do not accept the '.'.