120 lines
3.2 KiB
Nix
120 lines
3.2 KiB
Nix
{ lib, ... }:
|
|
|
|
let
|
|
inherit (lib) mkOption mkEnableOption types;
|
|
in
|
|
{
|
|
options.services.proxy-suite.proxy.tproxy = {
|
|
enable = mkEnableOption "global proxy TProxy mode service";
|
|
|
|
autostart = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Whether to start proxy-suite-tproxy automatically during boot by
|
|
attaching it to multi-user.target.
|
|
Cannot be enabled together with proxy.tun.autostart.
|
|
'';
|
|
example = true;
|
|
};
|
|
|
|
port = mkOption {
|
|
type = types.port;
|
|
default = 1085;
|
|
description = ''
|
|
Local listen port for the proxy backend's TProxy inbound.
|
|
nftables redirection created by proxy-suite-tproxy sends intercepted
|
|
TCP/UDP traffic to this port.
|
|
'';
|
|
example = 1085;
|
|
};
|
|
|
|
fwmark = mkOption {
|
|
type = types.int;
|
|
default = 1;
|
|
description = ''
|
|
Mark applied to intercepted packets in global TProxy mode.
|
|
A matching `ip rule` routes this mark to
|
|
proxy.tproxy.routeTable, which points traffic to
|
|
loopback for local proxy processing.
|
|
'';
|
|
example = 1;
|
|
};
|
|
|
|
proxyMark = mkOption {
|
|
type = types.int;
|
|
default = 2;
|
|
description = ''
|
|
Mark applied to backend egress packets in global TProxy mode so
|
|
they bypass re-interception and do not loop back into the
|
|
transparent proxy path.
|
|
'';
|
|
example = 2;
|
|
};
|
|
|
|
routeTable = mkOption {
|
|
type = types.int;
|
|
default = 100;
|
|
description = ''
|
|
Policy-routing table number used for global TProxy interception flow.
|
|
The module installs a local default route in this table and binds it
|
|
to proxy.tproxy.fwmark.
|
|
'';
|
|
example = 100;
|
|
};
|
|
|
|
localSubnets = mkOption {
|
|
type = types.listOf types.str;
|
|
default = [ "192.168.0.0/16" ];
|
|
description = ''
|
|
Subnets whose traffic bypasses global TProxy interception, except
|
|
DNS (port 53).
|
|
|
|
Typically this should include your LAN subnet(s). VM bridge networks
|
|
should usually go here too, or use zapret.cidrExemption for
|
|
subnet-specific NFQUEUE exemption on the zapret side.
|
|
'';
|
|
example = [
|
|
"192.168.0.0/16"
|
|
"10.0.0.0/8"
|
|
];
|
|
};
|
|
|
|
perApp = {
|
|
enable = mkEnableOption "per-app-scoped proxy TProxy backend for perAppRouting profiles";
|
|
|
|
fwmark = mkOption {
|
|
type = types.int;
|
|
default = 17;
|
|
description = ''
|
|
Packet mark used to steer wrapped app traffic into the per-app-scoped
|
|
TProxy policy-routing table.
|
|
'';
|
|
example = 17;
|
|
};
|
|
|
|
routeTable = mkOption {
|
|
type = types.int;
|
|
default = 102;
|
|
description = ''
|
|
Policy-routing table used by the per-app-scoped TProxy backend.
|
|
'';
|
|
example = 102;
|
|
};
|
|
|
|
localSubnets = mkOption {
|
|
type = types.listOf types.str;
|
|
default = [ "192.168.0.0/16" ];
|
|
description = ''
|
|
Subnets whose traffic bypasses per-app-scoped TProxy interception,
|
|
except DNS (port 53).
|
|
'';
|
|
example = [
|
|
"192.168.0.0/16"
|
|
"10.0.0.0/8"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
}
|