parent
478f26a9b8
commit
2bbbe03444
4 changed files with 29 additions and 16 deletions
|
|
@ -543,12 +543,12 @@ in
|
||||||
networking.caddy = {
|
networking.caddy = {
|
||||||
hosts = {
|
hosts = {
|
||||||
"auth.kruining.eu" = ''
|
"auth.kruining.eu" = ''
|
||||||
reverse_proxy h2c://::1:9092
|
reverse_proxy h2c://[::1]:9092
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
(auth) {
|
(auth) {
|
||||||
forward_auth h2c://::1:9092 {
|
forward_auth h2c://[::1]:9092 {
|
||||||
uri /api/authz/forward-auth
|
uri /api/authz/forward-auth
|
||||||
copy_headers Remote-User Remote-Groups Remote-Email Remote-Name
|
copy_headers Remote-User Remote-Groups Remote-Email Remote-Name
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,8 @@ in {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
"${fqn}" = ''
|
"${fqn}" = ''
|
||||||
reverse_proxy /_matrix/* http://::1:${toString port}
|
reverse_proxy /_matrix/* http://[::1]:${toString port}
|
||||||
reverse_proxy /_synapse/client/* http://::1:${toString port}
|
reverse_proxy /_synapse/client/* http://[::1]:${toString port}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,15 @@
|
||||||
|
|
||||||
cfg = config.${namespace}.services.networking.caddy;
|
cfg = config.${namespace}.services.networking.caddy;
|
||||||
hasHosts = (cfg.hosts |> attrNames |> length) > 0;
|
hasHosts = (cfg.hosts |> attrNames |> length) > 0;
|
||||||
|
caddyBase = pkgs.callPackage "${pkgs.path}/pkgs/by-name/ca/caddy/package.nix" {
|
||||||
|
buildGo125Module = pkgs.buildGo126Module;
|
||||||
|
caddy = caddyBase;
|
||||||
|
};
|
||||||
|
caddyPackage =
|
||||||
|
caddyBase.withPlugins {
|
||||||
|
plugins = ["github.com/corazawaf/coraza-caddy/v2@v2.1.0"];
|
||||||
|
hash = "sha256-pSXjLaZoRtKV3eFl2ySRSjl3yxi514G1Cb7pfrpxxtE=";
|
||||||
|
};
|
||||||
in {
|
in {
|
||||||
options.${namespace}.services.networking.caddy = {
|
options.${namespace}.services.networking.caddy = {
|
||||||
enable = mkEnableOption "enable caddy" // {default = true;};
|
enable = mkEnableOption "enable caddy" // {default = true;};
|
||||||
|
|
@ -27,10 +36,7 @@ in {
|
||||||
services.caddy = {
|
services.caddy = {
|
||||||
enable = cfg.enable;
|
enable = cfg.enable;
|
||||||
|
|
||||||
package = pkgs.caddy.withPlugins {
|
package = caddyPackage;
|
||||||
plugins = ["github.com/corazawaf/coraza-caddy/v2@v2.1.0"];
|
|
||||||
hash = "sha256-pSXjLaZoRtKV3eFl2ySRSjl3yxi514G1Cb7pfrpxxtE=";
|
|
||||||
};
|
|
||||||
|
|
||||||
virtualHosts =
|
virtualHosts =
|
||||||
cfg.hosts
|
cfg.hosts
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,15 @@
|
||||||
{ pkgs, config, lib, namespace, ... }:
|
{
|
||||||
let
|
pkgs,
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
namespace,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.options) mkEnableOption;
|
inherit (lib.options) mkEnableOption;
|
||||||
|
|
||||||
cfg = config.${namespace}.services.observability.promtail;
|
cfg = config.${namespace}.services.observability.promtail;
|
||||||
in
|
in {
|
||||||
{
|
|
||||||
options.${namespace}.services.observability.promtail = {
|
options.${namespace}.services.observability.promtail = {
|
||||||
enable = mkEnableOption "enable Grafana Promtail";
|
enable = mkEnableOption "enable Grafana Promtail";
|
||||||
};
|
};
|
||||||
|
|
@ -31,7 +35,7 @@ in
|
||||||
|
|
||||||
clients = [
|
clients = [
|
||||||
{
|
{
|
||||||
url = "http://::1:9003/loki/api/v1/push";
|
url = "http://[::1]:9003/loki/api/v1/push";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -46,13 +50,16 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
relabel_configs = [
|
relabel_configs = [
|
||||||
{ source_labels = [ "__journal__systemd_unit" ]; target_label = "unit"; }
|
{
|
||||||
|
source_labels = ["__journal__systemd_unit"];
|
||||||
|
target_label = "unit";
|
||||||
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 9004 ];
|
networking.firewall.allowedTCPPorts = [9004];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue