Init
Initial commit, nodes are mostly done, panel is WIP
This commit is contained in:
commit
6761a7c440
73 files changed
+3413
No files matched your search
@@ -0,0 +1,88 @@
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.vps.services.ss-zapret2;
|
||||
in
|
||||
{
|
||||
config = mkIf cfg.enable {
|
||||
sops.secrets = {
|
||||
"ss-zapret2/password" = { };
|
||||
};
|
||||
|
||||
sops.templates."ss-zapret2.env".content = ''
|
||||
SS_PORT=${toString cfg.ssPort}
|
||||
SOCKS_PORT=${toString cfg.socksPort}
|
||||
SS_ENCRYPT_METHOD=chacha20-ietf-poly1305
|
||||
SS_TIMEOUT=300
|
||||
SS_VERBOSE=0
|
||||
SS_PASSWORD=${config.sops.placeholder."ss-zapret2/password"}
|
||||
'';
|
||||
|
||||
# TODO: move from common config
|
||||
vps.services.ss-zapret2.config = pkgs.writeText "ss-zapret2-config" ''
|
||||
FWTYPE=nftables
|
||||
|
||||
SET_MAXELEM=522288
|
||||
IPSET_OPT="hashsize 262144 maxelem $SET_MAXELEM"
|
||||
IP2NET_OPT4="--prefix-length=22-30 --v4-threshold=3/4"
|
||||
IP2NET_OPT6="--prefix-length=56-64 --v6-threshold=5"
|
||||
|
||||
AUTOHOSTLIST_INCOMING_MAXSEQ=4096
|
||||
AUTOHOSTLIST_RETRANS_MAXSEQ=32768
|
||||
AUTOHOSTLIST_RETRANS_RESET=1
|
||||
AUTOHOSTLIST_RETRANS_THRESHOLD=3
|
||||
AUTOHOSTLIST_FAIL_THRESHOLD=3
|
||||
AUTOHOSTLIST_FAIL_TIME=60
|
||||
AUTOHOSTLIST_UDP_IN=1
|
||||
AUTOHOSTLIST_UDP_OUT=4
|
||||
AUTOHOSTLIST_DEBUGLOG=0
|
||||
|
||||
MDIG_THREADS=30
|
||||
GZIP_LISTS=1
|
||||
|
||||
DESYNC_MARK=0x40000000
|
||||
DESYNC_MARK_POSTNAT=0x20000000
|
||||
|
||||
ZL=/opt/lists
|
||||
ZB=/opt/zapret2/files/fake
|
||||
ZF="--hostlist=$ZL/list-general.txt --hostlist-exclude=$ZL/list-exclude.txt --ipset-exclude=$ZL/ipset-exclude.txt"
|
||||
ZI="--ipset=$ZL/ipset-all.txt --hostlist-exclude=$ZL/list-exclude.txt --ipset-exclude=$ZL/ipset-exclude.txt"
|
||||
|
||||
NFQWS2_ENABLE=1
|
||||
NFQWS2_PORTS_TCP=80,443,2053,2083,2087,2096,5222,8443
|
||||
NFQWS2_PORTS_UDP=443,19294-19344,50000-50100
|
||||
# Empty PKT_OUT makes nft skip these lists and install only *_KEEPALIVE.
|
||||
# That left UDP voice and discord.media ports off the queue, and keepalive
|
||||
# mode fed every packet of a TCP download into nfqws2.
|
||||
NFQWS2_TCP_PKT_OUT=20
|
||||
NFQWS2_TCP_PKT_IN=10
|
||||
NFQWS2_UDP_PKT_OUT=5
|
||||
NFQWS2_UDP_PKT_IN=3
|
||||
|
||||
NFQWS2_OPT="
|
||||
--blob=fl_tls_google:@$ZB/tls_clienthello_www_google_com.bin
|
||||
--blob=fl_quic_google:@$ZB/quic_initial_www_google_com.bin
|
||||
--blob=fl_sferum:@$ZB/tls_clienthello_www_sferum_ru.bin
|
||||
--filter-udp=443 --filter-l7=quic $ZF --payload=quic_initial --lua-desync=fake:blob=fl_quic_google:repeats=6 --new
|
||||
--filter-udp=19294-19344,50000-50100 --filter-l7=discord,stun --payload=stun,discord_ip_discovery --lua-desync=fake:blob=fl_quic_google:repeats=6 --new
|
||||
--filter-tcp=2053,2083,2087,2096,8443 --hostlist-domains=discord.media --payload=tls_client_hello --lua-desync=multisplit:pos=1:seqovl=681:seqovl_pattern=fl_tls_google:ip_id=zero --new
|
||||
--filter-udp=443 --hostlist=$ZL/list-google.txt --payload=quic_initial --lua-desync=fake:blob=fl_quic_google:repeats=6 --new
|
||||
--filter-tcp=443 --hostlist=$ZL/list-google.txt --payload=tls_client_hello --lua-desync=multisplit:pos=1:seqovl=681:seqovl_pattern=fl_tls_google:ip_id=zero --new
|
||||
--filter-tcp=80,443 $ZF --payload=tls_client_hello --lua-desync=multisplit:pos=1:seqovl=681:seqovl_pattern=fl_tls_google:ip_id=zero --payload=http_req --lua-desync=fake:blob=fl_sferum:repeats=6:tcp_seq=1000 --lua-desync=multisplit:pos=2 --new
|
||||
--filter-udp=443 $ZI --payload=quic_initial --lua-desync=fake:blob=fl_quic_google:repeats=6 --new
|
||||
--filter-tcp=80,443,5222 --ipset=$ZL/ipset-telegram.txt --filter-l7=mtproto --lua-desync=multisplit:pos=32 --new
|
||||
--filter-tcp=80,443,8443 $ZI --payload=tls_client_hello --lua-desync=multisplit:pos=1:seqovl=681:seqovl_pattern=fl_tls_google:ip_id=zero --payload=http_req --lua-desync=fake:blob=fl_sferum:repeats=6:tcp_seq=1000 --lua-desync=multisplit:pos=2
|
||||
"
|
||||
|
||||
MODE_FILTER=none
|
||||
FLOWOFFLOAD=donttouch
|
||||
INIT_APPLY_FW=1
|
||||
FILTER_TTL_EXPIRED_ICMP=1
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
moduleCfg = config.vps.services.ss-zapret2;
|
||||
in
|
||||
{
|
||||
imports = [ ./config.nix ];
|
||||
|
||||
options.vps.services.ss-zapret2 = {
|
||||
enable = mkEnableOption "Enable ss-zapret2";
|
||||
config = mkOption {
|
||||
type = types.path;
|
||||
};
|
||||
socksPort = mkOption {
|
||||
type = types.port;
|
||||
default = 1080;
|
||||
};
|
||||
ssPort = mkOption {
|
||||
type = types.port;
|
||||
default = 8388;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf moduleCfg.enable {
|
||||
virtualisation.oci-containers.containers.ss-zapret2 = {
|
||||
image = "docker.io/vernette/ss-zapret2:v1.0.2";
|
||||
environmentFiles = [ config.sops.templates."ss-zapret2.env".path ];
|
||||
volumes = [
|
||||
"${moduleCfg.config}:/opt/zapret2/config"
|
||||
"${./lists}:/opt/lists"
|
||||
"/var/lib/ss-zapret2/lua:/opt/zapret2/lua"
|
||||
"/var/lib/ss-zapret2/fakes:/opt/zapret2/files/fake"
|
||||
];
|
||||
ports = [
|
||||
"127.0.0.1:${toString moduleCfg.ssPort}:${toString moduleCfg.ssPort}"
|
||||
"127.0.0.1:${toString moduleCfg.socksPort}:${toString moduleCfg.socksPort}"
|
||||
];
|
||||
extraOptions = [
|
||||
"--cap-add=NET_ADMIN"
|
||||
"--ulimit" "nofile=32768:65536"
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services.docker-ss-zapret2 = {
|
||||
serviceConfig = {
|
||||
Restart = lib.mkOverride 90 "always";
|
||||
};
|
||||
after = [ "sops-nix.service" ];
|
||||
wants = [ "sops-nix.service" ];
|
||||
path = with pkgs; [
|
||||
coreutils
|
||||
curl
|
||||
];
|
||||
preStart = ''
|
||||
dir=/var/lib/ss-zapret2/fakes
|
||||
base=https://raw.githubusercontent.com/Flowseal/zapret-discord-youtube/refs/heads/main/bin
|
||||
mkdir -p "$dir"
|
||||
|
||||
# download any missing/empty fake file from flowseal's bin/ folder
|
||||
for f in \
|
||||
tls_clienthello_www_google_com.bin \
|
||||
quic_initial_www_google_com.bin \
|
||||
tls_clienthello_www_sferum_ru.bin \
|
||||
tls_clienthello_max_ru.bin \
|
||||
tls_clienthello_4pda_to.bin \
|
||||
stun.bin
|
||||
do
|
||||
if [ ! -s "$dir/$f" ]; then
|
||||
echo "downloading $f"
|
||||
curl -fsSL --retry 3 -o "$dir/$f.tmp" "$base/$f"
|
||||
mv "$dir/$f.tmp" "$dir/$f"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d /var/lib/ss-zapret2/lua 0755 root root -"
|
||||
"d /var/lib/ss-zapret2/fakes 0755 root root -"
|
||||
];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
203.0.113.113/32
|
||||
@@ -0,0 +1,11 @@
|
||||
0.0.0.0/8
|
||||
10.0.0.0/8
|
||||
127.0.0.0/8
|
||||
172.16.0.0/12
|
||||
192.168.0.0/16
|
||||
169.254.0.0/16
|
||||
224.0.0.0/4
|
||||
100.64.0.0/10
|
||||
::1
|
||||
fc00::/7
|
||||
fe80::/10
|
||||
@@ -0,0 +1,14 @@
|
||||
91.108.56.0/22
|
||||
91.108.4.0/22
|
||||
91.108.8.0/22
|
||||
91.108.16.0/22
|
||||
91.108.12.0/22
|
||||
149.154.160.0/20
|
||||
91.105.192.0/23
|
||||
91.108.20.0/22
|
||||
185.76.151.0/24
|
||||
2001:b28:f23d::/48
|
||||
2001:b28:f23f::/48
|
||||
2001:67c:4e8::/48
|
||||
2001:b28:f23c::/48
|
||||
2a0a:f280::/32
|
||||
@@ -0,0 +1,129 @@
|
||||
2ip.ru
|
||||
3dnews.ru
|
||||
7-zip.org
|
||||
abr.ru
|
||||
adfox.ru
|
||||
admetrica.ru
|
||||
aida64.com
|
||||
akamaitechnologies.com
|
||||
alfabank.ru
|
||||
bankline.ru
|
||||
battlepass.ru
|
||||
boosty.to
|
||||
calibre-ebook.com
|
||||
ccleaner.com
|
||||
cdn-tinkoff.ru
|
||||
citilink.ru
|
||||
dbo-dengi.online
|
||||
dns-shop.ru
|
||||
documentfoundation.org
|
||||
donationalerts.com
|
||||
epicgames.com
|
||||
epicgames.dev
|
||||
filezilla-project.org
|
||||
finargot.ru
|
||||
freecad.org
|
||||
gallery.vsassets.io
|
||||
gallerycdn.vsassets.io
|
||||
gazprombank.ru
|
||||
geobasket.ru
|
||||
gosuslugi.ru
|
||||
gov.ru
|
||||
gpb.ru
|
||||
gpg4win.org
|
||||
habr.com
|
||||
handbrake.fr
|
||||
korabli.su
|
||||
leagueoflegends.com
|
||||
lesta.pw
|
||||
lesta.ru
|
||||
libreoffice.org
|
||||
live.com
|
||||
mail.ru
|
||||
marketplace.visualstudio.com
|
||||
microsoft.com
|
||||
microsoftonline.com
|
||||
minecraft.net
|
||||
mos.ru
|
||||
msi.com
|
||||
mts.ru
|
||||
mtsdengi.ru
|
||||
multimc.org
|
||||
mycdn.me
|
||||
nalog.ru
|
||||
naydex.net
|
||||
nvidia.com
|
||||
odkl.ru
|
||||
ok.ru
|
||||
okcdn.ru
|
||||
ozon.by
|
||||
ozon.com
|
||||
ozon.com.by
|
||||
ozon.com.kz
|
||||
ozon.kz
|
||||
ozon.ru
|
||||
ozon.tm
|
||||
ozone.ru
|
||||
ozonru.me
|
||||
ozonusercontent.com
|
||||
paywb.com
|
||||
playvalorant.com
|
||||
psbank.ru
|
||||
pusher.com
|
||||
reg.ru
|
||||
riotcdn.net
|
||||
riotgames.com
|
||||
rosbank.ru
|
||||
rostaxi.org
|
||||
rshb.ru
|
||||
rwb.ru
|
||||
sber.ru
|
||||
sberbank.com
|
||||
sberbank.ru
|
||||
sharepoint.com
|
||||
spb.ru
|
||||
steamcommunity.com
|
||||
steampowered.com
|
||||
steamusercontent.com
|
||||
sumatrapdfreader.org
|
||||
t-bank-app.ru
|
||||
tanki.su
|
||||
tanksblitz.ru
|
||||
tbank-online.com
|
||||
tbank.ru
|
||||
tochka-tech.com
|
||||
tochka.com
|
||||
turbopages.org
|
||||
twitch.tv
|
||||
unrealengine.com
|
||||
vk.com
|
||||
vk.me
|
||||
vk.ru
|
||||
vkvideo.ru
|
||||
vtb.ru
|
||||
wb-basket.ru
|
||||
wb.ru
|
||||
wbbasket.ru
|
||||
wbpay.ru
|
||||
webvisor.com
|
||||
webvisor.org
|
||||
wibes.ru
|
||||
wildberries.ru
|
||||
win-rar.com
|
||||
xboxlive.com
|
||||
ya.ru
|
||||
yandex.com
|
||||
yandex.kz
|
||||
yandex.md
|
||||
yandex.net
|
||||
yandex.org
|
||||
yandex.ru
|
||||
yandexadexchange.net
|
||||
yandexcloud.net
|
||||
yandexcom.net
|
||||
yandexmetrica.com
|
||||
yandexwebcache.net
|
||||
yandexwebcache.org
|
||||
yastat.net
|
||||
yastatic-net.ru
|
||||
yastatic.net
|
||||
@@ -0,0 +1,59 @@
|
||||
^dns.google
|
||||
^dns.quad9.net
|
||||
^dns.nextdns.io
|
||||
^doh.opendns.com
|
||||
^doh.cleanbrowsing.org
|
||||
^freedns.controld.com
|
||||
^wikimedia-dns.org
|
||||
^cloudflare-dns.com
|
||||
cloudflare-ech.com
|
||||
encryptedsni.com
|
||||
cloudflareaccess.com
|
||||
cloudflareapps.com
|
||||
cloudflarebolt.com
|
||||
cloudflareclient.com
|
||||
cloudflareinsights.com
|
||||
cloudflareok.com
|
||||
cloudflarepartners.com
|
||||
cloudflareportal.com
|
||||
cloudflarepreview.com
|
||||
cloudflareresolve.com
|
||||
cloudflaressl.com
|
||||
cloudflarestatus.com
|
||||
cloudflarestorage.com
|
||||
cloudflarestream.com
|
||||
cloudflaretest.com
|
||||
cloudfront.net
|
||||
dis.gd
|
||||
discord-attachments-uploads-prd.storage.googleapis.com
|
||||
discord.app
|
||||
discord.co
|
||||
discord.com
|
||||
discord.design
|
||||
discord.dev
|
||||
discord.gift
|
||||
discord.gifts
|
||||
discord.gg
|
||||
discord.media
|
||||
discord.new
|
||||
discord.store
|
||||
discord.status
|
||||
discord-activities.com
|
||||
discordactivities.com
|
||||
discordapp.com
|
||||
discordapp.net
|
||||
discordcdn.com
|
||||
discordmerch.com
|
||||
discordpartygames.com
|
||||
discordsays.com
|
||||
discordsez.com
|
||||
discordstatus.com
|
||||
zendesk.com
|
||||
frankerfacez.com
|
||||
ffzap.com
|
||||
betterttv.net
|
||||
7tv.app
|
||||
7tv.io
|
||||
localizeapi.com
|
||||
klipy.com
|
||||
live-video.net
|
||||
@@ -0,0 +1,32 @@
|
||||
yt3.ggpht.com
|
||||
yt4.ggpht.com
|
||||
ggpht.com
|
||||
yt3.googleusercontent.com
|
||||
googleusercontent.com
|
||||
googlevideo.com
|
||||
accounts.google.com
|
||||
accounts.youtube.com
|
||||
oauth2.googleapis.com
|
||||
oauthaccountmanager.googleapis.com
|
||||
www.googleapis.com
|
||||
android.googleapis.com
|
||||
android.clients.google.com
|
||||
clients.google.com
|
||||
jnn-pa.googleapis.com
|
||||
stable.dl2.discordapp.net
|
||||
wide-youtube.l.google.com
|
||||
youtube-nocookie.com
|
||||
youtube-ui.l.google.com
|
||||
youtube.com
|
||||
youtubeembeddedplayer.googleapis.com
|
||||
youtubekids.com
|
||||
youtube.googleapis.com
|
||||
youtubei.googleapis.com
|
||||
youtu.be
|
||||
yt-video-upload.l.google.com
|
||||
ytimg.com
|
||||
ytimg.l.google.com
|
||||
play.google.com
|
||||
fonts.googleapis.com
|
||||
www.gstatic.com
|
||||
google.ru
|
||||
Reference in new issue
Block a user