2023-02-15 19:35:46 +00:00
|
|
|
{ pkgs, config, ... }:
|
|
|
|
|
|
|
|
let
|
|
|
|
anonymous-overflow-pkg = pkgs.anonymous-overflow;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
systemd.services.anonymous-overflow = {
|
|
|
|
description = "View StackOverflow in privacy and without the clutter";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
after = [ "network.target" ];
|
|
|
|
serviceConfig = {
|
|
|
|
DynamicUser = true;
|
|
|
|
StateDirectory = "anonymous-overflow";
|
|
|
|
EnvironmentFile = [ config.age.secrets.anonymous-overflow-config.path ];
|
2023-02-15 21:04:11 +00:00
|
|
|
WorkingDirectory = "${anonymous-overflow-pkg}/share/anonymous-overflow";
|
2023-02-15 19:35:46 +00:00
|
|
|
ExecStart = "${anonymous-overflow-pkg}/bin/anonymousoverflow";
|
|
|
|
Restart = "on-failure";
|
|
|
|
RestartSec = "5s";
|
2023-02-15 23:43:22 +00:00
|
|
|
# Hardening
|
|
|
|
CapabilityBoundingSet = [ "" ];
|
|
|
|
DeviceAllow = [ "" ];
|
|
|
|
LockPersonality = true;
|
|
|
|
MemoryDenyWriteExecute = true;
|
|
|
|
PrivateDevices = true;
|
|
|
|
PrivateUsers = true;
|
|
|
|
ProcSubset = "pid";
|
|
|
|
ProtectClock = true;
|
|
|
|
ProtectControlGroups = true;
|
|
|
|
ProtectHome = true;
|
|
|
|
ProtectHostname = true;
|
|
|
|
ProtectKernelLogs = true;
|
|
|
|
ProtectKernelModules = true;
|
|
|
|
ProtectKernelTunables = true;
|
|
|
|
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" ];
|
|
|
|
RestrictNamespaces = true;
|
|
|
|
RestrictRealtime = true;
|
|
|
|
RestrictSUIDSGID = true;
|
2023-02-15 19:35:46 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.nginx = {
|
|
|
|
enable = true;
|
|
|
|
virtualHosts."anonymous-overflow.only.internal" = {
|
|
|
|
listen = [
|
|
|
|
{
|
|
|
|
addr = "127.0.0.1";
|
|
|
|
port = 80;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
|
2023-02-15 21:04:11 +00:00
|
|
|
root = "${anonymous-overflow-pkg}/share/anonymous-overflow/public/";
|
2023-02-15 19:35:46 +00:00
|
|
|
forceSSL = false;
|
|
|
|
enableACME = false;
|
|
|
|
|
|
|
|
locations."/" = {
|
2023-02-15 21:11:46 +00:00
|
|
|
basicAuthFile = config.age.secrets.anonymous-overflow-auth.path;
|
2023-02-15 21:04:11 +00:00
|
|
|
tryFiles = "$uri @proxy";
|
|
|
|
};
|
|
|
|
|
|
|
|
locations."@proxy" = {
|
2023-02-15 19:35:46 +00:00
|
|
|
recommendedProxySettings = true;
|
|
|
|
proxyPass = "http://127.0.0.1:8003";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|