feat: whitelists bypass methods
This commit is contained in:
22 files changed
+716
-3
No files matched your search
@@ -8,7 +8,7 @@ Declarative proxy stack for NixOS, on either side of the connection: as a client
|
|||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> This project is developed with AI assistance: much of the code and documentation was written with AI tools, then reviewed and tested on real-world setups.
|
> This project is developed with AI assistance: much of the code and documentation was written with AI tools, then reviewed and tested on real-world setups.
|
||||||
|
|
||||||
Bundles [sing-box](https://github.com/SagerNet/sing-box), [XRay](https://github.com/XTLS/Xray-core), [AmneziaWG](https://github.com/amnezia-vpn/amneziawg-go), [zapret-discord-youtube](https://github.com/kartavkun/zapret-discord-youtube), [zapret2](https://github.com/bol-van/zapret2) and [tg-ws-proxy](https://github.com/Flowseal/tg-ws-proxy); see their repositories for their own licenses and documentation.
|
Bundles [sing-box](https://github.com/SagerNet/sing-box), [XRay](https://github.com/XTLS/Xray-core), [AmneziaWG](https://github.com/amnezia-vpn/amneziawg-go), [zapret-discord-youtube](https://github.com/kartavkun/zapret-discord-youtube), [zapret2](https://github.com/bol-van/zapret2), [tg-ws-proxy](https://github.com/Flowseal/tg-ws-proxy) and [whitelist-bypass](https://github.com/kulikov0/whitelist-bypass); see their repositories for their own licenses and documentation.
|
||||||
|
|
||||||
Inspired by [Throne](https://github.com/throneproj/Throne) (formerly NekoRay), [3x-ui](https://github.com/MHSanaei/3x-ui) and other similar projects.
|
Inspired by [Throne](https://github.com/throneproj/Throne) (formerly NekoRay), [3x-ui](https://github.com/MHSanaei/3x-ui) and other similar projects.
|
||||||
|
|
||||||
@@ -27,6 +27,7 @@ Inspired by [Throne](https://github.com/throneproj/Throne) (formerly NekoRay), [
|
|||||||
- Telegram MTProto WebSocket proxy and SSH SOCKS5 tunnel
|
- Telegram MTProto WebSocket proxy and SSH SOCKS5 tunnel
|
||||||
- Cloudflare WARP from a `wgcf` profile, as an outbound or an AWG VPN profile
|
- Cloudflare WARP from a `wgcf` profile, as an outbound or an AWG VPN profile
|
||||||
- Tor as an outbound, with `.onion` names routed to it automatically, bridges (obfs4, webtunnel, meek, snowflake), and an onion service in front of the server inbounds
|
- Tor as an outbound, with `.onion` names routed to it automatically, bridges (obfs4, webtunnel, meek, snowflake), and an onion service in front of the server inbounds
|
||||||
|
- Mobile internet whitelists: a tunnel through the media servers of video calls (WB Stream, Telemost, DION, Bitrix), with the creator on a server and the joiner as an outbound, Nix-on-Droid included
|
||||||
- Server inbounds (XRay protocols, hysteria2, and multi-user AmneziaWG) with share links, QR codes, per-user subscriptions and traffic stats
|
- Server inbounds (XRay protocols, hysteria2, and multi-user AmneziaWG) with share links, QR codes, per-user subscriptions and traffic stats
|
||||||
- Proxy Suite GUI (a desktop app with a tray icon), the `proxy-ctl` CLI, and the `proxy-tui` terminal UI
|
- Proxy Suite GUI (a desktop app with a tray icon), the `proxy-ctl` CLI, and the `proxy-tui` terminal UI
|
||||||
|
|
||||||
@@ -112,6 +113,14 @@ services.proxy-suite = {
|
|||||||
secretFile = "/run/secrets/tg-ws-proxy-secret";
|
secretFile = "/run/secrets/tg-ws-proxy-secret";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Through mobile internet whitelists: the call's media server relays, whatever the IP.
|
||||||
|
# The server runs a creator per device; its log prints the call link for the joiner.
|
||||||
|
whitelistBypass = {
|
||||||
|
enable = true;
|
||||||
|
joiners.wl = { platform = "wbstream"; linkFile = "/run/secrets/wb-link"; }; # an outbound
|
||||||
|
# creators.phone = { platform = "wbstream"; cookiesFile = "/run/secrets/wb-cookies.json"; upstream = "proxy"; };
|
||||||
|
};
|
||||||
|
|
||||||
gui.enable = true;
|
gui.enable = true;
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
@@ -193,6 +202,9 @@ Secrets and changes need root, or the userControl group.
|
|||||||
tor [status|on|off] Tor, behind the tor outbound and the onion service
|
tor [status|on|off] Tor, behind the tor outbound and the onion service
|
||||||
tor newnym new circuits for new connections
|
tor newnym new circuits for new connections
|
||||||
tg [status|on|off] Telegram WebSocket proxy
|
tg [status|on|off] Telegram WebSocket proxy
|
||||||
|
wl [list] whitelist-bypass creators and joiners
|
||||||
|
wl link <creator> [--qr] the call link its joiner takes
|
||||||
|
wl on|off|toggle|restart [name] one creator or joiner, or all of them
|
||||||
|
|
||||||
apps [list] per-app routing profiles
|
apps [list] per-app routing profiles
|
||||||
apps run <profile> -- <cmd> [args] run a command through a profile
|
apps run <profile> -- <cmd> [args] run a command through a profile
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ Update the module option docs there instead of editing these files by hand.
|
|||||||
- [tui](./tui.md)
|
- [tui](./tui.md)
|
||||||
- [userControl](./userControl.md)
|
- [userControl](./userControl.md)
|
||||||
- [warp](./warp.md)
|
- [warp](./warp.md)
|
||||||
|
- [whitelistBypass](./whitelistBypass.md)
|
||||||
- [zapret](./zapret.md)
|
- [zapret](./zapret.md)
|
||||||
|
|
||||||
## Complete default config
|
## Complete default config
|
||||||
@@ -304,6 +305,12 @@ services.proxy-suite = {
|
|||||||
endpoint = null;
|
endpoint = null;
|
||||||
generatorUrl = null;
|
generatorUrl = null;
|
||||||
};
|
};
|
||||||
|
whitelistBypass = {
|
||||||
|
creators = { };
|
||||||
|
enable = false;
|
||||||
|
joiners = { };
|
||||||
|
package = pkgs.whitelist-bypass;
|
||||||
|
};
|
||||||
zapret = {
|
zapret = {
|
||||||
cidrExemption = {
|
cidrExemption = {
|
||||||
cidrs = [ ];
|
cidrs = [ ];
|
||||||
|
|||||||
@@ -0,0 +1,220 @@
|
|||||||
|
# services.proxy-suite.whitelistBypass
|
||||||
|
|
||||||
|
Part of the [proxy-suite options reference](./index.md).
|
||||||
|
|
||||||
|
## Options
|
||||||
|
|
||||||
|
- whitelistBypass
|
||||||
|
- [enable](#services-proxy-suite-whitelistbypass-enable)
|
||||||
|
- [package](#services-proxy-suite-whitelistbypass-package)
|
||||||
|
- [creators](#services-proxy-suite-whitelistbypass-creators)
|
||||||
|
- `<name>`
|
||||||
|
- [cookiesFile](#services-proxy-suite-whitelistbypass-creators-name-cookiesfile)
|
||||||
|
- [linkFile](#services-proxy-suite-whitelistbypass-creators-name-linkfile)
|
||||||
|
- [platform](#services-proxy-suite-whitelistbypass-creators-name-platform)
|
||||||
|
- [resources](#services-proxy-suite-whitelistbypass-creators-name-resources)
|
||||||
|
- [upstream](#services-proxy-suite-whitelistbypass-creators-name-upstream)
|
||||||
|
- [joiners](#services-proxy-suite-whitelistbypass-joiners)
|
||||||
|
- `<name>`
|
||||||
|
- [linkFile](#services-proxy-suite-whitelistbypass-joiners-name-linkfile)
|
||||||
|
- [platform](#services-proxy-suite-whitelistbypass-joiners-name-platform)
|
||||||
|
|
||||||
|
<a id="services-proxy-suite-whitelistbypass-enable"></a>
|
||||||
|
## services\.proxy-suite\.whitelistBypass\.enable
|
||||||
|
|
||||||
|
Whether to enable tunnels through the media servers of video calls, which mobile internet whitelists let
|
||||||
|
through ([whitelist-bypass](https://github\.com/kulikov0/whitelist-bypass))\. A creator on a
|
||||||
|
free host serves exactly one joiner on a censored one\.
|
||||||
|
|
||||||
|
*Type:*
|
||||||
|
boolean
|
||||||
|
|
||||||
|
*Default:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
false
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
true
|
||||||
|
```
|
||||||
|
|
||||||
|
<a id="services-proxy-suite-whitelistbypass-package"></a>
|
||||||
|
## services\.proxy-suite\.whitelistBypass\.package
|
||||||
|
|
||||||
|
whitelist-bypass package with the headless creators and joiners\.
|
||||||
|
|
||||||
|
*Type:*
|
||||||
|
package
|
||||||
|
|
||||||
|
*Default:*
|
||||||
|
proxy-suite’s ` whitelist-bypass ` (` pkgs/whitelist-bypass.nix `)
|
||||||
|
|
||||||
|
<a id="services-proxy-suite-whitelistbypass-creators"></a>
|
||||||
|
## services\.proxy-suite\.whitelistBypass\.creators
|
||||||
|
|
||||||
|
Creators, one per joiner device\. The link each uses is in its log\.
|
||||||
|
|
||||||
|
*Type:*
|
||||||
|
attribute set of (submodule)
|
||||||
|
|
||||||
|
*Default:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ }
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
phone = {
|
||||||
|
cookiesFile = "/run/secrets/whitelist-bypass-cookies-wbstream.json";
|
||||||
|
platform = "wbstream";
|
||||||
|
upstream = "proxy";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<a id="services-proxy-suite-whitelistbypass-creators-name-cookiesfile"></a>
|
||||||
|
## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.cookiesFile
|
||||||
|
|
||||||
|
Runtime path to the platform’s cookies, as the upstream desktop Creator exports them\.
|
||||||
|
Copied into the state directory on first start only: DION and Bitrix rotate their
|
||||||
|
refresh token into that copy, and a stale one would kill the session\. Delete
|
||||||
|
` <stateDir>/whitelist-bypass/<name>.cookies.json ` to take a new export\.
|
||||||
|
|
||||||
|
*Type:*
|
||||||
|
string
|
||||||
|
|
||||||
|
*Example:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
"/run/secrets/whitelist-bypass-cookies-wbstream.json"
|
||||||
|
```
|
||||||
|
|
||||||
|
<a id="services-proxy-suite-whitelistbypass-creators-name-linkfile"></a>
|
||||||
|
## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.linkFile
|
||||||
|
|
||||||
|
Runtime path to the call to rejoin\. Null rejoins the last call written to
|
||||||
|
` <stateDir>/whitelist-bypass/<name>.link `, and creates one on first start: the link
|
||||||
|
stays the same across restarts, so the joiner needs it only once\.
|
||||||
|
|
||||||
|
*Type:*
|
||||||
|
null or string
|
||||||
|
|
||||||
|
*Default:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
null
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
"/run/secrets/whitelist-bypass-link"
|
||||||
|
```
|
||||||
|
|
||||||
|
<a id="services-proxy-suite-whitelistbypass-creators-name-platform"></a>
|
||||||
|
## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.platform
|
||||||
|
|
||||||
|
Call platform\. Every one needs an account: “vk” only serves the upstream Android app,
|
||||||
|
the rest a joiner of this module too\.
|
||||||
|
|
||||||
|
*Type:*
|
||||||
|
one of “wbstream”, “telemost”, “dion”, “bitrix”, “vk”
|
||||||
|
|
||||||
|
*Example:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
"wbstream"
|
||||||
|
```
|
||||||
|
|
||||||
|
<a id="services-proxy-suite-whitelistbypass-creators-name-resources"></a>
|
||||||
|
## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.resources
|
||||||
|
|
||||||
|
Buffer sizes and Go memory limit: 64, 128 or 256 MB\.
|
||||||
|
|
||||||
|
*Type:*
|
||||||
|
one of “moderate”, “default”, “unlimited”
|
||||||
|
|
||||||
|
*Default:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
"moderate"
|
||||||
|
```
|
||||||
|
|
||||||
|
<a id="services-proxy-suite-whitelistbypass-creators-name-upstream"></a>
|
||||||
|
## services\.proxy-suite\.whitelistBypass\.creators\.\<name>\.upstream
|
||||||
|
|
||||||
|
Where the joiner’s traffic leaves\.
|
||||||
|
|
||||||
|
- “direct”: from this host, past TUN and TProxy (it runs as proxy-suite-daemon)\.
|
||||||
|
- “proxy”: through the local proxy listener (proxy\.listener, with its auth), and so
|
||||||
|
its outbounds and routing\.
|
||||||
|
|
||||||
|
*Type:*
|
||||||
|
one of “direct”, “proxy”
|
||||||
|
|
||||||
|
*Default:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
"direct"
|
||||||
|
```
|
||||||
|
|
||||||
|
<a id="services-proxy-suite-whitelistbypass-joiners"></a>
|
||||||
|
## services\.proxy-suite\.whitelistBypass\.joiners
|
||||||
|
|
||||||
|
Joiners, each an outbound tagged with its name: a loopback SOCKS5 listener that tunnels
|
||||||
|
through the call\. Needs proxy\.enable\.
|
||||||
|
|
||||||
|
*Type:*
|
||||||
|
attribute set of (submodule)
|
||||||
|
|
||||||
|
*Default:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{ }
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
{
|
||||||
|
wl = {
|
||||||
|
linkFile = "/run/secrets/whitelist-bypass-link";
|
||||||
|
platform = "wbstream";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
<a id="services-proxy-suite-whitelistbypass-joiners-name-linkfile"></a>
|
||||||
|
## services\.proxy-suite\.whitelistBypass\.joiners\.\<name>\.linkFile
|
||||||
|
|
||||||
|
Runtime path to the call link the creator printed (or wrote to its state directory):
|
||||||
|
a WB Stream room id, a Telemost link, a DION event slug or a Bitrix conference link\.
|
||||||
|
|
||||||
|
*Type:*
|
||||||
|
string
|
||||||
|
|
||||||
|
*Example:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
"/run/secrets/whitelist-bypass-link"
|
||||||
|
```
|
||||||
|
|
||||||
|
<a id="services-proxy-suite-whitelistbypass-joiners-name-platform"></a>
|
||||||
|
## services\.proxy-suite\.whitelistBypass\.joiners\.\<name>\.platform
|
||||||
|
|
||||||
|
Call platform the creator on the other end uses\. VK has no Linux joiner\.
|
||||||
|
|
||||||
|
*Type:*
|
||||||
|
one of “wbstream”, “telemost”, “dion”, “bitrix”
|
||||||
|
|
||||||
|
*Example:*
|
||||||
|
|
||||||
|
```nix
|
||||||
|
"wbstream"
|
||||||
|
```
|
||||||
@@ -85,6 +85,7 @@
|
|||||||
mkProxyCtl
|
mkProxyCtl
|
||||||
mkTgWsProxy
|
mkTgWsProxy
|
||||||
tg-ws-proxy
|
tg-ws-proxy
|
||||||
|
whitelist-bypass
|
||||||
wireproxy-awg
|
wireproxy-awg
|
||||||
zapret2
|
zapret2
|
||||||
;
|
;
|
||||||
@@ -136,6 +137,7 @@
|
|||||||
amneziawg-tools
|
amneziawg-tools
|
||||||
amneziawg-go
|
amneziawg-go
|
||||||
tg-ws-proxy
|
tg-ws-proxy
|
||||||
|
whitelist-bypass
|
||||||
wireproxy-awg
|
wireproxy-awg
|
||||||
zapret2
|
zapret2
|
||||||
;
|
;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ in
|
|||||||
xray = import ../../pkgs/xray.nix { pkgs = upstream; };
|
xray = import ../../pkgs/xray.nix { pkgs = upstream; };
|
||||||
# AWG 3.1 userspace; its kernel module has to match the system's kernel instead.
|
# AWG 3.1 userspace; its kernel module has to match the system's kernel instead.
|
||||||
amneziaWg = import ../../pkgs/amneziawg.nix { pkgs = upstream; };
|
amneziaWg = import ../../pkgs/amneziawg.nix { pkgs = upstream; };
|
||||||
|
whitelist-bypass = import ../../pkgs/whitelist-bypass.nix { pkgs = upstream; };
|
||||||
inherit (upstream) sing-box;
|
inherit (upstream) sing-box;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -138,6 +139,17 @@ in
|
|||||||
}
|
}
|
||||||
))
|
))
|
||||||
|
|
||||||
|
(lib.mkIf cfg.whitelistBypass.enable (
|
||||||
|
import ./whitelist-bypass.nix {
|
||||||
|
inherit
|
||||||
|
lib
|
||||||
|
pkgs
|
||||||
|
cfg
|
||||||
|
derived
|
||||||
|
;
|
||||||
|
}
|
||||||
|
))
|
||||||
|
|
||||||
(lib.mkIf derived.ruleSetsEnabled (
|
(lib.mkIf derived.ruleSetsEnabled (
|
||||||
import ./rulesets.nix {
|
import ./rulesets.nix {
|
||||||
inherit
|
inherit
|
||||||
|
|||||||
@@ -117,6 +117,19 @@ let
|
|||||||
torOutboundEnabled = torCfg.enable && torCfg.asOutbound;
|
torOutboundEnabled = torCfg.enable && torCfg.asOutbound;
|
||||||
torRouteOnion = torOutboundEnabled && torCfg.routeOnion && proxyEnabled;
|
torRouteOnion = torOutboundEnabled && torCfg.routeOnion && proxyEnabled;
|
||||||
|
|
||||||
|
# Joiners in name order, each an outbound on a loopback SOCKS listener of its own.
|
||||||
|
whitelistBypassCfg = cfg.whitelistBypass;
|
||||||
|
whitelistBypassJoiners = lib.optionals whitelistBypassCfg.enable (
|
||||||
|
lib.imap0 (
|
||||||
|
i: tag:
|
||||||
|
whitelistBypassCfg.joiners.${tag}
|
||||||
|
// {
|
||||||
|
inherit tag;
|
||||||
|
port = 18700 + i;
|
||||||
|
}
|
||||||
|
) (builtins.attrNames whitelistBypassCfg.joiners)
|
||||||
|
);
|
||||||
|
|
||||||
# Two ports per "singBox" or "userspace" AmneziaWG outbound, above the autoProxy prober's own
|
# Two ports per "singBox" or "userspace" AmneziaWG outbound, above the autoProxy prober's own
|
||||||
# listeners (proxy.autoProxy.probeBasePort, 18540 by default, one per exit):
|
# listeners (proxy.autoProxy.probeBasePort, 18540 by default, one per exit):
|
||||||
# both bind loopback, so an overlap leaves whichever unit starts second dead.
|
# both bind loopback, so an overlap leaves whichever unit starts second dead.
|
||||||
@@ -290,6 +303,7 @@ let
|
|||||||
++ lib.optional sshProxyOutboundEnabled sshProxyOutboundTag
|
++ lib.optional sshProxyOutboundEnabled sshProxyOutboundTag
|
||||||
++ lib.optional warpOutboundEnabled warpOutboundTag
|
++ lib.optional warpOutboundEnabled warpOutboundTag
|
||||||
++ lib.optional torOutboundEnabled torOutboundTag
|
++ lib.optional torOutboundEnabled torOutboundTag
|
||||||
|
++ map (j: j.tag) whitelistBypassJoiners
|
||||||
++ map (ob: ob.tag) awgOutbounds;
|
++ map (ob: ob.tag) awgOutbounds;
|
||||||
subscriptionTags = map (sub: sub.tag) proxyCfg.subscriptions;
|
subscriptionTags = map (sub: sub.tag) proxyCfg.subscriptions;
|
||||||
|
|
||||||
@@ -301,6 +315,7 @@ let
|
|||||||
|| sshProxyOutboundEnabled
|
|| sshProxyOutboundEnabled
|
||||||
|| warpOutboundEnabled
|
|| warpOutboundEnabled
|
||||||
|| torOutboundEnabled
|
|| torOutboundEnabled
|
||||||
|
|| whitelistBypassJoiners != [ ]
|
||||||
|| awgOutbounds != [ ];
|
|| awgOutbounds != [ ];
|
||||||
collapseNamedOutbounds = selectionMode == "first";
|
collapseNamedOutbounds = selectionMode == "first";
|
||||||
# Always on with sing-box: `proxy-ctl proxy outbounds test` needs it in every selection mode.
|
# Always on with sing-box: `proxy-ctl proxy outbounds test` needs it in every selection mode.
|
||||||
@@ -509,6 +524,8 @@ in
|
|||||||
torOutboundTag
|
torOutboundTag
|
||||||
torOutboundEnabled
|
torOutboundEnabled
|
||||||
torRouteOnion
|
torRouteOnion
|
||||||
|
whitelistBypassCfg
|
||||||
|
whitelistBypassJoiners
|
||||||
torOnionEnabled
|
torOnionEnabled
|
||||||
torOnionInbounds
|
torOnionInbounds
|
||||||
proxyInboundOnionCapable
|
proxyInboundOnionCapable
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
./warp.nix
|
./warp.nix
|
||||||
./tor.nix
|
./tor.nix
|
||||||
./tg-ws-proxy.nix
|
./tg-ws-proxy.nix
|
||||||
|
./whitelist-bypass.nix
|
||||||
./geodata.nix
|
./geodata.nix
|
||||||
./gui.nix
|
./gui.nix
|
||||||
./tui.nix
|
./tui.nix
|
||||||
|
|||||||
@@ -0,0 +1,137 @@
|
|||||||
|
{ lib, proxySuiteUpstream, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (lib) mkEnableOption mkOption types;
|
||||||
|
|
||||||
|
joinerType = types.submodule {
|
||||||
|
options = {
|
||||||
|
platform = mkOption {
|
||||||
|
type = types.enum [
|
||||||
|
"wbstream"
|
||||||
|
"telemost"
|
||||||
|
"dion"
|
||||||
|
"bitrix"
|
||||||
|
];
|
||||||
|
description = "Call platform the creator on the other end uses. VK has no Linux joiner.";
|
||||||
|
example = "wbstream";
|
||||||
|
};
|
||||||
|
|
||||||
|
linkFile = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
Runtime path to the call link the creator printed (or wrote to its state directory):
|
||||||
|
a WB Stream room id, a Telemost link, a DION event slug or a Bitrix conference link.
|
||||||
|
'';
|
||||||
|
example = "/run/secrets/whitelist-bypass-link";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
creatorType = types.submodule {
|
||||||
|
options = {
|
||||||
|
platform = mkOption {
|
||||||
|
type = types.enum [
|
||||||
|
"wbstream"
|
||||||
|
"telemost"
|
||||||
|
"dion"
|
||||||
|
"bitrix"
|
||||||
|
"vk"
|
||||||
|
];
|
||||||
|
description = ''
|
||||||
|
Call platform. Every one needs an account: "vk" only serves the upstream Android app,
|
||||||
|
the rest a joiner of this module too.
|
||||||
|
'';
|
||||||
|
example = "wbstream";
|
||||||
|
};
|
||||||
|
|
||||||
|
cookiesFile = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
description = ''
|
||||||
|
Runtime path to the platform's cookies, as the upstream desktop Creator exports them.
|
||||||
|
Copied into the state directory on first start only: DION and Bitrix rotate their
|
||||||
|
refresh token into that copy, and a stale one would kill the session. Delete
|
||||||
|
`<stateDir>/whitelist-bypass/<name>.cookies.json` to take a new export.
|
||||||
|
'';
|
||||||
|
example = "/run/secrets/whitelist-bypass-cookies-wbstream.json";
|
||||||
|
};
|
||||||
|
|
||||||
|
linkFile = mkOption {
|
||||||
|
type = types.nullOr types.str;
|
||||||
|
default = null;
|
||||||
|
description = ''
|
||||||
|
Runtime path to the call to rejoin. Null rejoins the last call written to
|
||||||
|
`<stateDir>/whitelist-bypass/<name>.link`, and creates one on first start: the link
|
||||||
|
stays the same across restarts, so the joiner needs it only once.
|
||||||
|
'';
|
||||||
|
example = "/run/secrets/whitelist-bypass-link";
|
||||||
|
};
|
||||||
|
|
||||||
|
upstream = mkOption {
|
||||||
|
type = types.enum [
|
||||||
|
"direct"
|
||||||
|
"proxy"
|
||||||
|
];
|
||||||
|
default = "direct";
|
||||||
|
description = ''
|
||||||
|
Where the joiner's traffic leaves.
|
||||||
|
- "direct": from this host, past TUN and TProxy (it runs as proxy-suite-daemon).
|
||||||
|
- "proxy": through the local proxy listener (proxy.listener, with its auth), and so
|
||||||
|
its outbounds and routing.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
resources = mkOption {
|
||||||
|
type = types.enum [
|
||||||
|
"moderate"
|
||||||
|
"default"
|
||||||
|
"unlimited"
|
||||||
|
];
|
||||||
|
default = "moderate";
|
||||||
|
description = "Buffer sizes and Go memory limit: 64, 128 or 256 MB.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.services.proxy-suite.whitelistBypass = {
|
||||||
|
enable = mkEnableOption ''
|
||||||
|
tunnels through the media servers of video calls, which mobile internet whitelists let
|
||||||
|
through ([whitelist-bypass](https://github.com/kulikov0/whitelist-bypass)). A creator on a
|
||||||
|
free host serves exactly one joiner on a censored one'';
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = proxySuiteUpstream.whitelist-bypass;
|
||||||
|
defaultText = lib.literalMD "proxy-suite's `whitelist-bypass` (`pkgs/whitelist-bypass.nix`)";
|
||||||
|
description = "whitelist-bypass package with the headless creators and joiners.";
|
||||||
|
};
|
||||||
|
|
||||||
|
joiners = mkOption {
|
||||||
|
type = types.attrsOf joinerType;
|
||||||
|
default = { };
|
||||||
|
description = ''
|
||||||
|
Joiners, each an outbound tagged with its name: a loopback SOCKS5 listener that tunnels
|
||||||
|
through the call. Needs proxy.enable.
|
||||||
|
'';
|
||||||
|
example = {
|
||||||
|
wl = {
|
||||||
|
platform = "wbstream";
|
||||||
|
linkFile = "/run/secrets/whitelist-bypass-link";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
creators = mkOption {
|
||||||
|
type = types.attrsOf creatorType;
|
||||||
|
default = { };
|
||||||
|
description = "Creators, one per joiner device. The link each uses is in its log.";
|
||||||
|
example = {
|
||||||
|
phone = {
|
||||||
|
platform = "wbstream";
|
||||||
|
cookiesFile = "/run/secrets/whitelist-bypass-cookies-wbstream.json";
|
||||||
|
upstream = "proxy";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -78,6 +78,7 @@ let
|
|||||||
ob.directPort
|
ob.directPort
|
||||||
]) derived.awgTunnelOutbounds
|
]) derived.awgTunnelOutbounds
|
||||||
++ lib.optional derived.torOutboundEnabled derived.torCfg.socksPort
|
++ lib.optional derived.torOutboundEnabled derived.torCfg.socksPort
|
||||||
|
++ map (j: j.port) derived.whitelistBypassJoiners
|
||||||
++ lib.optionals derived.proxyInboundsEnabled (
|
++ lib.optionals derived.proxyInboundsEnabled (
|
||||||
map (listener: listener.internalPort) derived.proxyInboundsAwg
|
map (listener: listener.internalPort) derived.proxyInboundsAwg
|
||||||
);
|
);
|
||||||
@@ -889,6 +890,21 @@ let
|
|||||||
torOnionVirtualPorts = map (
|
torOnionVirtualPorts = map (
|
||||||
ib: if ib.listener.sharePort != null then ib.listener.sharePort else ib.listener.port
|
ib: if ib.listener.sharePort != null then ib.listener.sharePort else ib.listener.port
|
||||||
) derived.torOnionInbounds;
|
) derived.torOnionInbounds;
|
||||||
|
whitelistBypassCfg = cfg.whitelistBypass;
|
||||||
|
whitelistBypassAssertions = [
|
||||||
|
(requireEnabled (
|
||||||
|
derived.whitelistBypassJoiners != [ ]
|
||||||
|
) proxyEnabled "proxy-suite: whitelistBypass.joiners requires proxy.enable = true")
|
||||||
|
(requireEnabled
|
||||||
|
(
|
||||||
|
whitelistBypassCfg.enable
|
||||||
|
&& lib.any (c: c.upstream == "proxy") (builtins.attrValues whitelistBypassCfg.creators)
|
||||||
|
)
|
||||||
|
proxyEnabled
|
||||||
|
''proxy-suite: whitelistBypass.creators.<name>.upstream = "proxy" requires proxy.enable = true''
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
torSnowflake = lib.any (line: lib.hasPrefix "snowflake " line) torCfg.bridges.lines;
|
torSnowflake = lib.any (line: lib.hasPrefix "snowflake " line) torCfg.bridges.lines;
|
||||||
torAssertions = [
|
torAssertions = [
|
||||||
(mkAssertion (
|
(mkAssertion (
|
||||||
@@ -959,6 +975,7 @@ in
|
|||||||
rootlessAssertions
|
rootlessAssertions
|
||||||
++ featureAssertions
|
++ featureAssertions
|
||||||
++ torAssertions
|
++ torAssertions
|
||||||
|
++ whitelistBypassAssertions
|
||||||
++ perAppRoutingAssertions
|
++ perAppRoutingAssertions
|
||||||
++ localProxyAuthAssertions
|
++ localProxyAuthAssertions
|
||||||
++ secretAssertions
|
++ secretAssertions
|
||||||
|
|||||||
@@ -72,6 +72,24 @@ in
|
|||||||
ROUTE_MODE_STATE_FILE = routeModeStateFile;
|
ROUTE_MODE_STATE_FILE = routeModeStateFile;
|
||||||
DEFAULT_ROUTE_MODE = if proxyCfg.routing.default == "proxy" then "blacklist" else "whitelist";
|
DEFAULT_ROUTE_MODE = if proxyCfg.routing.default == "proxy" then "blacklist" else "whitelist";
|
||||||
AWG_PROFILES_FILE = toString amneziaWgProfileNamesFile;
|
AWG_PROFILES_FILE = toString amneziaWgProfileNamesFile;
|
||||||
|
WL_FILE = toString (
|
||||||
|
pkgs.writeText "proxy-suite-control" (
|
||||||
|
builtins.toJSON (
|
||||||
|
lib.optionals cfg.whitelistBypass.enable (
|
||||||
|
lib.mapAttrsToList (name: c: {
|
||||||
|
inherit name;
|
||||||
|
inherit (c) platform;
|
||||||
|
role = "creator";
|
||||||
|
}) cfg.whitelistBypass.creators
|
||||||
|
++ lib.mapAttrsToList (name: j: {
|
||||||
|
inherit name;
|
||||||
|
inherit (j) platform;
|
||||||
|
role = "joiner";
|
||||||
|
}) cfg.whitelistBypass.joiners
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
INBOUNDS_ENABLED = flag proxyInboundsEnabled;
|
INBOUNDS_ENABLED = flag proxyInboundsEnabled;
|
||||||
INBOUNDS_LINKS_FILE = proxyInboundsLinksFile;
|
INBOUNDS_LINKS_FILE = proxyInboundsLinksFile;
|
||||||
INBOUNDS_STATS_FILE = constants.inboundStatsFile;
|
INBOUNDS_STATS_FILE = constants.inboundStatsFile;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
sshProxyCfg,
|
sshProxyCfg,
|
||||||
warpCfg,
|
warpCfg,
|
||||||
torCfg,
|
torCfg,
|
||||||
|
whitelistBypassJoiners,
|
||||||
awgOutbounds,
|
awgOutbounds,
|
||||||
constants,
|
constants,
|
||||||
pureXrayEnabled,
|
pureXrayEnabled,
|
||||||
@@ -588,6 +589,9 @@ let
|
|||||||
torBlock = lib.optionalString torOutboundEnabled (
|
torBlock = lib.optionalString torOutboundEnabled (
|
||||||
mkTunnelOutboundBlock "proxy-suite-tor" "tor" "tor" torCfg.socksPort
|
mkTunnelOutboundBlock "proxy-suite-tor" "tor" "tor" torCfg.socksPort
|
||||||
);
|
);
|
||||||
|
whitelistBypassBlocks = lib.concatMapStrings (
|
||||||
|
j: mkTunnelOutboundBlock "proxy-suite-wb-joiner-${j.tag}" "whitelist-bypass" j.tag j.port
|
||||||
|
) whitelistBypassJoiners;
|
||||||
awgBlocks = lib.concatMapStrings (mkAwgOutboundBlock routingMark) awgOutbounds;
|
awgBlocks = lib.concatMapStrings (mkAwgOutboundBlock routingMark) awgOutbounds;
|
||||||
|
|
||||||
wrapperBlock =
|
wrapperBlock =
|
||||||
@@ -666,6 +670,7 @@ let
|
|||||||
+ sshProxyBlock
|
+ sshProxyBlock
|
||||||
+ warpBlock
|
+ warpBlock
|
||||||
+ torBlock
|
+ torBlock
|
||||||
|
+ whitelistBypassBlocks
|
||||||
+ awgBlocks
|
+ awgBlocks
|
||||||
+ detourBlock
|
+ detourBlock
|
||||||
+ requireOutboundsBlock
|
+ requireOutboundsBlock
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ let
|
|||||||
sshProxyCfg
|
sshProxyCfg
|
||||||
warpCfg
|
warpCfg
|
||||||
torCfg
|
torCfg
|
||||||
|
whitelistBypassJoiners
|
||||||
awgOutbounds
|
awgOutbounds
|
||||||
constants
|
constants
|
||||||
pureXrayEnabled
|
pureXrayEnabled
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ let
|
|||||||
sshProxyUnitEnabled
|
sshProxyUnitEnabled
|
||||||
torOutboundEnabled
|
torOutboundEnabled
|
||||||
torOnionEnabled
|
torOnionEnabled
|
||||||
|
whitelistBypassJoiners
|
||||||
proxyInboundsEnabled
|
proxyInboundsEnabled
|
||||||
proxyInboundsNeedLocalProxy
|
proxyInboundsNeedLocalProxy
|
||||||
scripts
|
scripts
|
||||||
@@ -88,7 +89,8 @@ let
|
|||||||
"network-online.target"
|
"network-online.target"
|
||||||
]
|
]
|
||||||
++ lib.optional (sshProxyOutboundEnabled && sshProxyUnitEnabled) "proxy-suite-ssh-proxy.service"
|
++ lib.optional (sshProxyOutboundEnabled && sshProxyUnitEnabled) "proxy-suite-ssh-proxy.service"
|
||||||
++ lib.optional torOutboundEnabled "proxy-suite-tor.service";
|
++ lib.optional torOutboundEnabled "proxy-suite-tor.service"
|
||||||
|
++ map (j: "proxy-suite-wb-joiner-${j.tag}.service") whitelistBypassJoiners;
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
execStart = scripts.startSocks;
|
execStart = scripts.startSocks;
|
||||||
runtimeDirectory = serviceNames.socks;
|
runtimeDirectory = serviceNames.socks;
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
# whitelist-bypass: joiners, the loopback SOCKS listeners behind their outbounds, and
|
||||||
|
# creators, the free ends of the calls they tunnel through.
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
cfg,
|
||||||
|
derived,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
w = derived.whitelistBypassCfg;
|
||||||
|
inherit (derived.constants) unprivilegedServiceConfig;
|
||||||
|
inherit (derived.localProxy) auth;
|
||||||
|
|
||||||
|
# Every flag that takes the call, joiner and creator alike.
|
||||||
|
linkFlag = {
|
||||||
|
wbstream = "--room";
|
||||||
|
dion = "--room";
|
||||||
|
bitrix = "--room";
|
||||||
|
telemost = "--tm-link";
|
||||||
|
vk = "--vk-link";
|
||||||
|
};
|
||||||
|
joinerLinkFlag = linkFlag // {
|
||||||
|
bitrix = "--link";
|
||||||
|
};
|
||||||
|
|
||||||
|
passwordSource =
|
||||||
|
if auth.passwordFile != null then
|
||||||
|
auth.passwordFile
|
||||||
|
else if auth.password != null then
|
||||||
|
pkgs.writeText "proxy-suite-wb-creator" auth.password
|
||||||
|
else
|
||||||
|
null;
|
||||||
|
|
||||||
|
# Restart=always must not trip the start limit while the network or the platform is down.
|
||||||
|
mkUnit = description: serviceConfig: {
|
||||||
|
inherit description;
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
startLimitIntervalSec = 0;
|
||||||
|
serviceConfig =
|
||||||
|
unprivilegedServiceConfig [ ]
|
||||||
|
// {
|
||||||
|
Restart = "always";
|
||||||
|
RestartSec = 5;
|
||||||
|
}
|
||||||
|
// serviceConfig;
|
||||||
|
};
|
||||||
|
|
||||||
|
mkJoiner =
|
||||||
|
j:
|
||||||
|
lib.nameValuePair "proxy-suite-wb-joiner-${j.tag}" (
|
||||||
|
mkUnit "proxy-suite - whitelist-bypass joiner ${j.tag}" {
|
||||||
|
ExecStart = pkgs.writeShellScript "proxy-suite-wb-joiner-${j.tag}" ''
|
||||||
|
set -euo pipefail
|
||||||
|
link=$(tr -d '[:space:]' < "$CREDENTIALS_DIRECTORY/link")
|
||||||
|
exec ${w.package}/bin/headless-${j.platform}-joiner \
|
||||||
|
${joinerLinkFlag.${j.platform}} "$link" --socks-port ${toString j.port}
|
||||||
|
'';
|
||||||
|
LoadCredential = [ "link:${j.linkFile}" ];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
mkCreator =
|
||||||
|
name: c:
|
||||||
|
let
|
||||||
|
viaProxy = c.upstream == "proxy";
|
||||||
|
withProxyAuth = viaProxy && derived.localProxy.authEnabled;
|
||||||
|
unit = mkUnit "proxy-suite - whitelist-bypass creator ${name}" {
|
||||||
|
ExecStart = pkgs.writeShellScript "proxy-suite-wb-creator-${name}" ''
|
||||||
|
set -euo pipefail
|
||||||
|
cookies="$STATE_DIRECTORY/${name}.cookies.json"
|
||||||
|
links="$STATE_DIRECTORY/${name}.link"
|
||||||
|
[ -e "$cookies" ] || install -m 600 "$CREDENTIALS_DIRECTORY/cookies" "$cookies"
|
||||||
|
args=(--cookies "$cookies" --write-file "$links" --resources ${c.resources})
|
||||||
|
${
|
||||||
|
if c.linkFile != null then
|
||||||
|
''link=$(tr -d '[:space:]' < "$CREDENTIALS_DIRECTORY/link")''
|
||||||
|
else
|
||||||
|
''link=$(tail -n 1 "$links" 2>/dev/null || true)''
|
||||||
|
}
|
||||||
|
[ -z "$link" ] || args+=(${linkFlag.${c.platform}} "$link")
|
||||||
|
${lib.optionalString viaProxy ''
|
||||||
|
args+=(--upstream-socks ${derived.localProxy.hostPart}:${toString cfg.proxy.listener.port})
|
||||||
|
''}${lib.optionalString withProxyAuth ''
|
||||||
|
args+=(--upstream-user ${lib.escapeShellArg auth.username} --upstream-pass "$(< "$CREDENTIALS_DIRECTORY/proxy-password")")
|
||||||
|
''}
|
||||||
|
exec ${w.package}/bin/headless-${c.platform}-creator "''${args[@]}"
|
||||||
|
'';
|
||||||
|
StateDirectory = "proxy-suite/whitelist-bypass";
|
||||||
|
StateDirectoryMode = "0700";
|
||||||
|
LoadCredential = [
|
||||||
|
"cookies:${c.cookiesFile}"
|
||||||
|
]
|
||||||
|
++ lib.optional (c.linkFile != null) "link:${c.linkFile}"
|
||||||
|
++ lib.optional withProxyAuth "proxy-password:${passwordSource}";
|
||||||
|
};
|
||||||
|
in
|
||||||
|
lib.nameValuePair "proxy-suite-wb-creator-${name}" (
|
||||||
|
unit // lib.optionalAttrs viaProxy { after = unit.after ++ [ "proxy-suite-socks.service" ]; }
|
||||||
|
);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
services.proxy-suite.internal.services = lib.listToAttrs (
|
||||||
|
map mkJoiner derived.whitelistBypassJoiners ++ lib.mapAttrsToList mkCreator w.creators
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -130,6 +130,18 @@ let
|
|||||||
tls.keyFile = "/k";
|
tls.keyFile = "/k";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
whitelistBypass = {
|
||||||
|
enable = true;
|
||||||
|
joiners.wl = {
|
||||||
|
platform = "wbstream";
|
||||||
|
linkFile = "/run/secrets/wb-link";
|
||||||
|
};
|
||||||
|
creators.phone = {
|
||||||
|
platform = "dion";
|
||||||
|
cookiesFile = "/run/secrets/wb-cookies";
|
||||||
|
upstream = "proxy";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -213,6 +225,8 @@ in
|
|||||||
assert lib.hasInfix "proxy-suitectl ensure" nodCfg.environment.etc.profile.text;
|
assert lib.hasInfix "proxy-suitectl ensure" nodCfg.environment.etc.profile.text;
|
||||||
assert forced nodCfg.build.activationAfter.proxySuite;
|
assert forced nodCfg.build.activationAfter.proxySuite;
|
||||||
assert nodCfg.services.proxy-suite.internal.services.proxy-suite-tor.enable;
|
assert nodCfg.services.proxy-suite.internal.services.proxy-suite-tor.enable;
|
||||||
|
assert nodCfg.services.proxy-suite.internal.services.proxy-suite-wb-joiner-wl.enable;
|
||||||
|
assert nodCfg.services.proxy-suite.internal.services.proxy-suite-wb-creator-phone.enable;
|
||||||
# Android bans apps from netlink's route groups, which stock sing-box subscribes to.
|
# Android bans apps from netlink's route groups, which stock sing-box subscribes to.
|
||||||
assert nodCfg.services.proxy-suite.proxy.singBox.package.passthru.rootlessNetlink or false;
|
assert nodCfg.services.proxy-suite.proxy.singBox.package.passthru.rootlessNetlink or false;
|
||||||
assert !(hmCfg.services.proxy-suite.proxy.singBox.package.passthru.rootlessNetlink or false);
|
assert !(hmCfg.services.proxy-suite.proxy.singBox.package.passthru.rootlessNetlink or false);
|
||||||
|
|||||||
@@ -753,6 +753,7 @@ in
|
|||||||
sshProxyCfg = null;
|
sshProxyCfg = null;
|
||||||
warpCfg = null;
|
warpCfg = null;
|
||||||
torCfg = null;
|
torCfg = null;
|
||||||
|
whitelistBypassJoiners = [ ];
|
||||||
awgOutbounds = null;
|
awgOutbounds = null;
|
||||||
constants = null;
|
constants = null;
|
||||||
pureXrayEnabled = null;
|
pureXrayEnabled = null;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ let
|
|||||||
sshProxyCfg = null;
|
sshProxyCfg = null;
|
||||||
warpCfg = null;
|
warpCfg = null;
|
||||||
torCfg = null;
|
torCfg = null;
|
||||||
|
whitelistBypassJoiners = [ ];
|
||||||
awgOutbounds = null;
|
awgOutbounds = null;
|
||||||
constants = null;
|
constants = null;
|
||||||
hybridEnabled = null;
|
hybridEnabled = null;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ let
|
|||||||
amneziaWg = import ./amneziawg.nix { inherit pkgs; };
|
amneziaWg = import ./amneziawg.nix { inherit pkgs; };
|
||||||
mkTgWsProxy = _args: import ./tg-ws-proxy.nix { inherit pkgs; };
|
mkTgWsProxy = _args: import ./tg-ws-proxy.nix { inherit pkgs; };
|
||||||
zapret2 = import ./zapret2.nix { inherit pkgs; };
|
zapret2 = import ./zapret2.nix { inherit pkgs; };
|
||||||
|
whitelist-bypass = import ./whitelist-bypass.nix { inherit pkgs; };
|
||||||
mkProxySuiteSupervisor = import ./proxy-suite-supervisor.nix {
|
mkProxySuiteSupervisor = import ./proxy-suite-supervisor.nix {
|
||||||
lib = pkgs.lib;
|
lib = pkgs.lib;
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
@@ -22,6 +23,7 @@ in
|
|||||||
mkProxyCtl
|
mkProxyCtl
|
||||||
mkProxySuiteSupervisor
|
mkProxySuiteSupervisor
|
||||||
zapret2
|
zapret2
|
||||||
|
whitelist-bypass
|
||||||
;
|
;
|
||||||
tg-ws-proxy = mkTgWsProxy { };
|
tg-ws-proxy = mkTgWsProxy { };
|
||||||
}
|
}
|
||||||
@@ -115,6 +115,9 @@ Secrets and changes need root, or the userControl group.
|
|||||||
tor [status|on|off] Tor, behind the tor outbound and the onion service
|
tor [status|on|off] Tor, behind the tor outbound and the onion service
|
||||||
tor newnym new circuits for new connections
|
tor newnym new circuits for new connections
|
||||||
tg [status|on|off] Telegram WebSocket proxy
|
tg [status|on|off] Telegram WebSocket proxy
|
||||||
|
wl [list] whitelist-bypass creators and joiners
|
||||||
|
wl link <creator> [--qr] the call link its joiner takes
|
||||||
|
wl on|off|toggle|restart [name] one creator or joiner, or all of them
|
||||||
|
|
||||||
apps [list] per-app routing profiles
|
apps [list] per-app routing profiles
|
||||||
apps run <profile> -- <cmd> [args] run a command through a profile
|
apps run <profile> -- <cmd> [args] run a command through a profile
|
||||||
@@ -491,6 +494,7 @@ COMPLETE = {
|
|||||||
"warp": "WARP tunnel behind the warp outbound",
|
"warp": "WARP tunnel behind the warp outbound",
|
||||||
"tor": "Tor, behind the tor outbound and the onion service",
|
"tor": "Tor, behind the tor outbound and the onion service",
|
||||||
"tg": "Telegram WebSocket proxy",
|
"tg": "Telegram WebSocket proxy",
|
||||||
|
"wl": "whitelist-bypass creators and joiners",
|
||||||
"apps": "per-app routing profiles",
|
"apps": "per-app routing profiles",
|
||||||
"inbounds": "server inbounds",
|
"inbounds": "server inbounds",
|
||||||
"help": "usage",
|
"help": "usage",
|
||||||
@@ -618,6 +622,18 @@ COMPLETE = {
|
|||||||
"killswitch": {"words": TOGGLE},
|
"killswitch": {"words": TOGGLE},
|
||||||
"tor": {"words": {**TOGGLE, "newnym": "new circuits for new connections"}},
|
"tor": {"words": {**TOGGLE, "newnym": "new circuits for new connections"}},
|
||||||
"tg": {"words": TOGGLE},
|
"tg": {"words": TOGGLE},
|
||||||
|
"wl": {
|
||||||
|
"words": {
|
||||||
|
"list": "creators and joiners and their state",
|
||||||
|
"link": "the call link a creator's joiner takes",
|
||||||
|
"on": "start one, or all",
|
||||||
|
"off": "stop one, or all",
|
||||||
|
"toggle": "start it if stopped, stop it if running",
|
||||||
|
"restart": "restart one, or all",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"wl link": {"args": lambda: _names(w["name"] for w in _wl() if w["role"] == "creator"), "flags": {"--qr": "print a QR code"}},
|
||||||
|
**{f"wl {verb}": {"args": lambda: {w["name"]: w["role"] for w in _wl()}} for verb in ("on", "off", "toggle", "restart")},
|
||||||
"apps": {"words": {"list": "per-app routing profiles", "run": "run a command through a profile"}},
|
"apps": {"words": {"list": "per-app routing profiles", "run": "run a command through a profile"}},
|
||||||
"apps run": {"args": lambda: {_s(p["name"]): _s(p.get("route") or "") for p in read_json(env("PER_APP_ROUTING_PROFILES_FILE"))}},
|
"apps run": {"args": lambda: {_s(p["name"]): _s(p.get("route") or "") for p in read_json(env("PER_APP_ROUTING_PROFILES_FILE"))}},
|
||||||
"inbounds": {
|
"inbounds": {
|
||||||
@@ -732,7 +748,7 @@ def _snapshot_units():
|
|||||||
profiles = _awg_profiles()
|
profiles = _awg_profiles()
|
||||||
# WARP as an AmneziaWG outbound has no profile to toggle, but it is a unit that can fail (_warp_unit).
|
# WARP as an AmneziaWG outbound has no profile to toggle, but it is a unit that can fail (_warp_unit).
|
||||||
warp = [] if "warp" in profiles else [_awg_service("warp")]
|
warp = [] if "warp" in profiles else [_awg_service("warp")]
|
||||||
return [*ALL_SERVICES, SUBSCRIPTION_UPDATE, *map(_awg_service, profiles), *warp]
|
return [*ALL_SERVICES, SUBSCRIPTION_UPDATE, *map(_awg_service, profiles), *warp, *map(_wl_unit, _wl())]
|
||||||
|
|
||||||
|
|
||||||
def _status_snapshot(states=None):
|
def _status_snapshot(states=None):
|
||||||
@@ -2840,6 +2856,56 @@ def cmd_awg(verb="list", *args):
|
|||||||
usage("awg [list] | on <profile> | off [profile] | toggle [profile] | restart [profile]")
|
usage("awg [list] | on <profile> | off [profile] | toggle [profile] | restart [profile]")
|
||||||
|
|
||||||
|
|
||||||
|
# --- wl -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
def _wl():
|
||||||
|
"""whitelist-bypass creators and joiners: [{name, role, platform}]."""
|
||||||
|
return read_json_or(env("WL_FILE"), [])
|
||||||
|
|
||||||
|
|
||||||
|
def _wl_unit(w):
|
||||||
|
return f"proxy-suite-wb-{w['role']}-{w['name']}"
|
||||||
|
|
||||||
|
|
||||||
|
def _wl_link(name):
|
||||||
|
"""The call a creator made and keeps rejoining: the last line it wrote."""
|
||||||
|
path = os.path.join(state_dir(), "whitelist-bypass", f"{name}.link")
|
||||||
|
try:
|
||||||
|
links = [line.strip() for line in lines(read_text(path)) if line.strip()]
|
||||||
|
except FileNotFoundError:
|
||||||
|
links = []
|
||||||
|
except PermissionError:
|
||||||
|
die(f"Cannot read {path} - re-run with sudo.")
|
||||||
|
if not links:
|
||||||
|
die(f"{name} has no call yet: {journal_hint(_wl_unit({'role': 'creator', 'name': name}))}")
|
||||||
|
return links[-1]
|
||||||
|
|
||||||
|
|
||||||
|
def cmd_wl(verb="list", *args):
|
||||||
|
entries = _wl()
|
||||||
|
named = [w for w in entries if w["name"] == args[0]] if args else entries
|
||||||
|
if args and not named:
|
||||||
|
die(f"Unknown whitelist-bypass creator or joiner: {args[0]}")
|
||||||
|
if verb in ("list", "status"):
|
||||||
|
if not entries:
|
||||||
|
print("No whitelist-bypass creators or joiners configured.")
|
||||||
|
return
|
||||||
|
print(f" {'NAME':<16} {'ROLE':<8} {'PLATFORM':<10} STATUS")
|
||||||
|
for w in entries:
|
||||||
|
print(f" {w['name']:<16} {w['role']:<8} {w['platform']:<10} {svc_state(_wl_unit(w)) or 'unknown'}")
|
||||||
|
elif verb == "link":
|
||||||
|
if not args or named[0]["role"] != "creator":
|
||||||
|
usage("wl link <creator> [--qr]")
|
||||||
|
_emit(_wl_link(args[0]), "--qr" in args)
|
||||||
|
elif verb in ("on", "off", "toggle", "restart"):
|
||||||
|
for w in named:
|
||||||
|
action = {"on": "start", "off": "stop", "restart": "restart"}[_flip(_wl_unit(w), verb)]
|
||||||
|
must(action, _wl_unit(w))
|
||||||
|
else:
|
||||||
|
usage("wl [list] | link <creator> [--qr] | on|off|toggle|restart [name]")
|
||||||
|
|
||||||
|
|
||||||
# --- apps ---------------------------------------------------------------------
|
# --- apps ---------------------------------------------------------------------
|
||||||
|
|
||||||
SLICE_ROUTES = {
|
SLICE_ROUTES = {
|
||||||
@@ -3288,6 +3354,7 @@ COMMANDS = {
|
|||||||
"warp": lambda *args: _toggle(_warp_unit(), "warp", *args),
|
"warp": lambda *args: _toggle(_warp_unit(), "warp", *args),
|
||||||
"tor": cmd_tor,
|
"tor": cmd_tor,
|
||||||
"tg": lambda *args: _toggle("proxy-suite-tg-ws-proxy", "tg", *args),
|
"tg": lambda *args: _toggle("proxy-suite-tg-ws-proxy", "tg", *args),
|
||||||
|
"wl": cmd_wl,
|
||||||
"apps": cmd_apps,
|
"apps": cmd_apps,
|
||||||
"inbounds": cmd_inbounds,
|
"inbounds": cmd_inbounds,
|
||||||
"where": cmd_where,
|
"where": cmd_where,
|
||||||
|
|||||||
@@ -387,6 +387,25 @@ class ServiceManagerTest(EnvTest):
|
|||||||
with self.assertRaises(SystemExit), contextlib.redirect_stderr(io.StringIO()):
|
with self.assertRaises(SystemExit), contextlib.redirect_stderr(io.StringIO()):
|
||||||
ctl.cmd_awg("toggle")
|
ctl.cmd_awg("toggle")
|
||||||
|
|
||||||
|
def test_wl(self):
|
||||||
|
seen = self.calls()
|
||||||
|
active = {"proxy-suite-wb-joiner-wl"}
|
||||||
|
self.patch("svc_active", lambda unit: unit in active)
|
||||||
|
os.environ["WL_FILE"] = self.write("wl.json", [{"name": "phone", "role": "creator", "platform": "dion"}, {"name": "wl", "role": "joiner", "platform": "dion"}])
|
||||||
|
os.environ["STATE_DIR"] = self.dir
|
||||||
|
ctl.cmd_wl("toggle")
|
||||||
|
ctl.cmd_wl("restart", "wl")
|
||||||
|
# Toggle flips each one on its own.
|
||||||
|
self.assertEqual(
|
||||||
|
[argv[1:3] for argv in seen],
|
||||||
|
[["start", "proxy-suite-wb-creator-phone"], ["stop", "proxy-suite-wb-joiner-wl"], ["restart", "proxy-suite-wb-joiner-wl"]],
|
||||||
|
)
|
||||||
|
self.assertNotEqual(run(ctl.cmd_wl, "link", "phone")[0], 0) # no call yet
|
||||||
|
self.write("whitelist-bypass/phone.link", "dion://old\ndion://new\n")
|
||||||
|
self.assertEqual(ok(ctl.cmd_wl, "link", "phone"), "dion://new\n")
|
||||||
|
self.assertNotEqual(run(ctl.cmd_wl, "link", "wl")[0], 0) # a joiner has no link to give
|
||||||
|
self.assertEqual(set(ctl._complete_tree("wl", "link")), {"phone", "--qr"})
|
||||||
|
|
||||||
def test_toggle_completes(self):
|
def test_toggle_completes(self):
|
||||||
for path in ("ssh", "zapret", "proxy", "proxy tun", "tor"):
|
for path in ("ssh", "zapret", "proxy", "proxy tun", "tor"):
|
||||||
self.assertLessEqual({"toggle", "restart"}, set(ctl._complete_tree(*path.split())))
|
self.assertLessEqual({"toggle", "restart"}, set(ctl._complete_tree(*path.split())))
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# whitelist-bypass's headless ends: a tunnel through the media servers of video calls
|
||||||
|
# (WB Stream, Telemost, DION, Bitrix, VK), which stay reachable under mobile whitelists.
|
||||||
|
# Creators sit on the free side, joiners expose a SOCKS5 listener on the censored one.
|
||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
pkgs.buildGo126Module (finalAttrs: {
|
||||||
|
pname = "whitelist-bypass";
|
||||||
|
version = "0.4.4";
|
||||||
|
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
owner = "kulikov0";
|
||||||
|
repo = "whitelist-bypass";
|
||||||
|
rev = "v${finalAttrs.version}";
|
||||||
|
hash = "sha256-dYSadPA3X/f61XjpU+DTiLTPkKb3RC18/Z3x/YAOcC0=";
|
||||||
|
};
|
||||||
|
vendorHash = "sha256-zKQzcfYdjKfpsyVgTTRdT0AFGqZQMtStpdVyCrojltE=";
|
||||||
|
|
||||||
|
subPackages = [
|
||||||
|
"headless/vk"
|
||||||
|
"headless/telemost"
|
||||||
|
"headless/wbstream"
|
||||||
|
"headless/dion"
|
||||||
|
"headless/bitrix"
|
||||||
|
"headless/telemost-joiner"
|
||||||
|
"headless/wbstream-joiner"
|
||||||
|
"headless/dion-joiner"
|
||||||
|
"headless/bitrix-joiner"
|
||||||
|
];
|
||||||
|
ldflags = [
|
||||||
|
"-s"
|
||||||
|
"-w"
|
||||||
|
];
|
||||||
|
|
||||||
|
# Upstream's names (build-headless.sh): each directory builds one binary.
|
||||||
|
postInstall = ''
|
||||||
|
for p in vk telemost wbstream dion bitrix; do
|
||||||
|
mv "$out/bin/$p" "$out/bin/headless-$p-creator"
|
||||||
|
done
|
||||||
|
for p in telemost wbstream dion bitrix; do
|
||||||
|
mv "$out/bin/$p-joiner" "$out/bin/headless-$p-joiner"
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Tunnel through video call media servers to get past mobile internet whitelists";
|
||||||
|
homepage = "https://github.com/kulikov0/whitelist-bypass";
|
||||||
|
license = pkgs.lib.licenses.mit;
|
||||||
|
};
|
||||||
|
})
|
||||||
@@ -16,6 +16,7 @@ PINS=(
|
|||||||
"pkgs/tg-ws-proxy.nix|Flowseal|tg-ws-proxy|rev|tg-ws-proxy"
|
"pkgs/tg-ws-proxy.nix|Flowseal|tg-ws-proxy|rev|tg-ws-proxy"
|
||||||
"pkgs/zapret2.nix|bol-van|zapret2|version|zapret2"
|
"pkgs/zapret2.nix|bol-van|zapret2|version|zapret2"
|
||||||
"pkgs/xray.nix|XTLS|Xray-core|version|xray"
|
"pkgs/xray.nix|XTLS|Xray-core|version|xray"
|
||||||
|
"pkgs/whitelist-bypass.nix|kulikov0|whitelist-bypass|version|whitelist-bypass"
|
||||||
)
|
)
|
||||||
|
|
||||||
FAKE_HASH="sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
|
FAKE_HASH="sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
|
||||||
|
|||||||
Reference in new issue
Block a user