add VR stuff and mitmproxy
This commit is contained in:
parent
bdbe95c141
commit
1d4d55fd2c
3 changed files with 46 additions and 3 deletions
24
modules/nixOS/features/mitmproxy.nix
Normal file
24
modules/nixOS/features/mitmproxy.nix
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{config, pkgs, lib, ...}: let
|
||||
localCfg = config.myNixOS.mitmproxy;
|
||||
in {
|
||||
options.myNixOS.mitmproxy = {
|
||||
routeAP = lib.mkEnableOption { default = true; };
|
||||
accessPoint = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
mitmPort = lib.mkOption { default = 8080; };
|
||||
};
|
||||
|
||||
environment.systemPackages = [ pkgs.mitmproxy ];
|
||||
|
||||
networking.firewall = lib.mkIf localCfg.routeAP {
|
||||
extraCommands = let
|
||||
accessPoint = localCfg.accessPoint;
|
||||
port = localCfg.mitmPort;
|
||||
in /*bash*/ ''
|
||||
iptables -t nat -A PREROUTING -i ${accessPoint} -p tcp --dport 80 -j REDIRECT --to-port ${builtins.toString port}
|
||||
iptables -t nat -A PREROUTING -i ${accessPoint} -p tcp --dport 443 -j REDIRECT --to-port ${builtins.toString port}
|
||||
'';
|
||||
allowedTCPPorts = [ localCfg.mitmPort ];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue