fix: hardening
This commit is contained in:
168 files changed
+9166
-1644
No files matched your search
@@ -21,6 +21,7 @@
|
||||
./geodata.nix
|
||||
./gui.nix
|
||||
./tui.nix
|
||||
./tools.nix
|
||||
./user-control.nix
|
||||
./kill-switch.nix
|
||||
./host.nix
|
||||
|
||||
@@ -46,6 +46,8 @@ in
|
||||
# UDP ports the host's firewall opens, as "port" or "from-to".
|
||||
openUdpPorts = internalOption (types.listOf types.str) [ ];
|
||||
resolvconfPackage = internalOption (types.nullOr types.package) null;
|
||||
# The users the host's enabled time daemons send NTP as; null where the host cannot say.
|
||||
timeSyncUsers = internalOption (types.nullOr (types.listOf types.str)) null;
|
||||
};
|
||||
|
||||
options.services.proxy-suite.internal = {
|
||||
@@ -64,6 +66,8 @@ in
|
||||
enable = internalOption types.bool false;
|
||||
pkexecWrapper = internalOption types.bool false;
|
||||
rules = internalOption types.lines "";
|
||||
# Action files by name ("<id>.policy"), for the polkit daemon to read.
|
||||
actions = internalOption (types.attrsOf types.path) { };
|
||||
};
|
||||
nftables = internalOption types.bool false;
|
||||
# nftables tables by name, family inet (NixOS only): NAT the firewall option cannot express.
|
||||
|
||||
@@ -61,11 +61,26 @@ in
|
||||
Ports of this host's other services that clients reach through the tunnel on
|
||||
`serverAddress` and `serverAliases`, such as mail, beside the listeners' own. Direct
|
||||
like those: a connection to this host from itself skips its firewall, so list only
|
||||
what the firewall already opens to the internet. TCP and UDP alike.
|
||||
what the firewall already opens to the internet. TCP and UDP alike. Any other port on
|
||||
any address of this host is refused where the inbounds dial "direct" themselves; the
|
||||
addresses are read as the inbounds start, so restart them after one changes (DHCP).
|
||||
Without `routing.serverSource` these connections come from this host's own address,
|
||||
which its services may trust: a mail server that relays for its own host (Postfix's
|
||||
default `mynetworks`) relays for every inbound user then. Set `serverSource`, or keep
|
||||
such services from trusting this host's own addresses.
|
||||
'';
|
||||
example = literalExpression "config.networking.firewall.allowedTCPPorts";
|
||||
};
|
||||
|
||||
accessLog = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Log every connection, with the user, their address and the site, to the journal of
|
||||
proxy-suite-inbounds: who went where, for anyone who can read the journal. On with
|
||||
`proxy.autoProxy` whatever this says, which learns from those lines.
|
||||
'';
|
||||
};
|
||||
openFirewall = bool true "Open the firewall for every listener not on loopback.";
|
||||
shareLinks = bool true "Generate client share links for `proxy-ctl inbounds link`. Readable by root, and by `userControl.group` with the secrets scope.";
|
||||
|
||||
@@ -111,7 +126,12 @@ in
|
||||
proxy = t.routingFields "that clients always reach through the local proxy, whatever the listener's `via`";
|
||||
|
||||
blockRu = bool true ''Block Russian destinations (geosite "category-ru", geoip "ru").'';
|
||||
blockPrivate = bool true "Block private and loopback addresses, so clients cannot reach this host's LAN or local services.";
|
||||
blockPrivate = bool true ''
|
||||
Block private and loopback addresses, so clients cannot reach this host's LAN or local
|
||||
services. Off, the LAN is open but this host is not. Either way, this host's own
|
||||
addresses (loopback, and its public ones as its interfaces carry them at start) are
|
||||
reachable only on the listener ports and `serverPorts`, whichever `via` a client takes.
|
||||
'';
|
||||
|
||||
zapretDirect = bool true "Send zapret hostlist sites direct, so this host's zapret unblocks them. Only for the default `via`. With a direct listener or the XRay backend, only by IP: XRay matches names by what a client puts in its handshake, whatever address it connects to.";
|
||||
|
||||
@@ -229,7 +249,10 @@ in
|
||||
default = [ ];
|
||||
description = ''
|
||||
`dest` values a runtime listener's fallbacks may use, such as a decoy site. A
|
||||
fallback to a `listener` must name another runtime listener.
|
||||
fallback to a `listener` must name another runtime listener. A runtime listener's
|
||||
`reality.dest` may be any public site on port 443; one on another port, on this host
|
||||
or on a private network must be listed here. Its `hysteria.masquerade` must be a
|
||||
public http(s) site, on port 80 or 443 unless its `host:port` is listed here.
|
||||
'';
|
||||
example = [ "127.0.0.1:8080" ];
|
||||
};
|
||||
|
||||
@@ -1,11 +1,73 @@
|
||||
{ lib, ... }:
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
inherit (import ./lib.nix { inherit lib; }) addressOrCidrType;
|
||||
hostTimeSyncUsers = config.services.proxy-suite.host.timeSyncUsers;
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.killSwitch.enable = lib.mkEnableOption "the kill switch" // {
|
||||
description = ''
|
||||
Block outgoing traffic that bypasses the active global tunnel (TUN, TProxy or a global
|
||||
AmneziaWG profile), including while it restarts or after it fails. LAN, DHCP and NTP stay
|
||||
open; `proxy.tproxy.lanInterfaces` devices keep the LAN but lose the internet. Only turning
|
||||
the tunnel off, or `proxy-ctl killswitch off`, lifts it.
|
||||
'';
|
||||
options.services.proxy-suite.killSwitch = {
|
||||
enable = lib.mkEnableOption "the kill switch" // {
|
||||
description = ''
|
||||
Block outgoing traffic that bypasses the active global tunnel (TUN, TProxy or a global
|
||||
AmneziaWG profile) from boot until the tunnel is up, while it restarts and after it
|
||||
fails. LAN, DHCP and the time daemons' NTP stay open. Forwarded traffic TProxy does not
|
||||
divert reaches the LAN only from `proxy.tproxy.lanInterfaces`. With TUN or a global
|
||||
AmneziaWG profile configured, containers' and VMs' traffic is held to the LAN too while
|
||||
neither that tunnel nor TProxy is up. Only turning the tunnel off with `proxy-ctl`, or
|
||||
`proxy-ctl killswitch off`, lifts it, until the next boot or tunnel start.
|
||||
'';
|
||||
};
|
||||
|
||||
directFallbacks = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether, with the kill switch on, a subscription that cannot be fetched through the
|
||||
tunnel is fetched once more directly, and WARP registers directly when the local proxy
|
||||
cannot carry it. Either shows that server this host's own address. Off, both go through
|
||||
the tunnel or not at all: a cold start with nothing cached then has no outbounds from
|
||||
that subscription, and a WARP device that is itself the tunnel cannot register.
|
||||
'';
|
||||
};
|
||||
|
||||
allowedSubnets = lib.mkOption {
|
||||
type = lib.types.listOf addressOrCidrType;
|
||||
default = config.services.proxy-suite.proxy.tproxy.localSubnets;
|
||||
defaultText = lib.literalExpression "config.services.proxy-suite.proxy.tproxy.localSubnets";
|
||||
description = ''
|
||||
Networks the kill switch leaves open besides the private and reserved ranges, such as
|
||||
a routed IPv6 prefix on a VM bridge, whichever global mode is on. The default keeps
|
||||
what TProxy leaves out reachable; set it to open a network without also taking it out
|
||||
of TProxy.
|
||||
'';
|
||||
example = [
|
||||
"192.168.0.0/16"
|
||||
"2001:db8:1::/64"
|
||||
];
|
||||
};
|
||||
|
||||
timeSyncUsers = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default =
|
||||
if hostTimeSyncUsers != null then
|
||||
hostTimeSyncUsers
|
||||
else
|
||||
[
|
||||
"systemd-timesync"
|
||||
"chrony"
|
||||
"_chrony"
|
||||
"ntp"
|
||||
"ntpsec"
|
||||
];
|
||||
defaultText = lib.literalMD ''
|
||||
the users of the enabled timesyncd, chrony, ntp and openntpd on NixOS; elsewhere
|
||||
`[ "systemd-timesync" "chrony" "_chrony" "ntp" "ntpsec" ]`
|
||||
'';
|
||||
description = ''
|
||||
Users that may send NTP (UDP port 123) past the kill switch. Users that do not exist
|
||||
are skipped when it starts. A daemon sending from port 123 itself, as ntpd does, needs
|
||||
no entry.
|
||||
'';
|
||||
example = [ "chrony" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -2,8 +2,31 @@
|
||||
{ lib }:
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
|
||||
octet = "(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])";
|
||||
ipv4 = "(${octet}\\.){3}${octet}";
|
||||
ipv4Prefix = "/(3[0-2]|[12]?[0-9])";
|
||||
# Loose on the groups (nft and ip reject a malformed one), strict on the characters.
|
||||
ipv6 = "[0-9A-Fa-f]{0,4}(:[0-9A-Fa-f]{0,4}){2,7}(:${ipv4})?";
|
||||
ipv6Prefix = "/(12[0-8]|1[01][0-9]|[1-9]?[0-9])";
|
||||
# A readable name in docs and errors in place of the pattern.
|
||||
matching =
|
||||
description: pattern:
|
||||
types.strMatching pattern
|
||||
// {
|
||||
inherit description;
|
||||
};
|
||||
in
|
||||
{
|
||||
# Interface names, addresses and CIDRs go into nft rules and scripts as they are: catch
|
||||
# typos early. An interface name is the kernel's (15 bytes at most), no leading "." or "-".
|
||||
interfaceType = matching "network interface name" "[A-Za-z0-9_][A-Za-z0-9_.+-]{0,14}";
|
||||
ipv4CidrType = matching "IPv4 CIDR" "${ipv4}${ipv4Prefix}";
|
||||
ipv6CidrType = matching "IPv6 CIDR" "${ipv6}${ipv6Prefix}";
|
||||
addressOrCidrType = matching "IPv4 or IPv6 address or CIDR" "(${ipv4}(${ipv4Prefix})?|${ipv6}(${ipv6Prefix})?)";
|
||||
# A listen address: an IP or a host name.
|
||||
hostType = matching "IP address or host name" "[A-Za-z0-9._:-]+";
|
||||
|
||||
list =
|
||||
description: example:
|
||||
mkOption {
|
||||
|
||||
@@ -3,11 +3,16 @@
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
t = import ./types.nix { inherit lib; };
|
||||
inherit (import ./lib.nix { inherit lib; }) int;
|
||||
inherit (import ./lib.nix { inherit lib; })
|
||||
int
|
||||
addressOrCidrType
|
||||
interfaceType
|
||||
ipv4CidrType
|
||||
;
|
||||
localSubnets =
|
||||
description:
|
||||
mkOption {
|
||||
type = types.listOf types.str;
|
||||
type = types.listOf addressOrCidrType;
|
||||
default = [ "192.168.0.0/16" ];
|
||||
inherit description;
|
||||
example = [
|
||||
@@ -64,15 +69,15 @@ in
|
||||
localSubnets = localSubnets "Subnets that skip the proxy (DNS still goes through it).";
|
||||
|
||||
interface = mkOption {
|
||||
type = types.str;
|
||||
type = interfaceType;
|
||||
default = "psperapptun0";
|
||||
description = "Interface name.";
|
||||
};
|
||||
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
type = ipv4CidrType;
|
||||
default = "172.20.0.1/30";
|
||||
description = "Interface address (CIDR).";
|
||||
description = "Interface IPv4 address (CIDR).";
|
||||
};
|
||||
|
||||
mtu = int 1400 "Interface MTU.";
|
||||
|
||||
@@ -41,6 +41,35 @@ in
|
||||
];
|
||||
};
|
||||
|
||||
runtimeSubscriptions = {
|
||||
allowHttp = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Let subscriptions added at runtime (`proxy-ctl proxy subs add`) be fetched over plain
|
||||
http. Anyone on the way can then add entries of their own.
|
||||
'';
|
||||
};
|
||||
allowInsecure = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Keep entries of subscriptions added at runtime that turn certificate checks off, as
|
||||
`subscriptions.*.allowInsecure` does for a declared one. Anyone on the way can then
|
||||
stand in for those servers.
|
||||
'';
|
||||
};
|
||||
allowPrivateServers = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Keep entries of subscriptions added at runtime whose server is a private address, as
|
||||
`subscriptions.*.allowPrivateServers` does for a declared one. Whoever can add a
|
||||
subscription then picks servers on your network.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
subscriptionUpdateInterval = mkOption {
|
||||
type = types.str;
|
||||
default = "1d";
|
||||
|
||||
@@ -72,8 +72,8 @@ in
|
||||
types.submodule {
|
||||
options = {
|
||||
url = mkOption {
|
||||
type = types.strMatching "https?://.+";
|
||||
description = "URL of the sing-box rule set.";
|
||||
type = types.strMatching "https://.+";
|
||||
description = "URL of the sing-box rule set (https only).";
|
||||
example = "https://example.com/antifilter.srs";
|
||||
};
|
||||
format = mkOption {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
inherit (import ./lib.nix { inherit lib; }) addressOrCidrType interfaceType;
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.proxy.tproxy = {
|
||||
@@ -32,7 +33,7 @@ in
|
||||
};
|
||||
|
||||
localSubnets = mkOption {
|
||||
type = types.listOf types.str;
|
||||
type = types.listOf addressOrCidrType;
|
||||
default = [ "192.168.0.0/16" ];
|
||||
description = "Subnets that skip the proxy, such as your LAN and VM bridges (DNS still goes through it). IPv6 works too.";
|
||||
example = [
|
||||
@@ -43,7 +44,7 @@ in
|
||||
};
|
||||
|
||||
lanInterfaces = mkOption {
|
||||
type = types.listOf types.str;
|
||||
type = types.listOf interfaceType;
|
||||
default = [ ];
|
||||
description = ''
|
||||
LAN interfaces whose devices use this host as their gateway. Their TCP and UDP goes through the
|
||||
|
||||
@@ -2,21 +2,22 @@
|
||||
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
inherit (import ./lib.nix { inherit lib; }) interfaceType ipv4CidrType;
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.proxy.tun = {
|
||||
enable = mkEnableOption "global TUN mode";
|
||||
|
||||
interface = mkOption {
|
||||
type = types.str;
|
||||
type = interfaceType;
|
||||
default = "singtun0";
|
||||
description = "TUN interface name.";
|
||||
};
|
||||
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
type = ipv4CidrType;
|
||||
default = "172.19.0.1/30";
|
||||
description = "TUN interface address (CIDR).";
|
||||
description = "TUN interface IPv4 address (CIDR).";
|
||||
};
|
||||
|
||||
mtu = mkOption {
|
||||
|
||||
@@ -13,6 +13,7 @@ let
|
||||
mkOption
|
||||
types
|
||||
;
|
||||
inherit (import ./lib.nix { inherit lib; }) hostType;
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.proxy = {
|
||||
@@ -51,15 +52,17 @@ in
|
||||
default = config.services.proxy-suite.host.enableIPv6;
|
||||
defaultText = literalExpression "config.networking.enableIPv6";
|
||||
description = ''
|
||||
Route IPv6 through TUN and TProxy too. When off, TProxy ignores IPv6 and the TUNs block
|
||||
it, so apps fall back to IPv4. If the uplink has no IPv6, also set
|
||||
`proxy.dns.strategy = "ipv4_only"`, or direct IPv6 connections hang instead of falling back.
|
||||
Route IPv6 through TUN and TProxy too. When off, TProxy refuses IPv6 past the LAN and
|
||||
on-link prefixes and the TUNs block it, so apps fall back to IPv4. If the uplink has no
|
||||
IPv6, also set `proxy.dns.strategy = "ipv4_only"`, or direct IPv6 connections hang
|
||||
instead of falling back.
|
||||
'';
|
||||
};
|
||||
|
||||
listener = {
|
||||
address = mkOption {
|
||||
type = types.str;
|
||||
# Also a line of proxychains' config.
|
||||
type = hostType;
|
||||
default = "127.0.0.1";
|
||||
description = ''Address of the local SOCKS5/HTTP proxy. Use "0.0.0.0" only to expose it to the network.'';
|
||||
};
|
||||
@@ -116,7 +119,11 @@ in
|
||||
probesPerRun = mkOption {
|
||||
type = types.ints.positive;
|
||||
default = 200;
|
||||
description = "Maximum destinations probed per run. The rest wait for the next run, most-used first.";
|
||||
description = ''
|
||||
Maximum destinations probed per run: of those asked for with `proxy-ctl proxy auto
|
||||
learn`, and again of those queued from traffic. The rest wait for the next run, the
|
||||
queued ones most-used first. A run also ends after two hours, its probes kept.
|
||||
'';
|
||||
};
|
||||
|
||||
maxExits = mkOption {
|
||||
|
||||
@@ -48,13 +48,13 @@ in
|
||||
type = types.listOf types.str;
|
||||
default = [ ];
|
||||
description = ''
|
||||
Accepted host keys, for sing-box. List every key `ssh-keyscan` prints, since the key type
|
||||
is negotiated.
|
||||
Accepted host keys, for sing-box, and for OpenSSH without `knownHostsFile`. List every
|
||||
key `ssh-keyscan` prints, since the key type is negotiated.
|
||||
'';
|
||||
example = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAI..." ];
|
||||
};
|
||||
|
||||
hostKeyFile = path "Known-hosts file to read host keys from (sing-box). Takes priority over `hostKey`." "/root/.ssh/known_hosts";
|
||||
hostKeyFile = path "Known-hosts file to read host keys from (sing-box, and OpenSSH without `knownHostsFile`). Takes priority over `hostKey`." "/root/.ssh/known_hosts";
|
||||
|
||||
# The rest only apply to the OpenSSH unit (XRay, or asOutbound = false).
|
||||
knownHostsFile = path "Known-hosts file for OpenSSH." "/run/secrets/proxy-suite-ssh-known-hosts";
|
||||
@@ -65,9 +65,13 @@ in
|
||||
"accept-new"
|
||||
"no"
|
||||
];
|
||||
default = "accept-new";
|
||||
description = "OpenSSH host key policy.";
|
||||
example = "yes";
|
||||
default = "yes";
|
||||
description = ''
|
||||
OpenSSH host key policy. "yes" needs the server's keys: `knownHostsFile`, or else
|
||||
`hostKeyFile` or `hostKey`. "accept-new" takes whatever key the first connection
|
||||
meets, which anyone on the way can answer then.
|
||||
'';
|
||||
example = "accept-new";
|
||||
};
|
||||
|
||||
# The local SOCKS5 listener the OpenSSH unit opens.
|
||||
@@ -81,14 +85,22 @@ in
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 1091;
|
||||
description = "Port of the OpenSSH SOCKS5 listener.";
|
||||
description = ''
|
||||
Port of the OpenSSH SOCKS5 listener. It takes no login: where it is the XRay backend's
|
||||
hop (`asOutbound`) on a host with root, only proxy-suite's daemons and root may
|
||||
connect to it. A standalone tunnel stays open to every local user.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
serviceUser = mkOption {
|
||||
type = token;
|
||||
# A user name as nft and systemd take one.
|
||||
type = types.nullOr (types.strMatching "[a-z_][a-z0-9_-]*[$]?");
|
||||
default = "proxy-suite-daemon";
|
||||
description = "User that runs OpenSSH. The default is sandboxed; `null` runs it as root.";
|
||||
description = ''
|
||||
User that runs OpenSSH. The default is sandboxed; `null` runs it as root. Another user's
|
||||
traffic gets past the kill switch, all of it: never a login user's.
|
||||
'';
|
||||
example = "proxy";
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
{ lib, ... }:
|
||||
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
in
|
||||
{
|
||||
# Heavy helpers proxy-ctl can do without; nix-on-droid leaves them out by default.
|
||||
options.services.proxy-suite.tools = {
|
||||
lnav.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
defaultText = lib.literalMD "`true`, `false` on nix-on-droid";
|
||||
description = ''
|
||||
Follow `proxy-ctl logs` in lnav. Without it they follow in less.
|
||||
'';
|
||||
};
|
||||
|
||||
curlImpersonate.enable = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
defaultText = lib.literalMD "`true`, `false` on nix-on-droid";
|
||||
description = ''
|
||||
Probe with curl-impersonate (`proxy-ctl proxy auto probe`, and autoProxy), which
|
||||
presents a browser's TLS fingerprint. Without it probes use plain curl, which some
|
||||
bot protection refuses, so a working exit can be judged blocked.
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -73,12 +73,17 @@ in
|
||||
socksPort = mkOption {
|
||||
type = types.port;
|
||||
default = 18530;
|
||||
description = "Loopback SOCKS port of Tor.";
|
||||
description = ''
|
||||
Loopback SOCKS port of Tor. Tor takes no login on it, so with `asOutbound` on a host with
|
||||
root only proxy-suite's daemons and root may connect to it; other users reach Tor
|
||||
through the proxy's own listener.
|
||||
'';
|
||||
};
|
||||
|
||||
bridges = {
|
||||
lines = mkOption {
|
||||
type = types.listOf types.str;
|
||||
# One torrc line each: a newline would add directives of its own.
|
||||
type = types.listOf (types.strMatching "[^\n]*");
|
||||
default = [ ];
|
||||
description = ''
|
||||
Bridge lines from https://bridges.torproject.org, without the leading "Bridge". Setting
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
let
|
||||
inherit (lib) mkOption types;
|
||||
inherit (import ./amnezia-wg.nix { inherit lib; }) obfuscationType;
|
||||
inherit (import ../lib.nix { inherit lib; }) nullStr;
|
||||
inherit (import ../lib.nix { inherit lib; }) nullStr ipv6CidrType;
|
||||
|
||||
# One inbound user, in `inbounds.users` under their name (shown in share links, subscriptions
|
||||
# and stats); listeners name the ones they accept.
|
||||
@@ -73,10 +73,14 @@ let
|
||||
'';
|
||||
};
|
||||
|
||||
subnet6 = nullStr ''
|
||||
Tunnel IPv6 subnet (ULA). `null`: IPv4 only. With `mode = "lan"` it turns on IPv6
|
||||
forwarding, which stops this host from configuring itself from router advertisements.
|
||||
'' "fd66:66::/64";
|
||||
subnet6 =
|
||||
nullStr ''
|
||||
Tunnel IPv6 subnet (ULA). `null`: IPv4 only. With `mode = "lan"` it turns on IPv6
|
||||
forwarding, which stops this host from configuring itself from router advertisements.
|
||||
'' "fd66:66::/64"
|
||||
// {
|
||||
type = types.nullOr ipv6CidrType;
|
||||
};
|
||||
|
||||
privateKeyFile = nullStr "File with the server private key, instead of a generated one." "/run/secrets/awg-server-key";
|
||||
|
||||
|
||||
@@ -35,6 +35,29 @@ let
|
||||
url = nullStr "Subscription URL. Ends up in the Nix store; prefer `urlFile`." "https://example.com/sub/token123";
|
||||
urlFile = nullStr "File with the subscription URL." "/run/secrets/proxy-subscription-url";
|
||||
detour = detourOption "every entry of this subscription";
|
||||
allowPrivateServers = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Keep entries whose server is a private address (10.0.0.0/8, 172.16.0.0/12,
|
||||
192.168.0.0/16, 100.64.0.0/10, fc00::/7), such as a subscription served on your own
|
||||
network. Entries pointing at this host (loopback, "localhost", unspecified) or at a
|
||||
link-local or multicast address are dropped either way: whoever serves the list picks
|
||||
the servers, and the fastest wins. Only literal addresses (and "localhost") are
|
||||
checked. For subscriptions added at runtime, see
|
||||
`proxy.runtimeSubscriptions.allowPrivateServers`.
|
||||
'';
|
||||
};
|
||||
allowInsecure = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
Keep entries that turn certificate checks off (`insecure=1`, for hysteria2 and
|
||||
AnyTLS on sing-box), as for a provider with self-signed certificates. Anyone on the
|
||||
way can then stand in for those servers. Dropped otherwise. For subscriptions added
|
||||
at runtime, see `proxy.runtimeSubscriptions.allowInsecure`.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -77,7 +77,19 @@ let
|
||||
};
|
||||
|
||||
nfqwsArgs = mkOption {
|
||||
type = types.listOf types.str;
|
||||
# They go into zapret's config inside double quotes, which its init script sources.
|
||||
type = types.listOf (
|
||||
types.addCheck types.str (
|
||||
arg:
|
||||
!builtins.any (c: lib.hasInfix c arg) [
|
||||
"\""
|
||||
"$"
|
||||
"`"
|
||||
"\\"
|
||||
"\n"
|
||||
]
|
||||
)
|
||||
);
|
||||
default = [ ];
|
||||
description = "Raw nfqws arguments; `--hostlist` and `--new` are added. Cannot be used with `configName`.";
|
||||
example = [ "--filter-tcp=443 --dpi-desync=fake,multisplit" ];
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
let
|
||||
inherit (lib) mkEnableOption mkOption types;
|
||||
t = import ./types.nix { inherit lib; };
|
||||
inherit (import ./lib.nix { inherit lib; }) list bool;
|
||||
inherit (import ./lib.nix { inherit lib; }) list bool addressOrCidrType;
|
||||
in
|
||||
{
|
||||
options.services.proxy-suite.zapret = {
|
||||
@@ -44,7 +44,9 @@ in
|
||||
# Shared by both engines: a netfilter-level bypass, not an engine-specific concept.
|
||||
cidrExemption = {
|
||||
enable = mkEnableOption "skipping zapret for some subnets, such as NATed VMs it would break";
|
||||
cidrs = list "Subnets zapret skips." [ "192.168.123.0/24" ];
|
||||
cidrs = list "Subnets zapret skips." [ "192.168.123.0/24" ] // {
|
||||
type = types.listOf addressOrCidrType;
|
||||
};
|
||||
};
|
||||
|
||||
zapret-discord-youtube = {
|
||||
|
||||
@@ -38,7 +38,7 @@ in
|
||||
};
|
||||
|
||||
blobs = mkOption {
|
||||
type = types.attrsOf types.str;
|
||||
type = types.attrsOf (types.strMatching "[^[:space:]]+");
|
||||
default = { };
|
||||
description = "Extra fake payloads by name (blob=<name>): a file in zapret2's files/fake, or an absolute path.";
|
||||
example = {
|
||||
@@ -47,14 +47,15 @@ in
|
||||
};
|
||||
|
||||
domains = mkOption {
|
||||
type = types.listOf types.str;
|
||||
# Each becomes one nfqws2 argument: whitespace would make more.
|
||||
type = types.listOf (types.strMatching "[^[:space:]]+");
|
||||
default = [ ];
|
||||
description = "Domains always treated as blocked. At runtime: `proxy-ctl zapret auto add`.";
|
||||
example = [ "rutracker.org" ];
|
||||
};
|
||||
|
||||
excludeDomains = mkOption {
|
||||
type = types.listOf types.str;
|
||||
type = types.listOf (types.strMatching "[^[:space:]]+");
|
||||
default = [ ];
|
||||
description = "Domains never touched or learned. At runtime: `proxy-ctl zapret auto exclude`.";
|
||||
example = [ "bank.example.com" ];
|
||||
|
||||
Reference in new issue
Block a user