summaryrefslogtreecommitdiff
path: root/microvms
diff options
context:
space:
mode:
authorGrigory Shipunov2025-01-14 21:24:05 +0000
committerGrigory Shipunov2025-01-19 19:21:43 +0000
commit5c3f0886e592ff2d3e3a8588ab496f36c19e0ce9 (patch)
tree53593dfbed713fe889cd533c1bd38506c1a09bfa /microvms
parent2f2318aaaa6745cdf3a58142b988b2550bf6b952 (diff)
yeet authentik, add keycloak and radicale
Diffstat (limited to 'microvms')
-rw-r--r--microvms/auth/default.nix (renamed from microvms/authentik/default.nix)13
-rw-r--r--microvms/auth/keycloak.nix18
-rw-r--r--microvms/authentik/authentik.nix8
-rw-r--r--microvms/radicale/default.nix74
4 files changed, 98 insertions, 15 deletions
diff --git a/microvms/authentik/default.nix b/microvms/auth/default.nix
index badb384..b4c23f1 100644
--- a/microvms/authentik/default.nix
+++ b/microvms/auth/default.nix
@@ -4,17 +4,16 @@ let
in
{
imports = [
- ./authentik.nix
+ ./keycloak.nix
];
-
- sops.defaultSopsFile = ../../secrets/authentik/secrets.yaml;
+ sops.defaultSopsFile = ../../secrets/auth/secrets.yaml;
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
sops.secrets = {
"wg/0xa-proxy" = {
owner = config.users.users.systemd-network.name;
};
- "authentik/envfile" = { };
+ "keycloak/db_pass" = { };
};
microvm = {
@@ -24,7 +23,7 @@ in
interfaces = [
{
type = "tap";
- id = "uvm-authentik";
+ id = "uvm-auth";
mac = mac;
}
];
@@ -61,7 +60,7 @@ in
networks."11-host" = {
matchConfig.MACAddress = mac;
networkConfig = {
- Address = "10.99.99.10/24";
+ Address = "10.99.99.11/24";
DHCP = "no";
};
routes = [
@@ -74,6 +73,6 @@ in
};
};
- networking.hostName = "authentik";
+ networking.hostName = "auth";
system.stateVersion = "24.11";
}
diff --git a/microvms/auth/keycloak.nix b/microvms/auth/keycloak.nix
new file mode 100644
index 0000000..de537ef
--- /dev/null
+++ b/microvms/auth/keycloak.nix
@@ -0,0 +1,18 @@
+{ config, ... }:
+{
+ services.keycloak = {
+ enable = true;
+ database = {
+ type = "postgresql";
+ createLocally = true;
+ passwordFile = config.sops.secrets."keycloak/db_pass".path;
+ };
+ settings = {
+ hostname = "https://auth.oxapentane.com";
+ http-port = 38080;
+ http-enabled = true;
+ proxy-headers = "xforwarded";
+ proxy-trusted-addresses = "10.89.88.0/24,fd31:185d:722f::/48";
+ };
+ };
+}
diff --git a/microvms/authentik/authentik.nix b/microvms/authentik/authentik.nix
deleted file mode 100644
index 3095944..0000000
--- a/microvms/authentik/authentik.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-{ config, ... }:
-{
- services.authentik = {
- enable = true;
- environmentFile = config.sops.secrets."authentik/envfile".path;
- settings.disable_startup_analytics = true;
- };
-}
diff --git a/microvms/radicale/default.nix b/microvms/radicale/default.nix
new file mode 100644
index 0000000..7ed8f11
--- /dev/null
+++ b/microvms/radicale/default.nix
@@ -0,0 +1,74 @@
+{ config, lib, ... }:
+let
+ mac = "02:00:00:00:00:02";
+in
+{
+ sops.defaultSopsFile = ../../secrets/radicale/secrets.yaml;
+ sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
+
+ sops.secrets = {
+ "wg/0xa-proxy" = {
+ owner = config.users.users.systemd-network.name;
+ };
+ };
+
+ microvm = {
+ hypervisor = "qemu";
+ mem = 1 * 1024;
+ vcpu = 1;
+ interfaces = [
+ {
+ type = "tap";
+ id = "uvm-radicale";
+ mac = mac;
+ }
+ ];
+ shares =
+ [
+ {
+ source = "/nix/store";
+ mountPoint = "/nix/.ro-store";
+ tag = "store";
+ proto = "virtiofs";
+ socket = "store.socket";
+ }
+ ]
+ ++ map
+ (dir: {
+ source = dir;
+ mountPoint = "/${dir}";
+ tag = dir;
+ proto = "virtiofs";
+ socket = "${dir}.socket";
+ })
+ [
+ "etc"
+ "var"
+ "home"
+ ];
+ };
+
+ networking.useNetworkd = true;
+ networking.firewall.enable = lib.mkForce false; # firewalling done by the host
+
+ systemd.network = {
+ enable = true;
+ networks."11-host" = {
+ matchConfig.MACAddress = mac;
+ networkConfig = {
+ Address = "10.99.99.12/24";
+ DHCP = "no";
+ };
+ routes = [
+ {
+ Gateway = "10.99.99.1";
+ Destination = "0.0.0.0/0";
+ Metric = 1024;
+ }
+ ];
+ };
+ };
+
+ networking.hostName = "radicale";
+ system.stateVersion = "24.11";
+}