Add haproxy/mmproxy combo
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
42
hosts/jupiter/configs/mmproxy/default.nix
Normal file
42
hosts/jupiter/configs/mmproxy/default.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
inputs,
|
||||
system,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
selfPkgs = inputs.self.packages.${system};
|
||||
in
|
||||
{
|
||||
environment.systemPackages = [ selfPkgs.go-mmproxy ];
|
||||
|
||||
boot.kernel.sysctl."net.ipv4.conf.all.route_localnet" = 1;
|
||||
|
||||
networking = {
|
||||
iproute2 = {
|
||||
enable = true;
|
||||
rttablesExtraConfig = ''
|
||||
100 mmproxy
|
||||
'';
|
||||
};
|
||||
|
||||
localCommands =
|
||||
let
|
||||
ip = "${pkgs.iproute2}/bin/ip";
|
||||
iptables = "${pkgs.iptables}/bin/iptables";
|
||||
in
|
||||
''
|
||||
${iptables} -t mangle -D PREROUTING -m mark --mark 100 -m comment --comment mmproxy -j CONNMARK --save-mark || true
|
||||
${iptables} -t mangle -I PREROUTING -m mark --mark 100 -m comment --comment mmproxy -j CONNMARK --save-mark
|
||||
|
||||
${iptables} -t mangle -D OUTPUT -m connmark --mark 100 -m comment --comment mmproxy -j CONNMARK --restore-mark || true
|
||||
${iptables} -t mangle -I OUTPUT -m connmark --mark 100 -m comment --comment mmproxy -j CONNMARK --restore-mark
|
||||
|
||||
${ip} rule del fwmark 100 lookup 100 || true
|
||||
${ip} rule add fwmark 100 lookup 100
|
||||
|
||||
${ip} route del local 0.0.0.0/0 dev lo table 100 || true
|
||||
${ip} route add local 0.0.0.0/0 dev lo table 100
|
||||
'';
|
||||
};
|
||||
}
|
@@ -26,6 +26,7 @@
|
||||
../common/configs/system/users
|
||||
../common/configs/system/zsh
|
||||
|
||||
./configs/mmproxy
|
||||
./configs/wireguard
|
||||
|
||||
./users/storm
|
||||
|
Reference in New Issue
Block a user