Commits:
-
0830ce3f
by Pier Angelo Vendrame at 2026-11-19T19:23:45+01:00
Bug 41895&41923: Refactored pt_config.json.
We now include information about pluggable transport with the various
details split, which is useful for configuring arti.
We would like to delete the old pluggableTransport object at a certain
point.
We use a new transports.json, with such information as the source and
we generate from it the various ClientTransportPlugin lines.
The built-in bridge lines are now generated automatically from the
rdsys-admin repository managed by the Anticensorship Team.
6 changed files:
Changes:
projects/moat-settings/build
|
1
|
1
|
#!/bin/bash
|
|
2
|
2
|
[% c("var/set_default_env") -%]
|
|
3
|
3
|
|
|
4
|
|
-tar -xf [% project %]-[% c("version") %].tar.[% c('compress_tar') %] [% project %]-[% c("version") %]/conf/circumvention.json
|
|
|
4
|
+tar -xf [% project %]-[% c("version") %].tar.[% c('compress_tar') %] \
|
|
|
5
|
+ [% project %]-[% c("version") %]/conf/builtin.json \
|
|
|
6
|
+ [% project %]-[% c("version") %]/conf/circumvention.json
|
|
|
7
|
+jq 'del(.["meek-azure"])' [% project %]-[% c("version") %]/conf/builtin.json > builtin.json
|
|
5
|
8
|
jq -c keys [% project %]-[% c("version") %]/conf/circumvention.json > moat_countries.json
|
|
6
|
9
|
|
|
|
10
|
+[% c("touch") %] builtin.json
|
|
7
|
11
|
[% c("touch") %] moat_countries.json
|
|
8
|
12
|
[% c('tar', {
|
|
9
|
|
- tar_src => 'moat_countries.json',
|
|
10
|
|
- tar_args => '-caf ' _ dest_dir _ '/' _ c('filename'),
|
|
11
|
|
- }) %] |
|
|
13
|
+ tar_src => 'builtin.json moat_countries.json',
|
|
|
14
|
+ tar_args => '-caf ' _ dest_dir _ '/' _ c('filename'),
|
|
|
15
|
+ }) %] |
projects/tor-expert-bundle/build
| ... |
... |
@@ -6,10 +6,14 @@ mkdir -p $distdir |
|
6
|
6
|
output_dir=[% dest_dir %]/[% c('filename') %]
|
|
7
|
7
|
mkdir -p $output_dir
|
|
8
|
8
|
|
|
|
9
|
+tar -xf $rootdir/[% c('input_files_by_name/moat-settings') %]
|
|
|
10
|
+
|
|
9
|
11
|
cd $distdir
|
|
10
|
12
|
|
|
11
|
13
|
tar -xkf $rootdir/[% c('input_files_by_name/tor') %]
|
|
12
|
14
|
|
|
|
15
|
+mv "$rootdir/torrc-defaults" data
|
|
|
16
|
+
|
|
13
|
17
|
cd tor
|
|
14
|
18
|
mkdir pluggable_transports && cd pluggable_transports
|
|
15
|
19
|
|
| ... |
... |
@@ -34,8 +38,8 @@ pt_licenses $distdir/docs/lyrebird.txt |
|
34
|
38
|
pt_licenses $distdir/docs/conjure.txt
|
|
35
|
39
|
[% END -%]
|
|
36
|
40
|
|
|
37
|
|
-# add per-platform pt extension
|
|
38
|
|
-awk '{gsub(/\$\{pt_extension\}/, "[% c("var/pt_extension") %]"); print}' $rootdir/pt_config.json > pt_config.json
|
|
|
41
|
+cd $rootdir
|
|
|
42
|
+python3 make_pt_config.py [% c('var/recommended_transport') %] [% c('var/platform') %] $distdir
|
|
39
|
43
|
|
|
40
|
44
|
cd $distdir
|
|
41
|
45
|
|
| ... |
... |
@@ -71,12 +75,6 @@ cd $distdir |
|
71
|
75
|
cd ..
|
|
72
|
76
|
[% END %]
|
|
73
|
77
|
|
|
74
|
|
-# Write our ClientTransportPlugin lines to torrc-defults
|
|
75
|
|
-jq --raw-output .pluggableTransports[] "tor/pluggable_transports/pt_config.json" | while read -r line; do
|
|
76
|
|
- echo "${line/\$\{pt_path\}/[% c("var/pt_path") %]}" >> "$rootdir/torrc-defaults"
|
|
77
|
|
-done
|
|
78
|
|
-mv "$rootdir/torrc-defaults" data
|
|
79
|
|
-
|
|
80
|
78
|
[%
|
|
81
|
79
|
SET tar_src = [ "tor", "data", "docs" ];
|
|
82
|
80
|
IF c("var/linux");
|
projects/tor-expert-bundle/config
| ... |
... |
@@ -2,18 +2,8 @@ |
|
2
|
2
|
filename: '[% project %]-[% c("var/osname") %]-[% c("var/build_id") %]'
|
|
3
|
3
|
version: '[% c("var/torbrowser_version") %]'
|
|
4
|
4
|
|
|
5
|
|
-targets:
|
|
6
|
|
- linux:
|
|
7
|
|
- var:
|
|
8
|
|
- pt_path: ./TorBrowser/Tor/PluggableTransports/
|
|
9
|
|
- macos:
|
|
10
|
|
- var:
|
|
11
|
|
- pt_path: PluggableTransports/
|
|
12
|
|
- windows:
|
|
13
|
|
- var:
|
|
14
|
|
- # Backlashes need to be escaped here.
|
|
15
|
|
- pt_path: TorBrowser\\Tor\\PluggableTransports\\
|
|
16
|
|
- pt_extension: .exe
|
|
|
5
|
+var:
|
|
|
6
|
+ recommended_transport: obfs4
|
|
17
|
7
|
|
|
18
|
8
|
input_files:
|
|
19
|
9
|
- name: tor
|
| ... |
... |
@@ -23,7 +13,10 @@ input_files: |
|
23
|
13
|
- name: conjure
|
|
24
|
14
|
project: conjure
|
|
25
|
15
|
enable: '[% !c("var/android-x86_64") %]'
|
|
26
|
|
- - filename: pt_config.json
|
|
|
16
|
+ - filename: make_pt_config.py
|
|
|
17
|
+ - filename: transports.json
|
|
|
18
|
+ - name: moat-settings
|
|
|
19
|
+ project: moat-settings
|
|
27
|
20
|
- filename: torrc-defaults
|
|
28
|
21
|
enable: '[% !c("var/android") %]'
|
|
29
|
22
|
- filename: AndroidManifest.xml
|
projects/tor-expert-bundle/make_pt_config.py
|
|
1
|
+#!/usr/bin/env python3
|
|
|
2
|
+import argparse
|
|
|
3
|
+from collections import OrderedDict
|
|
|
4
|
+import json
|
|
|
5
|
+from pathlib import Path
|
|
|
6
|
+
|
|
|
7
|
+parser = argparse.ArgumentParser()
|
|
|
8
|
+parser.add_argument("recommended_transport")
|
|
|
9
|
+parser.add_argument("platform")
|
|
|
10
|
+parser.add_argument("dest", type=Path)
|
|
|
11
|
+args = parser.parse_args()
|
|
|
12
|
+
|
|
|
13
|
+pt_path = ""
|
|
|
14
|
+pt_extension = ""
|
|
|
15
|
+if args.platform == "linux":
|
|
|
16
|
+ pt_path = "./TorBrowser/Tor/PluggableTransports/"
|
|
|
17
|
+elif args.platform == "macos":
|
|
|
18
|
+ pt_path = "PluggableTransports/"
|
|
|
19
|
+elif args.platform == "windows":
|
|
|
20
|
+ pt_path = "TorBrowser\\Tor\\PluggableTransports\\"
|
|
|
21
|
+ pt_extension = ".exe"
|
|
|
22
|
+
|
|
|
23
|
+pt_lines = OrderedDict()
|
|
|
24
|
+with open("transports.json") as f:
|
|
|
25
|
+ transports = json.load(f, object_pairs_hook=OrderedDict)
|
|
|
26
|
+for key, defs in transports.items():
|
|
|
27
|
+ defs["path"] = (
|
|
|
28
|
+ defs["path"]
|
|
|
29
|
+ .replace("${pt_path}", pt_path)
|
|
|
30
|
+ .replace("${pt_extension}", pt_extension)
|
|
|
31
|
+ )
|
|
|
32
|
+ protocols = ",".join(defs["protocols"])
|
|
|
33
|
+ arguments = " ".join(defs.get("arguments", []))
|
|
|
34
|
+ if arguments:
|
|
|
35
|
+ arguments = " " + arguments
|
|
|
36
|
+ pt_lines[key] = (
|
|
|
37
|
+ f'ClientTransportPlugin {protocols} exec {defs["path"]}{arguments}'
|
|
|
38
|
+ )
|
|
|
39
|
+
|
|
|
40
|
+with open("builtin.json") as f:
|
|
|
41
|
+ bridges = json.load(f, object_pairs_hook=OrderedDict)
|
|
|
42
|
+
|
|
|
43
|
+output = OrderedDict()
|
|
|
44
|
+output["recommendedDefault"] = args.recommended_transport
|
|
|
45
|
+output["transports"] = transports
|
|
|
46
|
+output["pluggableTransports"] = pt_lines
|
|
|
47
|
+output["bridges"] = bridges
|
|
|
48
|
+
|
|
|
49
|
+with (args.dest / "tor/pluggable_transports/pt_config.json").open("w") as f:
|
|
|
50
|
+ json.dump(output, f, indent=2)
|
|
|
51
|
+with (args.dest / "data/torrc-defaults").open("a+") as f:
|
|
|
52
|
+ for line in pt_lines.values():
|
|
|
53
|
+ f.write(line + "\n") |
projects/tor-expert-bundle/pt_config.json
deleted
|
1
|
|
-{
|
|
2
|
|
- "recommendedDefault" : "obfs4",
|
|
3
|
|
- "pluggableTransports" : {
|
|
4
|
|
- "lyrebird" : "ClientTransportPlugin meek_lite,obfs2,obfs3,obfs4,scramblesuit,webtunnel exec ${pt_path}lyrebird${pt_extension}",
|
|
5
|
|
- "snowflake": "ClientTransportPlugin snowflake exec ${pt_path}lyrebird${pt_extension}",
|
|
6
|
|
- "conjure" : "ClientTransportPlugin conjure exec ${pt_path}conjure-client${pt_extension} -registerURL https://registration.refraction.network/api"
|
|
7
|
|
- },
|
|
8
|
|
- "bridges" : {
|
|
9
|
|
- "meek" : [
|
|
10
|
|
- "meek_lite 192.0.2.20:80 url="" front=www.phpmyadmin.net utls=HelloRandomizedALPN"
|
|
11
|
|
- ],
|
|
12
|
|
- "obfs4" : [
|
|
13
|
|
- "obfs4 37.218.245.14:38224 D9A82D2F9C2F65A18407B1D2B764F130847F8B5D cert=bjRaMrr1BRiAW8IE9U5z27fQaYgOhX1UCmOpg2pFpoMvo6ZgQMzLsaTzzQNTlm7hNcb+Sg iat-mode=0",
|
|
14
|
|
- "obfs4 209.148.46.65:443 74FAD13168806246602538555B5521A0383A1875 cert=ssH+9rP8dG2NLDN2XuFw63hIO/9MNNinLmxQDpVa+7kTOa9/m+tGWT1SmSYpQ9uTBGa6Hw iat-mode=0",
|
|
15
|
|
- "obfs4 146.57.248.225:22 10A6CD36A537FCE513A322361547444B393989F0 cert=K1gDtDAIcUfeLqbstggjIw2rtgIKqdIhUlHp82XRqNSq/mtAjp1BIC9vHKJ2FAEpGssTPw iat-mode=0",
|
|
16
|
|
- "obfs4 45.145.95.6:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0",
|
|
17
|
|
- "obfs4 51.222.13.177:80 5EDAC3B810E12B01F6FD8050D2FD3E277B289A08 cert=2uplIpLQ0q9+0qMFrK5pkaYRDOe460LL9WHBvatgkuRr/SL31wBOEupaMMJ6koRE6Ld0ew iat-mode=0",
|
|
18
|
|
- "obfs4 212.83.43.95:443 BFE712113A72899AD685764B211FACD30FF52C31 cert=ayq0XzCwhpdysn5o0EyDUbmSOx3X/oTEbzDMvczHOdBJKlvIdHHLJGkZARtT4dcBFArPPg iat-mode=1",
|
|
19
|
|
- "obfs4 212.83.43.74:443 39562501228A4D5E27FCA4C0C81A01EE23AE3EE4 cert=PBwr+S8JTVZo6MPdHnkTwXJPILWADLqfMGoVvhZClMq/Urndyd42BwX9YFJHZnBB3H0XCw iat-mode=1"
|
|
20
|
|
- ],
|
|
21
|
|
- "snowflake" : [
|
|
22
|
|
- "snowflake 192.0.2.3:80 2B280B23E1107BB62ABFC40DDCC8824814F80A72 fingerprint=2B280B23E1107BB62ABFC40DDCC8824814F80A72 url="" fronts=app.datapacket.com,www.datapacket.com ice=stun:stun.epygi.com:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.mixvoip.com:3478,stun:stun.telnyx.com:3478,stun:stun.hot-chilli.net:3478,stun:stun.fitauto.ru:3478,stun:stun.m-online.net:3478 utls-imitate=hellorandomizedalpn",
|
|
23
|
|
- "snowflake 192.0.2.4:80 8838024498816A039FCBBAB14E6F40A0843051FA fingerprint=8838024498816A039FCBBAB14E6F40A0843051FA url="" fronts=app.datapacket.com,www.datapacket.com ice=stun:stun.epygi.com:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.mixvoip.com:3478,stun:stun.telnyx.com:3478,stun:stun.hot-chilli.net:3478,stun:stun.fitauto.ru:3478,stun:stun.m-online.net:3478 utls-imitate=hellorandomizedalpn"
|
|
24
|
|
- ]
|
|
25
|
|
- }
|
|
26
|
|
-}
|
|
27
|
|
- |
projects/tor-expert-bundle/transports.json
|
|
1
|
+{
|
|
|
2
|
+ "lyrebird": {
|
|
|
3
|
+ "protocols": [
|
|
|
4
|
+ "meek_lite",
|
|
|
5
|
+ "obfs2",
|
|
|
6
|
+ "obfs3",
|
|
|
7
|
+ "obfs4",
|
|
|
8
|
+ "scramblesuit",
|
|
|
9
|
+ "webtunnel"
|
|
|
10
|
+ ],
|
|
|
11
|
+ "path": "${pt_path}lyrebird${pt_extension}"
|
|
|
12
|
+ },
|
|
|
13
|
+ "snowflake": {
|
|
|
14
|
+ "protocols": ["snowflake"],
|
|
|
15
|
+ "path": "${pt_path}lyrebird${pt_extension}"
|
|
|
16
|
+ },
|
|
|
17
|
+ "conjure": {
|
|
|
18
|
+ "protocols": ["conjure"],
|
|
|
19
|
+ "path": "${pt_path}conjure-client${pt_extension}",
|
|
|
20
|
+ "arguments": ["-registerURL", "https://registration.refraction.network/api"]
|
|
|
21
|
+ }
|
|
|
22
|
+} |
|