parent
0eb6953b0d
commit
d74a131529
14 changed files with 259 additions and 67 deletions
|
|
@ -19,6 +19,7 @@ let
|
|||
routers."${router}-robotstxt" = {
|
||||
service = "robotstxt";
|
||||
rule = "Host(`${v.host}`) && Path(`/robots.txt`)";
|
||||
tls.certResolver = "letsencrypt";
|
||||
tls.domains = [
|
||||
{
|
||||
main = certDomain;
|
||||
|
|
@ -30,6 +31,7 @@ let
|
|||
routers.${router} = {
|
||||
inherit service;
|
||||
rule = "Host(`${v.host}`)";
|
||||
tls.certResolver = "letsencrypt";
|
||||
tls.domains = [
|
||||
{
|
||||
main = certDomain;
|
||||
|
|
@ -41,10 +43,11 @@ let
|
|||
loadBalancer.servers = [
|
||||
{ url = v.internal; }
|
||||
];
|
||||
loadBalancer.serverTransport = lib.mkIf (v.transport != null) v.transport;
|
||||
};
|
||||
services.robotstxt = {
|
||||
loadBalancer.servers = [
|
||||
{ url = "http://127.0.0.2"; }
|
||||
{ url = "http://127.0.0.2:8080"; }
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
@ -77,6 +80,10 @@ in
|
|||
host = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
transport = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.anything;
|
||||
default = null;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
@ -86,12 +93,19 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
services.nginx = {
|
||||
enable = lib.mkIf cfg.noBots true;
|
||||
defaultListenAddresses = lib.mkIf cfg.noBots [ "127.0.0.2" ];
|
||||
virtualHosts.localhost.locations."/".root = pkgs.writeTextFile {
|
||||
defaultListen = lib.mkIf cfg.noBots [
|
||||
{
|
||||
addr = "127.0.0.2";
|
||||
port = 8080;
|
||||
}
|
||||
];
|
||||
virtualHosts._.default = true;
|
||||
virtualHosts._.locations."/".root = pkgs.writeTextFile {
|
||||
name = "robots.txt";
|
||||
destination = "/robots.txt";
|
||||
text = ''
|
||||
User-Agent: *
|
||||
Disallow /
|
||||
User-agent: *
|
||||
Disallow: /
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
@ -104,7 +118,7 @@ in
|
|||
metrics = lib.mkIf config.xyno.services.monitoring.enable {
|
||||
otlp.http.endpoint = "http://localhost:8429/v1/metrics";
|
||||
};
|
||||
entryponts.web = {
|
||||
entryponits.web = {
|
||||
address = ":80";
|
||||
redirections.entryPoint = {
|
||||
to = "websecure";
|
||||
|
|
@ -112,9 +126,9 @@ in
|
|||
permanent = true;
|
||||
};
|
||||
};
|
||||
entryponts.websecure = {
|
||||
entrypoints.websecure = {
|
||||
address = ":443";
|
||||
tls.certResolver = "letsencrypt";
|
||||
http.tls.certResolver = "letsencrypt";
|
||||
http3 = { };
|
||||
|
||||
};
|
||||
|
|
@ -123,39 +137,40 @@ in
|
|||
email = "ssl@xyno.systems";
|
||||
caServer = "https://acme-v02.api.letsencrypt.org/directory";
|
||||
dnsChallenge = {
|
||||
resolvers = [ "8.8.8.8" "1.1.1.1" ];
|
||||
provider = "desec";
|
||||
};
|
||||
};
|
||||
};
|
||||
dynamicConfigOptions = {
|
||||
http = lib.mkMerge simpleProxyOpts;
|
||||
tls.options.default = {
|
||||
# mozilla modern
|
||||
minVersion = "VersionTLS13";
|
||||
curvePreferences = [
|
||||
"X25519"
|
||||
"CurveP256"
|
||||
"CurveP384"
|
||||
];
|
||||
};
|
||||
tls.options.old = {
|
||||
# mozilla intermediate
|
||||
minVersion = "VersionTLS12";
|
||||
curvePreferences = [
|
||||
"X25519"
|
||||
"CurveP256"
|
||||
"CurveP384"
|
||||
];
|
||||
cipherSuites = [
|
||||
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"
|
||||
"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
|
||||
"TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
|
||||
"TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
|
||||
"TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305"
|
||||
"TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305"
|
||||
];
|
||||
# tls.options.default = {
|
||||
# # mozilla modern
|
||||
# minVersion = "VersionTLS13";
|
||||
# curvePreferences = [
|
||||
# "X25519"
|
||||
# "CurveP256"
|
||||
# "CurveP384"
|
||||
# ];
|
||||
# };
|
||||
# tls.options.old = {
|
||||
# # mozilla intermediate
|
||||
# minVersion = "VersionTLS12";
|
||||
# curvePreferences = [
|
||||
# "X25519"
|
||||
# "CurveP256"
|
||||
# "CurveP384"
|
||||
# ];
|
||||
# cipherSuites = [
|
||||
# "TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256"
|
||||
# "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"
|
||||
# "TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384"
|
||||
# "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384"
|
||||
# "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305"
|
||||
# "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305"
|
||||
# ];
|
||||
|
||||
};
|
||||
# };
|
||||
};
|
||||
};
|
||||
networking.firewall.allowedTCPPorts = [
|
||||
|
|
@ -169,6 +184,7 @@ in
|
|||
sops.templates."traefik.env".content = ''
|
||||
DESEC_TOKEN=${config.sops.placeholder.desec_token}
|
||||
DESEC_PROPAGATION_TIMEOUT=1200
|
||||
LEGO_DISABLE_CNAME_SUPPORT=true
|
||||
'';
|
||||
sops.templates."traefik.env".reloadUnits = [ "traefik.service" ];
|
||||
# services.borgmatic.settings.traefikql_databases = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue