|
@@ -767,9 +767,9 @@ function add_tor_bridge {
|
767
|
767
|
dialog --backtitle $"Freedombone Control Panel" \
|
768
|
768
|
--title $"Add obfs4 Tor bridge" \
|
769
|
769
|
--form "\n" 9 60 4 \
|
770
|
|
- $"IP address:" 1 1 " . . . " 1 15 16 16 \
|
771
|
|
- $"Port: " 2 1 "" 2 15 5 5 \
|
772
|
|
- $"Key: " 3 1 "" 3 15 250 250 \
|
|
770
|
+ $"IP address: " 1 1 " . . . " 1 17 16 16 \
|
|
771
|
+ $"Port: " 2 1 "" 2 17 5 5 \
|
|
772
|
+ $"Key/Nickname: " 3 1 "" 3 17 250 250 \
|
773
|
773
|
2> $data
|
774
|
774
|
sel=$?
|
775
|
775
|
case $sel in
|
|
@@ -821,16 +821,61 @@ function remove_tor_bridge {
|
821
|
821
|
--msgbox $"Bridge removed" 6 40
|
822
|
822
|
}
|
823
|
823
|
|
|
824
|
+function add_tor_bridge_relay {
|
|
825
|
+ read_config_param 'TOR_BRIDGE_NICKNAME'
|
|
826
|
+ read_config_param 'TOR_BRIDGE_PORT'
|
|
827
|
+
|
|
828
|
+ # remove any previous bridge port from the firewall
|
|
829
|
+ if [ ${#TOR_BRIDGE_PORT} -gt 0 ]; then
|
|
830
|
+ firewall_remove $TOR_BRIDGE_PORT tcp
|
|
831
|
+ fi
|
|
832
|
+
|
|
833
|
+ data=$(tempfile 2>/dev/null)
|
|
834
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
835
|
+ dialog --backtitle $"Freedombone Control Panel" \
|
|
836
|
+ --title $"Become an obfs4 Tor bridge relay" \
|
|
837
|
+ --form "\n" 8 60 2 \
|
|
838
|
+ $"Bridge Nickname: " 1 1 "$TOR_BRIDGE_NICKNAME" 1 20 250 250 \
|
|
839
|
+ 2> $data
|
|
840
|
+ sel=$?
|
|
841
|
+ case $sel in
|
|
842
|
+ 1) return;;
|
|
843
|
+ 255) return;;
|
|
844
|
+ esac
|
|
845
|
+ bridge_nickname=$(cat $data | sed -n 1p)
|
|
846
|
+ if [[ "${bridge_nickname}" == *" "* ]]; then
|
|
847
|
+ return
|
|
848
|
+ fi
|
|
849
|
+ if [ ${#bridge_nickname} -eq 0 ]; then
|
|
850
|
+ return
|
|
851
|
+ fi
|
|
852
|
+ TOR_BRIDGE_NICKNAME="$bridge_nickname"
|
|
853
|
+ TOR_BRIDGE_PORT=$((20000 + RANDOM % 40000))
|
|
854
|
+ write_config_param 'TOR_BRIDGE_NICKNAME' "$TOR_BRIDGE_NICKNAME"
|
|
855
|
+ write_config_param 'TOR_BRIDGE_PORT' "$TOR_BRIDGE_PORT"
|
|
856
|
+ tor_create_bridge_relay
|
|
857
|
+ dialog --title $"You are now an obfs4 Tor bridge relay" \
|
|
858
|
+ --msgbox $"\nIP address: $(get_ipv4_address)\n\nPort: ${TOR_BRIDGE_PORT}\n\nNickname: ${TOR_BRIDGE_NICKNAME}" 10 65
|
|
859
|
+}
|
|
860
|
+
|
|
861
|
+function remove_tor_bridge_relay {
|
|
862
|
+ tor_remove_bridge_relay
|
|
863
|
+ dialog --title $"Remove Tor bridge relay" \
|
|
864
|
+ --msgbox $"Bridge relay removed" 10 60
|
|
865
|
+}
|
|
866
|
+
|
824
|
867
|
function menu_tor_bridges {
|
825
|
868
|
data=$(tempfile 2>/dev/null)
|
826
|
869
|
trap "rm -f $data" 0 1 2 5 15
|
827
|
870
|
dialog --backtitle $"Freedombone Control Panel" \
|
828
|
871
|
--title $"Tor Bridges" \
|
829
|
|
- --radiolist $"Choose an operation:" 12 50 4 \
|
|
872
|
+ --radiolist $"Choose an operation:" 14 50 6 \
|
830
|
873
|
1 $"Show bridges" off \
|
831
|
874
|
2 $"Add a bridge" off \
|
832
|
875
|
3 $"Remove a bridge" off \
|
833
|
|
- 4 $"Go Back/Exit" on 2> $data
|
|
876
|
+ 4 $"Make this system into a bridge" off \
|
|
877
|
+ 5 $"Stop being a bridge" off \
|
|
878
|
+ 6 $"Go Back/Exit" on 2> $data
|
834
|
879
|
sel=$?
|
835
|
880
|
case $sel in
|
836
|
881
|
1) exit 1;;
|
|
@@ -851,6 +896,14 @@ function menu_tor_bridges {
|
851
|
896
|
exit 0
|
852
|
897
|
;;
|
853
|
898
|
4)
|
|
899
|
+ add_tor_bridge_relay
|
|
900
|
+ exit 0
|
|
901
|
+ ;;
|
|
902
|
+ 5)
|
|
903
|
+ remove_tor_bridge_relay
|
|
904
|
+ exit 0
|
|
905
|
+ ;;
|
|
906
|
+ 6)
|
854
|
907
|
exit 0
|
855
|
908
|
;;
|
856
|
909
|
esac
|