[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [chutney/master] Add an obfs4 network
commit d1d9577bcca592f709de7facbbbcf049756f3b51
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Tue May 14 14:37:27 2019 -0400
Add an obfs4 network
This is a two-phase network: you need to configure and launch phase
1, and then configure and launch phase 2. Because of that the
test-network script won't work as-is.
---
networks/bridges-obfs4 | 39 +++++++++++++++++++++++++++++++++
torrc_templates/bridge-obfs4.tmpl | 6 +++++
torrc_templates/bridgeclient-obfs4.tmpl | 3 +++
3 files changed, 48 insertions(+)
diff --git a/networks/bridges-obfs4 b/networks/bridges-obfs4
new file mode 100644
index 0000000..b1ca6c4
--- /dev/null
+++ b/networks/bridges-obfs4
@@ -0,0 +1,39 @@
+# By default, Authorities are not configured as exits
+Authority = Node(tag="a", authority=1, relay=1, torrc="authority.tmpl")
+ExitRelay = Node(tag="r", relay=1, exit=1, torrc="relay.tmpl")
+Client = Node(tag="c", client=1, torrc="client.tmpl")
+
+BridgeAuthority = Node(tag="ba", authority=1, bridgeauthority=1,
+ relay=1, torrc="bridgeauthority.tmpl")
+Bridge = Node(tag="br", bridge=1, pt_bridge=1, relay=1, pt_transport="obfs4",
+ torrc="bridge-obfs4.tmpl")
+
+def obfs4_extra_args(env):
+ import os, re
+ # find the obfs4_bridgeline file.
+ location = os.path.join(env['dir'],
+ "pt_state",
+ "obfs4_bridgeline.txt")
+ if not os.path.exists(location):
+ return ""
+ # read the file and find the actual line
+ with open(location, 'r') as f:
+ for line in f:
+ if line.startswith("#"):
+ continue
+ if line.isspace():
+ continue
+ m = re.match(r'(.*<FINGERPRINT>) (cert.*)', line)
+ if m:
+ return m.group(2)
+ return ""
+
+Bridge.set_runtime("pt_extra", obfs4_extra_args)
+
+BridgeClient = Node(tag="bc", client=1, bridgeclient=1,
+ torrc="bridgeclient-obfs4.tmpl", config_phase=2, launch_phase=2)
+
+NODES = Authority.getN(3) + BridgeAuthority.getN(1) + ExitRelay.getN(4) + \
+ Bridge.getN(1) + Client.getN(1) + BridgeClient.getN(1)
+
+ConfigureNodes(NODES)
diff --git a/torrc_templates/bridge-obfs4.tmpl b/torrc_templates/bridge-obfs4.tmpl
new file mode 100644
index 0000000..e9b40bf
--- /dev/null
+++ b/torrc_templates/bridge-obfs4.tmpl
@@ -0,0 +1,6 @@
+${include:bridge.tmpl}
+
+ServerTransportPlugin obfs4 exec ${path:obfs4proxy}
+ExtOrPort $extorport
+ServerTransportListenAddr obfs4 ${ip}:${ptport}
+
diff --git a/torrc_templates/bridgeclient-obfs4.tmpl b/torrc_templates/bridgeclient-obfs4.tmpl
new file mode 100644
index 0000000..403d2f6
--- /dev/null
+++ b/torrc_templates/bridgeclient-obfs4.tmpl
@@ -0,0 +1,3 @@
+${include:bridgeclient.tmpl}
+
+ClientTransportPlugin obfs4 exec ${path:obfs4proxy}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits