docs: improve some parts
This commit is contained in:
34 files changed
+932
-123
No files matched your search
@@ -83,7 +83,7 @@ Whether to enable AmneziaWG client profiles\.
|
||||
AWG 3\.1 kernel module package\. ` null `: userspace only\.
|
||||
|
||||
**Type:** null or package\
|
||||
**Default:** `<derivation amneziawg-3.1.20260828>`
|
||||
**Default:** ` amneziawg ` from ` boot.kernelPackages ` on NixOS, ` null ` elsewhere
|
||||
|
||||
<a id="services-proxy-suite-amneziawg-profiles"></a>
|
||||
## services\.proxy-suite\.amneziaWg\.profiles
|
||||
@@ -152,7 +152,7 @@ host:port (IPv6 in brackets) that replaces the first peer’s endpoint\.
|
||||
Interface name, at most 15 characters\.
|
||||
|
||||
**Type:** string matching the pattern ^\[A-Za-z0-9_\.-]{1,15}$\
|
||||
**Default:** `"awg-‹name›"`
|
||||
**Default:** `"awg-<name>"`
|
||||
|
||||
<a id="services-proxy-suite-amneziawg-profiles-name-settings"></a>
|
||||
## services\.proxy-suite\.amneziaWg\.profiles\.\<name>\.settings
|
||||
@@ -542,7 +542,7 @@ File with a vpn:// export\.
|
||||
AWG 3\.1 package with ` awg ` and ` awg-quick `\.
|
||||
|
||||
**Type:** package\
|
||||
**Default:** `<derivation amneziawg-tools-3.1.20260812>`
|
||||
**Default:** proxy-suite’s patched ` amneziawg-tools ` (` pkgs/amneziawg.nix `)
|
||||
|
||||
<a id="services-proxy-suite-amneziawg-userspacepackage"></a>
|
||||
## services\.proxy-suite\.amneziaWg\.userspacePackage
|
||||
@@ -550,7 +550,7 @@ AWG 3\.1 package with ` awg ` and ` awg-quick `\.
|
||||
AWG 3\.1 userspace implementation, used when the kernel module is unavailable\.
|
||||
|
||||
**Type:** package\
|
||||
**Default:** `<derivation amneziawg-go-3.1.20260828>`
|
||||
**Default:** proxy-suite’s patched ` amneziawg-go ` (` pkgs/amneziawg.nix `)
|
||||
|
||||
<a id="services-proxy-suite-amneziawg-wireproxypackage"></a>
|
||||
## services\.proxy-suite\.amneziaWg\.wireproxyPackage
|
||||
@@ -558,4 +558,4 @@ AWG 3\.1 userspace implementation, used when the kernel module is unavailable\.
|
||||
wireproxy build with AWG 3\.1, used by profiles with ` asOutbound = "userspace" `\.
|
||||
|
||||
**Type:** package\
|
||||
**Default:** `<derivation wireproxy-awg-1.0.18>`
|
||||
**Default:** proxy-suite’s ` wireproxy-awg ` (` pkgs/wireproxy-awg.nix `)
|
||||
@@ -41,11 +41,11 @@ Whether to enable proxy-suite\.
|
||||
services.proxy-suite = {
|
||||
amneziaWg = {
|
||||
enable = false;
|
||||
kernelModulePackage = pkgs.amneziawg;
|
||||
kernelModulePackage = ‹amneziawg from boot.kernelPackages on NixOS, null elsewhere›;
|
||||
profiles = { };
|
||||
toolsPackage = pkgs.amneziawg-tools;
|
||||
userspacePackage = pkgs.amneziawg-go;
|
||||
wireproxyPackage = pkgs.wireproxy-awg;
|
||||
toolsPackage = ‹proxy-suite's patched amneziawg-tools (pkgs/amneziawg.nix)›;
|
||||
userspacePackage = ‹proxy-suite's patched amneziawg-go (pkgs/amneziawg.nix)›;
|
||||
wireproxyPackage = ‹proxy-suite's wireproxy-awg (pkgs/wireproxy-awg.nix)›;
|
||||
};
|
||||
enable = false;
|
||||
geodata = {
|
||||
@@ -66,7 +66,7 @@ services.proxy-suite = {
|
||||
enable = false;
|
||||
listeners = { };
|
||||
openFirewall = true;
|
||||
package = pkgs.xray;
|
||||
package = ‹proxy-suite's xray (pkgs/xray.nix)›;
|
||||
routing = {
|
||||
blockPrivate = true;
|
||||
blockRu = true;
|
||||
@@ -160,7 +160,7 @@ services.proxy-suite = {
|
||||
strategy = null;
|
||||
};
|
||||
enable = false;
|
||||
ipv6 = true;
|
||||
ipv6 = config.networking.enableIPv6;
|
||||
listener = {
|
||||
address = "127.0.0.1";
|
||||
auth = {
|
||||
@@ -203,7 +203,7 @@ services.proxy-suite = {
|
||||
selectionExclude = [ ];
|
||||
singBox = {
|
||||
clashApiPort = 9090;
|
||||
package = pkgs.sing-box;
|
||||
package = ‹sing-box from proxy-suite's own nixpkgs input›;
|
||||
};
|
||||
subscriptionUpdateInterval = "1d";
|
||||
subscriptions = [ ];
|
||||
@@ -230,7 +230,7 @@ services.proxy-suite = {
|
||||
url = "https://www.gstatic.com/generate_204";
|
||||
};
|
||||
xray = {
|
||||
package = pkgs.xray;
|
||||
package = ‹proxy-suite's xray (pkgs/xray.nix)›;
|
||||
};
|
||||
};
|
||||
sshProxy = {
|
||||
@@ -322,7 +322,7 @@ services.proxy-suite = {
|
||||
creators = { };
|
||||
enable = false;
|
||||
joiners = { };
|
||||
package = pkgs.whitelist-bypass;
|
||||
package = ‹proxy-suite's whitelist-bypass (pkgs/whitelist-bypass.nix)›;
|
||||
};
|
||||
zapret = {
|
||||
cidrExemption = {
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
|
||||
proxy = {
|
||||
enable = true;
|
||||
backend = "sing-box"; # or "xray", "hybrid"
|
||||
|
||||
# `url` ends up in the Nix store; use `urlFile` for secrets.
|
||||
outbounds = [ { tag = "nl-vps"; url = "hy2://password@example.com:443?sni=example.com"; } ];
|
||||
subscriptions = [ { tag = "main-sub"; urlFile = "/run/secrets/sub-url"; } ];
|
||||
selection = "urltest"; # pick the fastest; default "first"
|
||||
|
||||
tproxy.enable = true;
|
||||
tun.enable = true;
|
||||
};
|
||||
|
||||
perAppRouting = {
|
||||
enable = true;
|
||||
createDefaultProfiles = true;
|
||||
proxychains.enable = true;
|
||||
tun.enable = true;
|
||||
tproxy.enable = true;
|
||||
zapret.enable = true;
|
||||
};
|
||||
|
||||
zapret.enable = true;
|
||||
|
||||
sshProxy = {
|
||||
enable = true;
|
||||
server = {
|
||||
user = "root";
|
||||
host = "ssh.example.com";
|
||||
};
|
||||
identityFile = "/run/secrets/proxy-suite-ssh-key";
|
||||
hostKeyFile = "/run/secrets/proxy-suite-ssh-known-hosts";
|
||||
};
|
||||
|
||||
# Only one global tunnel (AWG, TUN or TProxy) runs at a time.
|
||||
amneziaWg = {
|
||||
enable = true;
|
||||
profiles.home.configFile = "/run/secrets/home-amneziawg.conf";
|
||||
profiles.work.vpnFile = "/run/secrets/work-amnezia.vpn";
|
||||
# Or use a profile as an outbound, tagged "de":
|
||||
profiles.de = {
|
||||
asOutbound = "interface"; # or "userspace" (no root), "singBox" (plain WireGuard)
|
||||
configFile = "/run/secrets/de-amneziawg.conf";
|
||||
};
|
||||
};
|
||||
|
||||
warp = {
|
||||
enable = true;
|
||||
asOutbound = "singBox"; # outbound tagged "warp"
|
||||
# asAmneziaWg = true; # or a global profile: proxy-ctl awg on warp
|
||||
};
|
||||
|
||||
# Outbound tagged "tor"; .onion names always go there.
|
||||
tor = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
# bridges.file = "/run/secrets/tor-bridges";
|
||||
# upstream = "proxy"; # reach Tor through the proxy
|
||||
};
|
||||
|
||||
tgWsProxy = {
|
||||
enable = true;
|
||||
secretFile = "/run/secrets/tg-ws-proxy-secret";
|
||||
};
|
||||
|
||||
# Tunnel through a video call. A creator runs on a free server and logs the call link;
|
||||
# the joiner here is an outbound tagged "wl".
|
||||
whitelistBypass = {
|
||||
enable = true;
|
||||
creators.phone = { platform = "wbstream"; cookiesFile = "/run/secrets/wb-cookies.json"; };
|
||||
# joiners.wl = { platform = "wbstream"; linkFile = "/run/secrets/wb-link"; };
|
||||
};
|
||||
|
||||
gui.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
amneziaWg = {
|
||||
enable = true;
|
||||
profiles.home.configFile = "/run/secrets/home-awg.conf";
|
||||
profiles.work = {
|
||||
vpnFile = "/run/secrets/work-amnezia.vpn";
|
||||
autostart = true; # at most one profile
|
||||
};
|
||||
};
|
||||
killSwitch.enable = true; # optional: no leaks while the tunnel is down
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy.enable = true;
|
||||
amneziaWg = {
|
||||
enable = true;
|
||||
profiles.de = {
|
||||
configFile = "/run/secrets/de-awg.conf";
|
||||
asOutbound = "interface";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [
|
||||
{ tag = "hop"; urlFile = "/run/secrets/hop-url"; }
|
||||
{ tag = "de-vps"; urlFile = "/run/secrets/de-vps-url"; detour = "hop"; }
|
||||
];
|
||||
selectionExclude = [ "hop" ]; # never picked as the exit on its own
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
routing.rules = [
|
||||
{ domains = [ "chatgpt.com" "openai.com" ]; outbound = "warp"; }
|
||||
{ domains = [ "check.torproject.org" ]; outbound = "tor"; }
|
||||
];
|
||||
};
|
||||
|
||||
# Tagged "warp". Registers a free WARP device on first start.
|
||||
warp = {
|
||||
enable = true;
|
||||
asOutbound = "singBox";
|
||||
};
|
||||
|
||||
# Tagged "tor". .onion names always go to it.
|
||||
tor = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
};
|
||||
|
||||
# Tagged "ssh-proxy".
|
||||
sshProxy = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
server = { user = "me"; host = "ssh.example.com"; };
|
||||
identityFile = "/run/secrets/ssh-key";
|
||||
hostKeyFile = "/run/secrets/ssh-known-hosts"; # from ssh-keyscan
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
subscriptions = [ { tag = "provider"; urlFile = "/run/secrets/provider-sub-url"; } ];
|
||||
selection = "urltest";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
};
|
||||
gui.enable = true;
|
||||
userControl = {
|
||||
enable = true;
|
||||
scopes = [ "services" "routing" "outbounds" "perApp" ];
|
||||
};
|
||||
};
|
||||
users.users.alice.extraGroups = [ "proxy-suite" ];
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
{ ... }:
|
||||
let
|
||||
# Telegram apps dial their data centres by IP, so names alone do not catch them
|
||||
# (https://core.telegram.org/resources/cidr.txt).
|
||||
telegramIps = [
|
||||
"91.105.192.0/23"
|
||||
"91.108.4.0/22"
|
||||
"91.108.8.0/22"
|
||||
"91.108.12.0/22"
|
||||
"91.108.16.0/22"
|
||||
"91.108.20.0/22"
|
||||
"91.108.56.0/22"
|
||||
"149.154.160.0/20"
|
||||
"185.76.151.0/24"
|
||||
"2001:67c:4e8::/48"
|
||||
"2001:b28:f23c::/48"
|
||||
"2001:b28:f23d::/48"
|
||||
"2001:b28:f23f::/48"
|
||||
"2a0a:f280::/32"
|
||||
];
|
||||
in
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "primary"; urlFile = "/run/secrets/proxy-primary-url"; } ];
|
||||
|
||||
routing = {
|
||||
# Unlisted sites leave directly, where zapret2 unblocks what DPI blocks.
|
||||
default = "direct";
|
||||
# Russian sites are routed by the last rule below instead.
|
||||
directRu = false;
|
||||
|
||||
# Checked in order; the first match wins.
|
||||
rules = [
|
||||
{
|
||||
outbound = "ssh-proxy";
|
||||
geosites = [ "pixiv" "twitter" ];
|
||||
}
|
||||
{
|
||||
outbound = "warp";
|
||||
geosites = [ "youtube" ];
|
||||
}
|
||||
# To mask your IP from Russian services
|
||||
{
|
||||
outbound = "warp";
|
||||
geosites = [ "category-ru" ];
|
||||
geoips = [ "ru" ];
|
||||
}
|
||||
];
|
||||
|
||||
# Through the selected outbound ("primary").
|
||||
proxy = {
|
||||
geosites = [ "openai" "anthropic" "telegram" "netflix" ];
|
||||
ips = telegramIps;
|
||||
# WARP registers through the proxy: its API is blocked directly in Russia.
|
||||
domains = [ "api.cloudflareclient.com" ];
|
||||
};
|
||||
};
|
||||
|
||||
# For blocked sites no list names yet. YouTube is pinned to WARP above, so it
|
||||
# is kept out of the probes.
|
||||
autoProxy = {
|
||||
enable = true;
|
||||
exclude = [ "googlevideo.com" "gvt1.com" ];
|
||||
};
|
||||
};
|
||||
|
||||
warp = {
|
||||
enable = true;
|
||||
asOutbound = "singBox";
|
||||
};
|
||||
|
||||
sshProxy = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
server = {
|
||||
user = "me";
|
||||
host = "203.0.113.20";
|
||||
port = 2222;
|
||||
};
|
||||
identityFile = "/run/secrets/proxy-ssh-key";
|
||||
hostKeyFile = "/run/secrets/proxy-ssh-known-hosts";
|
||||
};
|
||||
|
||||
# Tor through the proxy, since this network blocks Tor.
|
||||
tor = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
upstream = "proxy";
|
||||
};
|
||||
|
||||
zapret = {
|
||||
enable = true;
|
||||
engine = "zapret2";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
{ ... }:
|
||||
let
|
||||
interface = "awg0";
|
||||
serverAddress = "10.77.77.1";
|
||||
privateDomains = [ "mail.example.com" ];
|
||||
in
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "primary"; urlFile = "/run/secrets/proxy-primary-url"; } ];
|
||||
};
|
||||
|
||||
inbounds = {
|
||||
enable = true;
|
||||
routing.via = "proxy";
|
||||
listeners.vpn = {
|
||||
type = "amneziawg";
|
||||
port = 51820;
|
||||
# Fixed addresses, so firewall rules and DNS can name each device. Keys are
|
||||
# generated on first start.
|
||||
users = [
|
||||
{ name = "laptop"; address = "10.77.77.2"; }
|
||||
{ name = "phone"; address = "10.77.77.3"; }
|
||||
];
|
||||
amneziaWg = {
|
||||
# Devices also reach this host, its LAN and each other, directly.
|
||||
mode = "lan";
|
||||
interfaceName = interface;
|
||||
subnet = "10.77.77.0/24";
|
||||
subnet6 = "fd77:77:77::/64";
|
||||
mtu = 1400;
|
||||
dns = [ serverAddress ];
|
||||
# Optional: a fixed server key, so client configs survive a reinstall.
|
||||
privateKeyFile = "/run/secrets/awg-server-key";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Private names for VPN clients; everything else is forwarded to 1.1.1.1.
|
||||
services.dnsmasq = {
|
||||
enable = true;
|
||||
resolveLocalQueries = false;
|
||||
settings = {
|
||||
bind-dynamic = true;
|
||||
interface = interface;
|
||||
listen-address = serverAddress;
|
||||
no-resolv = true;
|
||||
server = [ "1.1.1.1" ];
|
||||
address = map (domain: "/${domain}/${serverAddress}") privateDomains;
|
||||
};
|
||||
};
|
||||
# The interface comes and goes with the listener.
|
||||
systemd.services.dnsmasq = {
|
||||
after = [ "proxy-suite-inbounds-awg.service" ];
|
||||
wants = [ "proxy-suite-inbounds-awg.service" ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
{ config, lib, ... }:
|
||||
let
|
||||
domain = "vpn.example.com";
|
||||
certDir = config.security.acme.certs.${domain}.directory;
|
||||
|
||||
users = map (name: { inherit name; uuidFile = "/run/secrets/proxy-uuid-${name}"; }) [
|
||||
"alice"
|
||||
"bob"
|
||||
"carol"
|
||||
];
|
||||
|
||||
# The listeners terminate TLS themselves, so share links honestly say security=tls.
|
||||
tls = {
|
||||
enable = true;
|
||||
certificateFile = "${certDir}/fullchain.pem";
|
||||
keyFile = "${certDir}/key.pem";
|
||||
serverName = domain;
|
||||
};
|
||||
|
||||
# nginx on 443 hands a path to a loopback listener.
|
||||
fronted = port: path: extra: {
|
||||
type = "vless";
|
||||
inherit port users;
|
||||
address = "127.0.0.1";
|
||||
sharePort = 443; # share links name nginx's port, not the listener's
|
||||
transport = extra // {
|
||||
inherit path;
|
||||
# nginx sets this header, so XRay sees each client's real address (for
|
||||
# `proxy-ctl inbounds online`). A client cannot forge it: nginx overwrites it.
|
||||
trustedXForwardedFor = [ "X-Real-IP" ];
|
||||
};
|
||||
inherit tls;
|
||||
};
|
||||
location = port: extra: {
|
||||
proxyPass = "https://127.0.0.1:${toString port}";
|
||||
extraConfig = ''
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_ssl_server_name on;
|
||||
proxy_ssl_name ${domain};
|
||||
# Tunnels idle along with their users; the 60s default would cut them.
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
''
|
||||
+ extra;
|
||||
};
|
||||
in
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "primary"; urlFile = "/run/secrets/proxy-primary-url"; } ];
|
||||
};
|
||||
|
||||
inbounds = {
|
||||
enable = true;
|
||||
serverAddress = domain;
|
||||
routing.via = "proxy";
|
||||
|
||||
listeners = {
|
||||
# nginx speaks HTTP/1.1 to the listener, which only packet-up mode crosses.
|
||||
xhttp = fronted 10003 "/media" {
|
||||
type = "xhttp";
|
||||
mode = "packet-up";
|
||||
};
|
||||
ws = fronted 10002 "/media-ws" { type = "ws"; };
|
||||
# stream-one needs HTTP/2 all the way: nginx's grpc_pass provides it.
|
||||
xhttp-stream = lib.recursiveUpdate (fronted 10004 "/media-stream" {
|
||||
type = "xhttp";
|
||||
mode = "stream-one";
|
||||
}) { tls.alpn = [ "h2" ]; };
|
||||
|
||||
# HTTP/3 takes UDP 443 only, beside nginx on TCP 443. No trustedXForwardedFor:
|
||||
# nothing is in front, so it already sees the real client.
|
||||
xhttp-h3 = {
|
||||
type = "vless";
|
||||
port = 443;
|
||||
inherit users;
|
||||
transport = { type = "xhttp"; path = "/media-h3"; };
|
||||
tls = tls // { alpn = [ "h3" ]; };
|
||||
};
|
||||
|
||||
reality = {
|
||||
type = "vless";
|
||||
port = 2053;
|
||||
inherit users;
|
||||
flow = "xtls-rprx-vision";
|
||||
reality = {
|
||||
enable = true;
|
||||
# Probes without the key land on a real TLS 1.3 + HTTP/2 site.
|
||||
dest = "www.samsung.com:443";
|
||||
serverNames = [ "www.samsung.com" ];
|
||||
privateKeyFile = "/run/secrets/proxy-reality-key";
|
||||
publicKey = "jNXH…";
|
||||
shortIds = [ "0123abcd" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
subscriptions = {
|
||||
enable = true;
|
||||
baseUrl = "https://${domain}/sub";
|
||||
};
|
||||
};
|
||||
|
||||
userControl.enable = true; # passwordless proxy-ctl for the admin, see below
|
||||
};
|
||||
|
||||
users.users.admin.extraGroups = [ "proxy-suite" ];
|
||||
|
||||
security.acme = {
|
||||
acceptTerms = true;
|
||||
defaults.email = "admin@example.com";
|
||||
# A renewed certificate restarts the listeners.
|
||||
certs.${domain}.reloadServices = [ "proxy-suite-inbounds.service" ];
|
||||
};
|
||||
systemd.services.proxy-suite-inbounds = {
|
||||
wants = [ "acme-${domain}.service" ];
|
||||
after = [ "acme-${domain}.service" ];
|
||||
};
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts.${domain} = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
locations = {
|
||||
# A prefix match: XHTTP appends /<session>/<seq>.
|
||||
"/media" = location 10003 ''
|
||||
proxy_http_version 1.1;
|
||||
proxy_request_buffering off;
|
||||
proxy_buffering off;
|
||||
client_max_body_size 0;
|
||||
'';
|
||||
"= /media-ws" = location 10002 "" // { proxyWebsockets = true; };
|
||||
"/media-stream".extraConfig = ''
|
||||
grpc_pass grpcs://127.0.0.1:10004;
|
||||
grpc_set_header X-Forwarded-For $remote_addr;
|
||||
grpc_set_header X-Real-IP $remote_addr;
|
||||
grpc_ssl_server_name on;
|
||||
grpc_ssl_name ${domain};
|
||||
grpc_read_timeout 3600s;
|
||||
grpc_send_timeout 3600s;
|
||||
client_max_body_size 0;
|
||||
'';
|
||||
# Subscriptions. Some clients show profile-title and follow profile-update-interval.
|
||||
"/sub/".extraConfig = ''
|
||||
alias /run/proxy-suite-inbounds/subscriptions/;
|
||||
default_type text/plain;
|
||||
autoindex off;
|
||||
add_header profile-title "My VPN" always;
|
||||
add_header profile-update-interval "12" always;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
proxySuite = config.lib.proxy-suite;
|
||||
in
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
|
||||
proxy = {
|
||||
enable = true;
|
||||
# The server's subscription: every listener, each a separate outbound.
|
||||
subscriptions = [ { tag = "home"; urlFile = "/run/secrets/proxy-home-sub"; } ];
|
||||
# The fastest listener that gets through the current network.
|
||||
selection = "urltest";
|
||||
urlTest.url = "https://telegram.org"; # blocked here, so a pass means it works
|
||||
|
||||
routing.default = "direct";
|
||||
autoProxy.enable = true;
|
||||
tun.enable = true; # when everything should go through: proxy-ctl proxy tun on
|
||||
};
|
||||
|
||||
zapret = {
|
||||
enable = true;
|
||||
engine = "zapret2";
|
||||
};
|
||||
|
||||
# The private VPN: `proxy-ctl awg on home`.
|
||||
amneziaWg = {
|
||||
enable = true;
|
||||
profiles.home.configFile = "/run/secrets/home-vpn.conf";
|
||||
};
|
||||
killSwitch.enable = true;
|
||||
|
||||
perAppRouting = {
|
||||
enable = true;
|
||||
createDefaultProfiles = true;
|
||||
proxychains.enable = true;
|
||||
tun.enable = true;
|
||||
};
|
||||
|
||||
gui.enable = true;
|
||||
userControl.enable = true;
|
||||
};
|
||||
|
||||
users.users.me.extraGroups = [ "proxy-suite" ];
|
||||
|
||||
environment.systemPackages = [
|
||||
# CLIs that only work through the proxy, whatever the routing says.
|
||||
(proxySuite.wrapEnv { protocol = "all"; } pkgs.codex)
|
||||
(proxySuite.wrapEnv { } pkgs.claude-code)
|
||||
# A browser for blocked sites, with its UDP (QUIC) too.
|
||||
(proxySuite.wrapPerApp { profile = "tun"; } pkgs.chromium)
|
||||
];
|
||||
|
||||
# Nix downloads through the proxy.
|
||||
systemd.services.nix-daemon.environment = proxySuite.envFor "http";
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
};
|
||||
perAppRouting = {
|
||||
enable = true;
|
||||
createDefaultProfiles = true; # a profile named after each method below
|
||||
proxychains.enable = true;
|
||||
tun.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
};
|
||||
perAppRouting = {
|
||||
enable = true;
|
||||
tun.enable = true;
|
||||
profiles = [ { name = "browser"; route = "tun"; } ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
routing = {
|
||||
default = "direct";
|
||||
proxy.domains = [ "youtube.com" "googlevideo.com" ];
|
||||
proxy.geosites = [ "instagram" ];
|
||||
};
|
||||
# Find blocked sites on its own, and route each one through an exit that reaches it.
|
||||
autoProxy.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [
|
||||
{ tag = "nl-vps"; urlFile = "/run/secrets/nl-vps-url"; }
|
||||
{ tag = "us-vps"; urlFile = "/run/secrets/us-vps-url"; }
|
||||
];
|
||||
routing = {
|
||||
rules = [ { geosites = [ "netflix" ]; outbound = "us-vps"; } ];
|
||||
direct.domains = [ "bank.example" ];
|
||||
block.geosites = [ "category-ads-all" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
routing = {
|
||||
default = "direct";
|
||||
ruleSets.blocked.url = "https://example.com/blocked.srs";
|
||||
proxy.ruleSets = [ "blocked" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
inbounds = {
|
||||
enable = true;
|
||||
serverAddress = "vpn.example.com"; # null: this host's public IPv4
|
||||
routing.via = "direct"; # clients exit straight from this host
|
||||
listeners = {
|
||||
vless-reality = {
|
||||
type = "vless";
|
||||
port = 443;
|
||||
flow = "xtls-rprx-vision";
|
||||
users = [
|
||||
{ name = "phone"; uuidFile = "/run/secrets/uuid-phone"; }
|
||||
{ name = "laptop"; uuidFile = "/run/secrets/uuid-laptop"; }
|
||||
];
|
||||
reality = {
|
||||
enable = true;
|
||||
serverNames = [ "www.microsoft.com" ];
|
||||
privateKeyFile = "/run/secrets/reality-private-key";
|
||||
publicKey = "jNXH…"; # from the same `xray x25519` run
|
||||
shortIds = [ "0123abcd" ];
|
||||
};
|
||||
};
|
||||
# Keys for the server and each user are generated on first start.
|
||||
awg = {
|
||||
type = "amneziawg";
|
||||
port = 51820;
|
||||
users = [ { name = "phone"; } ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite.inbounds.subscriptions = {
|
||||
enable = true;
|
||||
baseUrl = "https://vpn.example.com/sub";
|
||||
};
|
||||
services.nginx.virtualHosts."vpn.example.com".locations."/sub/".alias =
|
||||
"/run/proxy-suite-inbounds/subscriptions/";
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
tun.enable = true;
|
||||
autostart = "tun"; # or null, to start it by hand
|
||||
};
|
||||
killSwitch.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
whitelistBypass = {
|
||||
enable = true;
|
||||
creators.laptop = {
|
||||
platform = "wbstream";
|
||||
cookiesFile = "/run/secrets/wbstream-cookies.json";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy.enable = true;
|
||||
whitelistBypass = {
|
||||
enable = true;
|
||||
joiners.wl.platform = "wbstream";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
proxySuite = config.lib.proxy-suite;
|
||||
in
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "my-vps"; urlFile = "/run/secrets/my-vps-url"; } ];
|
||||
};
|
||||
perAppRouting = {
|
||||
enable = true;
|
||||
createDefaultProfiles = true;
|
||||
proxychains.enable = true;
|
||||
tun.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = [
|
||||
(proxySuite.wrapEnv { } pkgs.yt-dlp)
|
||||
(proxySuite.wrapProxychains { } pkgs.telegram-desktop)
|
||||
(proxySuite.wrapPerApp { profile = "tun"; } pkgs.firefox)
|
||||
];
|
||||
|
||||
# A service: here nix-daemon, so downloads go through the proxy.
|
||||
systemd.services.nix-daemon.environment = proxySuite.envFor "http";
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
zapret = {
|
||||
enable = true;
|
||||
zapret-discord-youtube = {
|
||||
configName = "general(ALT)"; # the default; try others if it does not work
|
||||
domains = [ "rutracker.org" ]; # more sites to unblock
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
{
|
||||
services.proxy-suite = {
|
||||
enable = true;
|
||||
zapret = {
|
||||
enable = true;
|
||||
engine = "zapret2";
|
||||
zapret2.domains = [ "rutracker.org" ]; # always treated as blocked
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -7,14 +7,6 @@ listed. Everything runs in global TUN mode, so every app on the host follows the
|
||||
```nix
|
||||
{ ... }:
|
||||
let
|
||||
# Geosite "youtube" can miss the video and API hosts.
|
||||
youtubeDomains = [
|
||||
"googlevideo.com"
|
||||
"gvt1.com"
|
||||
"ytimg.com"
|
||||
"ggpht.com"
|
||||
"youtubei.googleapis.com"
|
||||
];
|
||||
# Telegram apps dial their data centres by IP, so names alone do not catch them
|
||||
# (https://core.telegram.org/resources/cidr.txt).
|
||||
telegramIps = [
|
||||
@@ -41,8 +33,6 @@ in
|
||||
proxy = {
|
||||
enable = true;
|
||||
outbounds = [ { tag = "primary"; urlFile = "/run/secrets/proxy-primary-url"; } ];
|
||||
tun.enable = true;
|
||||
autostart = "tun";
|
||||
|
||||
routing = {
|
||||
# Unlisted sites leave directly, where zapret2 unblocks what DPI blocks.
|
||||
@@ -52,24 +42,15 @@ in
|
||||
|
||||
# Checked in order; the first match wins.
|
||||
rules = [
|
||||
# Sites that reject both this host's and the VPS's networks.
|
||||
{
|
||||
outbound = "ssh-proxy";
|
||||
geosites = [ "pixiv" "twitter" ];
|
||||
}
|
||||
# Video throttled per connection by destination IP, which zapret cannot fix.
|
||||
# One exit for the whole session: video URLs are bound to the IP that asked.
|
||||
{
|
||||
outbound = "warp";
|
||||
domains = youtubeDomains;
|
||||
geosites = [ "youtube" ];
|
||||
}
|
||||
# A CDN that stalls through WARP but runs at full speed directly.
|
||||
{
|
||||
outbound = "direct";
|
||||
domains = [ "video-cdn.example" ];
|
||||
}
|
||||
# Russian services that refuse the VPS's foreign IP.
|
||||
# To mask your IP from Russian services
|
||||
{
|
||||
outbound = "warp";
|
||||
geosites = [ "category-ru" ];
|
||||
@@ -81,13 +62,12 @@ in
|
||||
proxy = {
|
||||
geosites = [ "openai" "anthropic" "telegram" "netflix" ];
|
||||
ips = telegramIps;
|
||||
# WARP registers through the proxy: its API is blocked directly.
|
||||
# WARP registers through the proxy: its API is blocked directly in Russia.
|
||||
domains = [ "api.cloudflareclient.com" ];
|
||||
};
|
||||
};
|
||||
|
||||
# For blocked sites no list names yet. YouTube is pinned to WARP above, so it
|
||||
# is kept out of the probes.
|
||||
# For blocked sites no list names yet. YouTube is pinned to WARP above, so it is kept out of the probes.
|
||||
autoProxy = {
|
||||
enable = true;
|
||||
exclude = [ "googlevideo.com" "gvt1.com" ];
|
||||
@@ -111,27 +91,11 @@ in
|
||||
hostKeyFile = "/run/secrets/proxy-ssh-known-hosts";
|
||||
};
|
||||
|
||||
# Tor through the proxy, since this network blocks Tor.
|
||||
tor = {
|
||||
enable = true;
|
||||
asOutbound = true;
|
||||
upstream = "proxy";
|
||||
};
|
||||
|
||||
zapret = {
|
||||
enable = true;
|
||||
engine = "zapret2";
|
||||
};
|
||||
};
|
||||
|
||||
# autoProxy probes in bursts (seconds of CPU, a few hundred MB). On a busy host, keep
|
||||
# it from competing with real work.
|
||||
systemd.services.proxy-suite-autoproxy.serviceConfig = {
|
||||
CPUWeight = 10;
|
||||
IOWeight = 10;
|
||||
Nice = 19;
|
||||
MemoryHigh = "200M";
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in new issue
Block a user