summaryrefslogtreecommitdiffstats
path: root/lass/2configs/paste.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2023-09-09 19:42:08 +0200
committermakefu <github@syntax-fehler.de>2023-09-09 19:42:08 +0200
commit29d72c898d674d2c18fc0f4a76b5e623de0c3dfe (patch)
treefc4b0695c986a1cda6f1fbbbcbe716e203c54fa3 /lass/2configs/paste.nix
parente157ffa72856e4378aa23b096b2efff233f3cb3d (diff)
parent083229d0211096daec08673f743ccc45b1d8a0ac (diff)
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'lass/2configs/paste.nix')
-rw-r--r--lass/2configs/paste.nix141
1 files changed, 0 insertions, 141 deletions
diff --git a/lass/2configs/paste.nix b/lass/2configs/paste.nix
deleted file mode 100644
index 87768a452..000000000
--- a/lass/2configs/paste.nix
+++ /dev/null
@@ -1,141 +0,0 @@
-{ config, pkgs, ... }:
-with import <stockholm/lib>;
-
-{
- services.nginx.virtualHosts.cyberlocker = {
- serverAliases = [ "c.r" ];
- locations."/".extraConfig = ''
- client_max_body_size 4G;
- proxy_set_header Host $host;
- proxy_pass http://127.0.0.1:${toString config.krebs.htgen.cyberlocker.port};
- '';
- extraConfig = ''
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- '';
- };
- services.nginx.virtualHosts.paste = {
- serverAliases = [ "p.r" ];
- locations."/".extraConfig = ''
- client_max_body_size 4G;
- proxy_set_header Host $host;
- 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;
- '';
- extraConfig = ''
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- '';
- };
- services.nginx.virtualHosts."c.krebsco.de" = {
- enableACME = true;
- addSSL = true;
- serverAliases = [ "c.krebsco.de" ];
- locations."/".extraConfig = ''
- if ($request_method != GET) {
- return 403;
- }
- proxy_set_header Host $host;
- proxy_pass http://127.0.0.1:${toString config.krebs.htgen.cyberlocker.port};
- '';
- extraConfig = ''
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- '';
- };
- services.nginx.virtualHosts."p.krebsco.de" = {
- enableACME = true;
- addSSL = true;
- serverAliases = [ "p.krebsco.de" ];
- locations."/".extraConfig = ''
- proxy_set_header Host $host;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_pass http://127.0.0.1:${toString config.krebs.htgen.paste.port};
- '';
- locations."/form".extraConfig = ''
- client_max_body_size 4G;
- proxy_set_header Host $host;
- proxy_pass http://127.0.0.1:${toString config.krebs.htgen.paste-form.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;
- '';
- extraConfig = ''
- add_header 'Access-Control-Allow-Origin' '*';
- add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
- '';
- };
-
- krebs.htgen.paste = {
- port = 9081;
- script = /* sh */ ''
- (. ${pkgs.htgen-paste}/bin/htgen-paste)
- '';
- };
-
- systemd.services.paste-gc = {
- startAt = "daily";
- serviceConfig = {
- ExecStart = ''
- ${pkgs.findutils}/bin/find /var/lib/htgen-paste/items -type f -mtime '+30' -exec rm {} \;
- '';
- User = "htgen-paste";
- };
- };
-
- krebs.htgen.paste-form = {
- port = 7770;
- script = /* sh */ ''
- export PATH=${makeBinPath [
- pkgs.curl
- pkgs.gnused
- ]}:$PATH
- (. ${pkgs.writeScript "paste-form" ''
- case "$Method" in
- 'POST')
- ref=$(head -c $req_content_length | sed '0,/^\r$/d;$d' | curl -fSs --data-binary @- https://p.krebsco.de | sed '1d;s/^http:/https:/')
-
- printf 'HTTP/1.1 200 OK\r\n'
- printf 'Content-Type: text/plain; charset=UTF-8\r\n'
- printf 'Server: %s\r\n' "$Server"
- printf 'Connection: close\r\n'
- printf 'Content-Length: %d\r\n' $(expr ''${#ref} + 1)
- printf '\r\n'
- printf '%s\n' "$ref"
-
- exit
- ;;
- esac
- ''})
- '';
- };
- krebs.htgen.imgur = {
- port = 7771;
- script = /* sh */ ''
- (. ${pkgs.htgen-imgur}/bin/htgen-imgur)
- '';
- };
- krebs.htgen.cyberlocker = {
- port = 7772;
- script = /* sh */ ''
- (. ${pkgs.htgen-cyberlocker}/bin/htgen-cyberlocker)
- '';
- };
- krebs.iptables.tables.filter.INPUT.rules = [
- { predicate = "-i retiolum -p tcp --dport 80"; target = "ACCEPT";}
- ];
-}