|
@@ -418,7 +418,7 @@ function tor_add_bridge {
|
418
|
418
|
return
|
419
|
419
|
fi
|
420
|
420
|
|
421
|
|
- apt-get install obfs4proxy
|
|
421
|
+ apt-get -yq install obfs4proxy
|
422
|
422
|
|
423
|
423
|
if grep "ClientTransportPlugin" /etc/tor/torrc; then
|
424
|
424
|
sed -i 's|#ClientTransportPlugin|ClientTransportPlugin|g' /etc/tor/torrc
|
|
@@ -465,4 +465,47 @@ function tor_remove_bridge {
|
465
|
465
|
systemctl restart tor
|
466
|
466
|
}
|
467
|
467
|
|
|
468
|
+function tor_create_bridge_relay {
|
|
469
|
+ apt-get -yq install obfs4proxy
|
|
470
|
+
|
|
471
|
+ sed -i 's|#BridgeRelay.*|BridgeRelay 1|g' /etc/tor/torrc
|
|
472
|
+ sed -i 's|BridgeRelay.*|BridgeRelay 1|g' /etc/tor/torrc
|
|
473
|
+ sed -i 's|#ServerTransportPlugin.*|ServerTransportPlugin obfs4 exec /usr/bin/obfs4proxy|g' /etc/tor/torrc
|
|
474
|
+ sed -i 's|ServerTransportPlugin.*|ServerTransportPlugin obfs4 exec /usr/bin/obfs4proxy|g' /etc/tor/torrc
|
|
475
|
+ if ! grep "ExtORPort auto" /etc/tor/torrc; then
|
|
476
|
+ echo 'ExtORPort auto' >> /etc/tor/torrc
|
|
477
|
+ else
|
|
478
|
+ sed -i 's|#ExtORPort auto|ExtORPort auto|g' /etc/tor/torrc
|
|
479
|
+ sed -i 's|ExtORPort .*|ExtORPort auto|g' /etc/tor/torrc
|
|
480
|
+ fi
|
|
481
|
+
|
|
482
|
+ read_config_param MY_'EMAIL_ADDRESS'
|
|
483
|
+ read_config_param 'TOR_BRIDGE_NICKNAME'
|
|
484
|
+
|
|
485
|
+ sed -i "s|#ContactInfo|ContactInfo $MY_EMAIL_ADDRESS|g" /etc/tor/torrc
|
|
486
|
+ if [ $TOR_BRIDGE_NICKNAME ]; then
|
|
487
|
+ sed -i "s|#Nickname|Nickname $TOR_BRIDGE_NICKNAME|g" /etc/tor/torrc
|
|
488
|
+ fi
|
|
489
|
+ systemctl restart tor
|
|
490
|
+}
|
|
491
|
+
|
|
492
|
+function tor_remove_bridge_relay {
|
|
493
|
+ if ! grep '#BridgeRelay ' /etc/tor/torrc; then
|
|
494
|
+ sed -i 's|BridgeRelay |#BridgeRelay |g' /etc/tor/torrc
|
|
495
|
+ fi
|
|
496
|
+ if ! grep '#ServerTransportPlugin ' /etc/tor/torrc; then
|
|
497
|
+ sed -i 's|ServerTransportPlugin |#ServerTransportPlugin |g' /etc/tor/torrc
|
|
498
|
+ fi
|
|
499
|
+ if ! grep '#ExtORPort ' /etc/tor/torrc; then
|
|
500
|
+ sed -i 's|ExtORPort |#ExtORPort |g' /etc/tor/torrc
|
|
501
|
+ fi
|
|
502
|
+ if ! grep '#ContactInfo ' /etc/tor/torrc; then
|
|
503
|
+ sed -i "s|ContactInfo |#ContactInfo |g" /etc/tor/torrc
|
|
504
|
+ fi
|
|
505
|
+ if ! grep '#Nickname ' /etc/tor/torrc; then
|
|
506
|
+ sed -i "s|Nickname |#Nickname |g" /etc/tor/torrc
|
|
507
|
+ fi
|
|
508
|
+ systemctl restart tor
|
|
509
|
+}
|
|
510
|
+
|
468
|
511
|
# NOTE: deliberately no exit 0
|