2015-10-21 16:49:20 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
# 1systems should configure itself:
|
|
|
|
# krebs.bepasty.servers.internal.nginx.listen = [ "80" ]
|
|
|
|
# krebs.bepasty.servers.external.nginx.listen = [ "80" "443 ssl" ]
|
|
|
|
# 80 is redirected to 443 ssl
|
|
|
|
|
|
|
|
# secrets used:
|
|
|
|
# wildcard.krebsco.de.crt
|
|
|
|
# wildcard.krebsco.de.key
|
|
|
|
# bepasty-secret.nix <- contains single string
|
|
|
|
|
2016-10-20 18:54:38 +00:00
|
|
|
with import <stockholm/lib>;
|
2015-10-29 09:55:54 +00:00
|
|
|
let
|
|
|
|
sec = toString <secrets>;
|
|
|
|
# secKey is nothing worth protecting on a local machine
|
2017-04-11 19:37:37 +00:00
|
|
|
secKey = "${secrets}/bepasty-secret";
|
2016-07-18 13:34:46 +00:00
|
|
|
acmepath = "/var/lib/acme/";
|
|
|
|
acmechall = acmepath + "/challenges/";
|
|
|
|
ext-dom = "paste.krebsco.de" ;
|
2015-10-29 09:55:54 +00:00
|
|
|
in {
|
2015-10-21 16:49:20 +00:00
|
|
|
|
2016-12-24 22:38:01 +00:00
|
|
|
services.nginx.enable = mkDefault true;
|
2015-10-21 16:49:20 +00:00
|
|
|
krebs.bepasty = {
|
|
|
|
enable = true;
|
|
|
|
serveNginx= true;
|
|
|
|
|
|
|
|
servers = {
|
2016-12-24 23:21:54 +00:00
|
|
|
"paste.r" = {
|
2015-10-21 16:49:20 +00:00
|
|
|
nginx = {
|
2018-01-09 18:11:45 +00:00
|
|
|
serverAliases = [
|
|
|
|
"paste.${config.krebs.build.host.name}"
|
|
|
|
"paste.r"
|
|
|
|
];
|
2018-10-21 21:19:09 +00:00
|
|
|
extraConfig = ''
|
|
|
|
if ( $server_addr = "${external-ip}" ) {
|
|
|
|
return 403;
|
|
|
|
}
|
|
|
|
'';
|
2015-10-21 16:49:20 +00:00
|
|
|
};
|
|
|
|
defaultPermissions = "admin,list,create,read,delete";
|
2017-04-11 19:37:37 +00:00
|
|
|
secretKeyFile = secKey;
|
2015-10-21 16:49:20 +00:00
|
|
|
};
|
|
|
|
|
2016-12-24 23:21:54 +00:00
|
|
|
"${ext-dom}" = {
|
2015-10-21 16:49:20 +00:00
|
|
|
nginx = {
|
2016-12-24 22:38:01 +00:00
|
|
|
forceSSL = true;
|
|
|
|
enableACME = true;
|
2015-10-21 16:49:20 +00:00
|
|
|
};
|
|
|
|
defaultPermissions = "read";
|
2017-04-11 19:37:37 +00:00
|
|
|
secretKeyFile = secKey;
|
2015-10-21 16:49:20 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|