kubernetes-deployments/modules/authelia.nix

112 lines
2.5 KiB
Nix
Raw Normal View History

2025-02-04 17:24:51 +01:00
{
nixhelm,
system,
config,
lib,
...
}: {
options.authelia.enable = lib.mkEnableOption "authelia";
config = lib.mkIf config.authelia.enable {
kubernetes = {
helm.releases.authelia = {
chart = nixhelm.chartsDerivations.${system}.authelia.authelia;
includeCRDs = true;
namespace = "authelia";
values = {
pod = {
kind = "Deployment";
replicas = 1;
};
2025-02-05 18:06:30 +01:00
secret.additionalSecrets.authelia.items = [
{
key = "storage";
path = "storage";
}
{
key = "session";
path = "session";
}
{
key = "users";
path = "users";
}
];
2025-02-04 17:24:51 +01:00
configMap = {
2025-02-05 18:06:30 +01:00
access_control.default_policy = "one_factor";
2025-02-04 17:24:51 +01:00
authentication_backend = {
password_reset.disable = true;
ldap.enabled = false;
file = {
enabled = true;
2025-02-05 18:06:30 +01:00
path = "/secrets/authelia/users";
2025-02-04 17:24:51 +01:00
search.email = true;
password.algorithm = "argon2";
};
};
storage = {
2025-02-05 18:06:30 +01:00
encryption_key = {
secret_name = "authelia";
path = "storage";
};
2025-02-04 17:24:51 +01:00
local = {
enabled = true;
path = "/tmp/storage"; # TODO
};
};
session = {
2025-02-05 18:06:30 +01:00
encryption_key = {
secret_name = "authelia";
path = "session";
};
2025-02-04 17:24:51 +01:00
cookies = [
{
domain = "kun.is";
subdomain = "auth";
}
];
};
2025-02-05 18:06:30 +01:00
notifier.filesystem = {
enabled = true;
# TODO: switch to SMTP
filename = "/tmp/notifications.txt";
2025-02-04 17:24:51 +01:00
};
};
};
};
2025-02-05 18:06:30 +01:00
resources.secrets.authelia.stringData = {
storage = "ref+sops://secrets.yml#/authelia/encryption_keys/storage";
session = "ref+sops://secrets.yml#/authelia/encryption_keys/session";
users = "ref+sops://secrets.yml#/authelia/users";
2025-02-04 17:24:51 +01:00
};
};
lab = {
ingresses.authelia = {
host = "auth.kun.is";
service = {
name = "authelia";
portName = "http";
};
};
longhorn.persistentVolumeClaim.data = {
volumeName = "authelia";
storage = "100Mi";
};
};
};
}