2024-03-22 11:38:29 +00:00
|
|
|
{ lib, ... }: {
|
2023-10-28 15:50:37 +00:00
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d '/srv/www/pub.solar' 0750 hakkonaut hakkonaut - -"
|
|
|
|
];
|
|
|
|
|
2023-10-28 14:26:02 +00:00
|
|
|
services.nginx.virtualHosts = {
|
2023-10-28 15:50:37 +00:00
|
|
|
"www.pub.solar" = {
|
|
|
|
enableACME = true;
|
|
|
|
addSSL = true;
|
2024-02-25 16:01:34 +00:00
|
|
|
|
|
|
|
extraConfig = ''
|
|
|
|
error_log /dev/null;
|
|
|
|
access_log /dev/null;
|
|
|
|
'';
|
|
|
|
|
2023-10-28 15:50:37 +00:00
|
|
|
locations."/" = {
|
|
|
|
extraConfig = ''
|
|
|
|
return 301 https://pub.solar$request_uri;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2023-10-28 14:26:02 +00:00
|
|
|
|
|
|
|
"pub.solar" = {
|
|
|
|
default = true;
|
|
|
|
enableACME = true;
|
2023-10-28 15:50:37 +00:00
|
|
|
forceSSL = true;
|
2023-10-28 14:26:02 +00:00
|
|
|
|
2024-02-25 16:01:34 +00:00
|
|
|
extraConfig = ''
|
|
|
|
error_log /dev/null;
|
|
|
|
access_log /dev/null;
|
|
|
|
'';
|
|
|
|
|
2023-10-28 14:26:02 +00:00
|
|
|
locations = {
|
|
|
|
# serve base domain pub.solar for mastodon.pub.solar
|
|
|
|
# https://masto.host/mastodon-usernames-different-from-the-domain-used-for-installation/
|
|
|
|
"/.well-known/host-meta" = {
|
|
|
|
extraConfig = ''
|
|
|
|
return 301 https://mastodon.pub.solar$request_uri;
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
# Tailscale OIDC webfinger requirement plus Mastodon webfinger redirect
|
|
|
|
"/.well-known/webfinger" = {
|
|
|
|
# Redirect requests that match /.well-known/webfinger?resource=* to Mastodon
|
|
|
|
extraConfig = ''
|
2023-10-28 15:50:37 +00:00
|
|
|
if ($arg_resource) {
|
2023-10-28 14:26:02 +00:00
|
|
|
return 301 https://mastodon.pub.solar$request_uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
add_header Content-Type text/plain;
|
|
|
|
return 200 '{\n "subject": "acct:admins@pub.solar",\n "links": [\n {\n "rel": "http://openid.net/specs/connect/1.0/issuer",\n "href": "https://auth.pub.solar/realms/pub.solar"\n }\n ]\n}';
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-03-22 11:38:29 +00:00
|
|
|
# Responsible disclosure information https://securitytxt.org/
|
|
|
|
"/.well-known/security.txt" = let
|
|
|
|
securityTXT = lib.lists.foldr (a: b: a + "\n" + b) "" [
|
|
|
|
"Contact: mailto:admins@pub.solar"
|
|
|
|
"Expires: 2025-01-04T23:00:00.000Z"
|
|
|
|
"Encryption: https://keys.openpgp.org/vks/v1/by-fingerprint/8A8987ADE3736C8CA2EB315A9B809EBBDD62BAE3"
|
|
|
|
"Preferred-Languages: en,de"
|
|
|
|
"Canonical: https://pub.solar/.well-known/security.txt"
|
|
|
|
];
|
|
|
|
in {
|
|
|
|
extraConfig = ''
|
|
|
|
add_header Content-Type text/plain;
|
|
|
|
return 200 '${securityTXT}';
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-10-28 14:26:02 +00:00
|
|
|
"/satzung" = {
|
|
|
|
extraConfig = ''
|
2023-11-15 18:48:36 +00:00
|
|
|
return 302 https://cloud.pub.solar/s/iaKqiW25QJpHPYs;
|
2023-10-28 14:26:02 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
"/" = {
|
|
|
|
root = "/srv/www/pub.solar";
|
|
|
|
index = "index.html";
|
2023-10-28 15:50:37 +00:00
|
|
|
tryFiles = "$uri $uri/ =404";
|
2023-10-28 14:26:02 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|