Skip to content

Commit

Permalink
only allow github and localhost to access the hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Mic92 authored and mergify[bot] committed Nov 12, 2023
1 parent e00c172 commit 507abe5
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions nix/modules/nixpkgs-merge-bot.nix
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,27 @@ in
"/run/nixpkgs-merge-bot.sock"
];
};
services.nginx.virtualHosts.${cfg.hostname} = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://unix:/run/nixpkgs-merge-bot.sock";
proxyWebsockets = true;
recommendedProxySettings = true;
services.nginx.virtualHosts.${cfg.hostname} =
let
ips = builtins.fromJSON (builtins.readFile ./github-webhook-ips.json);
in
{
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://unix:/run/nixpkgs-merge-bot.sock";
proxyWebsockets = true;
recommendedProxySettings = true;
extraConfig = ''
${lib.concatMapStringsSep "\n" (ip: "allow ${ip};") ips}
allow 127.0.0.1;
allow ::1;
# we also allow the IP of the server itself, so that can just use curl
allow 37.27.11.42;
allow 2a01:4f9:c012:7615::1;
deny all;
'';
};
};
};
};
}

0 comments on commit 507abe5

Please sign in to comment.