stockholm/lass/2configs/paste.nix

65 lines
1.8 KiB
Nix
Raw Normal View History

2017-04-11 19:39:57 +00:00
{ config, pkgs, ... }:
with import <stockholm/lib>;
{
services.nginx.virtualHosts.paste = {
serverAliases = [ "p.r" ];
locations."/".extraConfig = ''
client_max_body_size 4G;
2017-04-11 19:39:57 +00:00
proxy_set_header Host $host;
2020-09-27 13:38:10 +00:00
proxy_pass http://127.0.0.1:${toString config.krebs.htgen.paste.port};
'';
locations."/image".extraConfig = /* nginx */ ''
client_max_body_size 40M;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:${toString config.krebs.htgen.imgur.port};
proxy_pass_header Server;
2017-04-11 19:39:57 +00:00
'';
};
services.nginx.virtualHosts."p.krebsco.de" = {
enableACME = true;
addSSL = true;
2019-04-13 19:41:58 +00:00
serverAliases = [ "p.krebsco.de" ];
locations."/".extraConfig = ''
if ($request_method != GET) {
return 403;
}
proxy_set_header Host $host;
2020-09-27 13:38:10 +00:00
proxy_pass http://127.0.0.1:${toString config.krebs.htgen.paste.port};
'';
locations."/image".extraConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:${toString config.krebs.htgen.imgur.port};
proxy_pass_header Server;
2019-04-13 19:41:58 +00:00
'';
};
2020-09-27 13:38:10 +00:00
2017-04-11 19:39:57 +00:00
krebs.htgen.paste = {
port = 9081;
script = toString [
"PATH=${makeBinPath [
pkgs.nix
2020-09-27 13:38:10 +00:00
pkgs.file
2017-04-11 19:39:57 +00:00
]}:$PATH"
"STATEDIR=$HOME"
". ${pkgs.htgen}/examples/paste"
];
};
2020-09-27 13:38:10 +00:00
krebs.htgen.imgur = {
port = 7771;
script = /* sh */ ''
(. ${pkgs.htgen-imgur}/bin/htgen-imgur)
'';
};
2017-04-11 19:39:57 +00:00
krebs.iptables.tables.filter.INPUT.rules = [
{ predicate = "-i retiolum -p tcp --dport 80"; target = "ACCEPT";}
];
}