2023-05-17 17:10:18 +01:00
|
|
|
{...}: {
|
|
|
|
imports = [./fail2ban.nix];
|
2023-05-11 11:54:42 +01:00
|
|
|
services.traefik = {
|
|
|
|
enable = true;
|
|
|
|
staticConfigOptions = {
|
2023-05-17 17:10:18 +01:00
|
|
|
api = {insecure = true;};
|
2023-05-11 11:54:42 +01:00
|
|
|
entryPoints = {
|
2023-05-17 17:10:18 +01:00
|
|
|
http = {address = ":80";};
|
|
|
|
https = {address = ":443";};
|
2023-05-11 11:54:42 +01:00
|
|
|
};
|
2023-05-15 07:51:06 +01:00
|
|
|
certificatesResolvers = {
|
|
|
|
default = {
|
|
|
|
acme = {
|
|
|
|
email = "evie@xenia.me.uk";
|
|
|
|
storage = "/var/lib/traefik/acme.json";
|
2023-05-17 17:10:18 +01:00
|
|
|
httpChallenge = {entryPoint = "http";};
|
2023-05-15 07:51:06 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
dynamicConfigOptions.http = {
|
2023-05-17 17:10:18 +01:00
|
|
|
routers.traefik = {
|
|
|
|
rule = "Host(`traefik.xenia.me.uk`)";
|
|
|
|
service = "traefik-webinterface";
|
|
|
|
tls = {certResolver = "default";};
|
|
|
|
};
|
|
|
|
services.traefik-webinterface.loadBalancer.servers = [{url = "http://localhost:8080";}];
|
2023-05-11 11:54:42 +01:00
|
|
|
};
|
|
|
|
};
|
2023-05-17 17:10:18 +01:00
|
|
|
networking.firewall = {
|
|
|
|
enable = true;
|
|
|
|
allowedTCPPorts = [80 443 8080];
|
|
|
|
};
|
2023-05-16 11:24:19 +01:00
|
|
|
services.fail2ban.jails.traefik = ''
|
|
|
|
enabled = true
|
|
|
|
filter = traefik-auth
|
|
|
|
ports = http,https,8080
|
|
|
|
backend = systemd
|
|
|
|
'';
|
2023-05-11 11:54:42 +01:00
|
|
|
}
|