Pier Angelo Vendrame pushed to branch main at The Tor Project / Applications / tor-browser-build 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: - projects/moat-settings/build - projects/tor-expert-bundle/build - projects/tor-expert-bundle/config - + projects/tor-expert-bundle/make_pt_config.py - − projects/tor-expert-bundle/pt_config.json - + projects/tor-expert-bundle/transports.json Changes: ===================================== projects/moat-settings/build ===================================== @@ -1,11 +1,15 @@ #!/bin/bash [% c("var/set_default_env") -%] -tar -xf [% project %]-[% c("version") %].tar.[% c('compress_tar') %] [% project %]-[% c("version") %]/conf/circumvention.json +tar -xf [% project %]-[% c("version") %].tar.[% c('compress_tar') %] \ + [% project %]-[% c("version") %]/conf/builtin.json \ + [% project %]-[% c("version") %]/conf/circumvention.json +jq 'del(.["meek-azure"])' [% project %]-[% c("version") %]/conf/builtin.json > builtin.json jq -c keys [% project %]-[% c("version") %]/conf/circumvention.json > moat_countries.json +[% c("touch") %] builtin.json [% c("touch") %] moat_countries.json [% c('tar', { - tar_src => 'moat_countries.json', - tar_args => '-caf ' _ dest_dir _ '/' _ c('filename'), - }) %] + tar_src => 'builtin.json moat_countries.json', + tar_args => '-caf ' _ dest_dir _ '/' _ c('filename'), + }) %] ===================================== projects/tor-expert-bundle/build ===================================== @@ -6,10 +6,14 @@ mkdir -p $distdir output_dir=[% dest_dir %]/[% c('filename') %] mkdir -p $output_dir +tar -xf $rootdir/[% c('input_files_by_name/moat-settings') %] + cd $distdir tar -xkf $rootdir/[% c('input_files_by_name/tor') %] +mv "$rootdir/torrc-defaults" data + cd tor mkdir pluggable_transports && cd pluggable_transports @@ -34,8 +38,8 @@ pt_licenses $distdir/docs/lyrebird.txt pt_licenses $distdir/docs/conjure.txt [% END -%] -# add per-platform pt extension -awk '{gsub(/\$\{pt_extension\}/, "[% c("var/pt_extension") %]"); print}' $rootdir/pt_config.json > pt_config.json +cd $rootdir +python3 make_pt_config.py [% c('var/recommended_transport') %] [% c('var/platform') %] $distdir cd $distdir @@ -71,12 +75,6 @@ cd $distdir cd .. [% END %] -# Write our ClientTransportPlugin lines to torrc-defults -jq --raw-output .pluggableTransports[] "tor/pluggable_transports/pt_config.json" | while read -r line; do - echo "${line/\$\{pt_path\}/[% c("var/pt_path") %]}" >> "$rootdir/torrc-defaults" -done -mv "$rootdir/torrc-defaults" data - [% SET tar_src = [ "tor", "data", "docs" ]; IF c("var/linux"); ===================================== projects/tor-expert-bundle/config ===================================== @@ -2,18 +2,8 @@ filename: '[% project %]-[% c("var/osname") %]-[% c("var/build_id") %]' version: '[% c("var/torbrowser_version") %]' -targets: - linux: - var: - pt_path: ./TorBrowser/Tor/PluggableTransports/ - macos: - var: - pt_path: PluggableTransports/ - windows: - var: - # Backlashes need to be escaped here. - pt_path: TorBrowser\\Tor\\PluggableTransports\\ - pt_extension: .exe +var: + recommended_transport: obfs4 input_files: - name: tor @@ -23,7 +13,10 @@ input_files: - name: conjure project: conjure enable: '[% !c("var/android-x86_64") %]' - - filename: pt_config.json + - filename: make_pt_config.py + - filename: transports.json + - name: moat-settings + project: moat-settings - filename: torrc-defaults enable: '[% !c("var/android") %]' - filename: AndroidManifest.xml ===================================== projects/tor-expert-bundle/make_pt_config.py ===================================== @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 +import argparse +from collections import OrderedDict +import json +from pathlib import Path + +parser = argparse.ArgumentParser() +parser.add_argument("recommended_transport") +parser.add_argument("platform") +parser.add_argument("dest", type=Path) +args = parser.parse_args() + +pt_path = "" +pt_extension = "" +if args.platform == "linux": + pt_path = "./TorBrowser/Tor/PluggableTransports/" +elif args.platform == "macos": + pt_path = "PluggableTransports/" +elif args.platform == "windows": + pt_path = "TorBrowser\\Tor\\PluggableTransports\\" + pt_extension = ".exe" + +pt_lines = OrderedDict() +with open("transports.json") as f: + transports = json.load(f, object_pairs_hook=OrderedDict) +for key, defs in transports.items(): + defs["path"] = ( + defs["path"] + .replace("${pt_path}", pt_path) + .replace("${pt_extension}", pt_extension) + ) + protocols = ",".join(defs["protocols"]) + arguments = " ".join(defs.get("arguments", [])) + if arguments: + arguments = " " + arguments + pt_lines[key] = ( + f'ClientTransportPlugin {protocols} exec {defs["path"]}{arguments}' + ) + +with open("builtin.json") as f: + bridges = json.load(f, object_pairs_hook=OrderedDict) + +output = OrderedDict() +output["recommendedDefault"] = args.recommended_transport +output["transports"] = transports +output["pluggableTransports"] = pt_lines +output["bridges"] = bridges + +with (args.dest / "tor/pluggable_transports/pt_config.json").open("w") as f: + json.dump(output, f, indent=2) +with (args.dest / "data/torrc-defaults").open("a+") as f: + for line in pt_lines.values(): + f.write(line + "\n") ===================================== projects/tor-expert-bundle/pt_config.json deleted ===================================== @@ -1,27 +0,0 @@ -{ - "recommendedDefault" : "obfs4", - "pluggableTransports" : { - "lyrebird" : "ClientTransportPlugin meek_lite,obfs2,obfs3,obfs4,scramblesuit,webtunnel exec ${pt_path}lyrebird${pt_extension}", - "snowflake": "ClientTransportPlugin snowflake exec ${pt_path}lyrebird${pt_extension}", - "conjure" : "ClientTransportPlugin conjure exec ${pt_path}conjure-client${pt_extension} -registerURL https://registration.refraction.network/api" - }, - "bridges" : { - "meek" : [ - "meek_lite 192.0.2.20:80 url=https://1603026938.rsc.cdn77.org front=www.phpmyadmin.net utls=HelloRandomizedALPN" - ], - "obfs4" : [ - "obfs4 37.218.245.14:38224 D9A82D2F9C2F65A18407B1D2B764F130847F8B5D cert=bjRaMrr1BRiAW8IE9U5z27fQaYgOhX1UCmOpg2pFpoMvo6ZgQMzLsaTzzQNTlm7hNcb+Sg iat-mode=0", - "obfs4 209.148.46.65:443 74FAD13168806246602538555B5521A0383A1875 cert=ssH+9rP8dG2NLDN2XuFw63hIO/9MNNinLmxQDpVa+7kTOa9/m+tGWT1SmSYpQ9uTBGa6Hw iat-mode=0", - "obfs4 146.57.248.225:22 10A6CD36A537FCE513A322361547444B393989F0 cert=K1gDtDAIcUfeLqbstggjIw2rtgIKqdIhUlHp82XRqNSq/mtAjp1BIC9vHKJ2FAEpGssTPw iat-mode=0", - "obfs4 45.145.95.6:27015 C5B7CD6946FF10C5B3E89691A7D3F2C122D2117C cert=TD7PbUO0/0k6xYHMPW3vJxICfkMZNdkRrb63Zhl5j9dW3iRGiCx0A7mPhe5T2EDzQ35+Zw iat-mode=0", - "obfs4 51.222.13.177:80 5EDAC3B810E12B01F6FD8050D2FD3E277B289A08 cert=2uplIpLQ0q9+0qMFrK5pkaYRDOe460LL9WHBvatgkuRr/SL31wBOEupaMMJ6koRE6Ld0ew iat-mode=0", - "obfs4 212.83.43.95:443 BFE712113A72899AD685764B211FACD30FF52C31 cert=ayq0XzCwhpdysn5o0EyDUbmSOx3X/oTEbzDMvczHOdBJKlvIdHHLJGkZARtT4dcBFArPPg iat-mode=1", - "obfs4 212.83.43.74:443 39562501228A4D5E27FCA4C0C81A01EE23AE3EE4 cert=PBwr+S8JTVZo6MPdHnkTwXJPILWADLqfMGoVvhZClMq/Urndyd42BwX9YFJHZnBB3H0XCw iat-mode=1" - ], - "snowflake" : [ - "snowflake 192.0.2.3:80 2B280B23E1107BB62ABFC40DDCC8824814F80A72 fingerprint=2B280B23E1107BB62ABFC40DDCC8824814F80A72 url=https://1098762253.rsc.cdn77.org/ 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", - "snowflake 192.0.2.4:80 8838024498816A039FCBBAB14E6F40A0843051FA fingerprint=8838024498816A039FCBBAB14E6F40A0843051FA url=https://1098762253.rsc.cdn77.org/ 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" - ] - } -} - ===================================== projects/tor-expert-bundle/transports.json ===================================== @@ -0,0 +1,22 @@ +{ + "lyrebird": { + "protocols": [ + "meek_lite", + "obfs2", + "obfs3", + "obfs4", + "scramblesuit", + "webtunnel" + ], + "path": "${pt_path}lyrebird${pt_extension}" + }, + "snowflake": { + "protocols": ["snowflake"], + "path": "${pt_path}lyrebird${pt_extension}" + }, + "conjure": { + "protocols": ["conjure"], + "path": "${pt_path}conjure-client${pt_extension}", + "arguments": ["-registerURL", "https://registration.refraction.network/api"] + } +} View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/08... -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/08... You're receiving this email because of your account on gitlab.torproject.org. Manage all notifications: https://gitlab.torproject.org/-/profile/notifications | Help: https://gitlab.torproject.org/help
participants (1)
-
Pier Angelo Vendrame (@pierov)