Kaynağa Gözat

Tor hotspot

Bob Mottram 10 yıl önce
ebeveyn
işleme
ff53f9010c
1 değiştirilmiş dosya ile 31 ekleme ve 36 silme
  1. 31
    36
      install-freedombone.sh

+ 31
- 36
install-freedombone.sh Dosyayı Görüntüle

@@ -340,8 +340,8 @@ WIFI_IP_RANGE_END="192.168.4.20"
340 340
 # Broadcast address for wifi hotspot
341 341
 WIFI_BROADCAST_ADDRESS="192.168.4.255"
342 342
 
343
-# Comma separated list of DNS servers for wifi hotspot
344
-WIFI_DNS_SERVERS="213.73.91.35, 85.214.20.141"
343
+# space separated list of DNS servers for wifi hotspot
344
+WIFI_DNS_SERVERS="213.73.91.35 85.214.20.141"
345 345
 
346 346
 # message if something fails to install
347 347
 CHECK_MESSAGE="Check your internet connection, /etc/network/interfaces and /etc/resolv.conf, then delete $COMPLETION_FILE, run 'rm -fR /var/lib/apt/lists/* && apt-get update --fix-missing' and run this script again. If hash sum mismatches persist then try setting $DEBIAN_REPO to a different mirror and also change /etc/apt/sources.list."
@@ -590,7 +590,7 @@ function install_not_on_BBB {
590 590
   echo "    address $LOCAL_NETWORK_STATIC_IP_ADDRESS" >> /etc/network/interfaces
591 591
   echo '    netmask 255.255.255.0' >> /etc/network/interfaces
592 592
   echo "    gateway $ROUTER_IP_ADDRESS" >> /etc/network/interfaces
593
-  echo '    dns-nameservers 213.73.91.35 85.214.20.141' >> /etc/network/interfaces
593
+  echo "    dns-nameservers $WIFI_DNS_SERVERS" >> /etc/network/interfaces
594 594
   echo '# Example to keep MAC address between reboots' >> /etc/network/interfaces
595 595
   echo '#hwaddress ether DE:AD:BE:EF:CA:FE' >> /etc/network/interfaces
596 596
   echo '' >> /etc/network/interfaces
@@ -6982,7 +6982,7 @@ function route_outgoing_traffic_through_tor {
6982 6982
 
6983 6983
   ### set variables
6984 6984
   # Destinations you don't want routed through Tor
6985
-  _non_tor="192.168.1.0/24 192.168.0.0/24"
6985
+  _non_tor="192.168.4.0/24 192.168.1.0/24 192.168.0.0/24"
6986 6986
 
6987 6987
   # The user that Tor runs as
6988 6988
   _tor_uid="debian-tor"
@@ -6993,6 +6993,19 @@ function route_outgoing_traffic_through_tor {
6993 6993
   # Your internal interface
6994 6994
   _int_if="eth0"
6995 6995
 
6996
+  # Ensure that redirects are possible
6997
+  sed -i "s/net.ipv4.conf.all.accept_redirects = 0/net.ipv4.conf.all.accept_redirects = 1/g" /etc/sysctl.conf
6998
+  sed -i "s/net.ipv4.conf.all.send_redirects = 0/net.ipv4.conf.all.send_redirects = 1/g" /etc/sysctl.conf
6999
+  sed -i "s/net.ipv4.conf.all.accept_source_route = 0/net.ipv4.conf.all.accept_source_route = 1/g" /etc/sysctl.conf
7000
+  sed -i "s/net.ipv4.conf.default.rp_filter=1/#net.ipv4.conf.default.rp_filter=1/g" /etc/sysctl.conf
7001
+  sed -i "s/net.ipv4.conf.all.rp_filter=1/#net.ipv4.conf.all.rp_filter=1/g" /etc/sysctl.conf
7002
+  #sed -i 's/net.ipv4.icmp_echo_ignore_all = 1/net.ipv4.icmp_echo_ignore_all = 0/g' /etc/sysctl.conf
7003
+
7004
+  #iptables --flush
7005
+  #iptables --table nat --flush
7006
+  #iptables --delete-chain
7007
+  #iptables --table nat --delete-chain
7008
+
6996 7009
   ### Set iptables *nat
6997 7010
   iptables -t nat -A OUTPUT -o lo -j RETURN
6998 7011
   iptables -t nat -A OUTPUT -m owner --uid-owner $_tor_uid -j RETURN
@@ -7065,6 +7078,14 @@ function route_outgoing_traffic_through_tor {
7065 7078
   fi
7066 7079
 
7067 7080
   echo 'route_outgoing_traffic_through_tor' >> $COMPLETION_FILE
7081
+
7082
+  if [[ $ENABLE_WIFI_HOTSPOT == "yes" ]]; then
7083
+      echo ''
7084
+      echo '  *** Freedombone Tor Wifi access point installation is complete. Rebooting... ***'
7085
+      echo ''
7086
+      cat /home/$MY_USERNAME/README
7087
+      reboot
7088
+  fi
7068 7089
 }
7069 7090
 
7070 7091
 # A command to create a git repository for a project
@@ -7237,27 +7258,6 @@ function enable_wifi_hotspot {
7237 7258
       echo "    dns-nameservers $ROUTER_IP_ADDRESS" >> /etc/network/interfaces
7238 7259
   fi
7239 7260
 
7240
-  #sed -i 's/#net.ipv4.ip_forward/net.ipv4.ip_forward/g' /etc/sysctl.conf
7241
-  #sed -i 's/net.ipv4.ip_forward=.*/net.ipv4.ip_forward=1/g' /etc/sysctl.conf
7242
-  #echo 1 > /proc/sys/net/ipv4/ip_forward
7243
-
7244
-  #sed -i "s/net.ipv4.conf.all.accept_redirects = 0/net.ipv4.conf.all.accept_redirects = 1/g" /etc/sysctl.conf
7245
-  #sed -i "s/net.ipv4.conf.all.send_redirects = 0/net.ipv4.conf.all.send_redirects = 1/g" /etc/sysctl.conf
7246
-  #sed -i "s/net.ipv4.conf.all.accept_source_route = 0/net.ipv4.conf.all.accept_source_route = 1/g" /etc/sysctl.conf
7247
-  #sed -i "s/net.ipv4.conf.default.rp_filter=1/#net.ipv4.conf.default.rp_filter=1/g" /etc/sysctl.conf
7248
-  #sed -i "s/net.ipv4.conf.all.rp_filter=1/#net.ipv4.conf.all.rp_filter=1/g" /etc/sysctl.conf
7249
-  #sed -i "s/net.ipv4.ip_forward=0/#net.ipv4.ip_forward=1/g" /etc/sysctl.conf
7250
-  #sed -i 's/net.ipv4.icmp_echo_ignore_all = 1/net.ipv4.icmp_echo_ignore_all = 0/g' /etc/sysctl.conf
7251
-
7252
-  #iptables --flush
7253
-  #iptables --table nat --flush
7254
-  #iptables --delete-chain
7255
-  #iptables --table nat --delete-chain
7256
-  #iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
7257
-  #iptables -A FORWARD -i eth0 -o $WIFI_INTERFACE -m state --state RELATED,ESTABLISHED -j ACCEPT
7258
-  #iptables -A FORWARD -i $WIFI_INTERFACE -o eth0 -j ACCEPT
7259
-  #save_firewall_settings
7260
-
7261 7261
   sed -i 's/option domain-name "example.org";/#option domain-name "example.org";/g' /etc/dhcp/dhcpd.conf
7262 7262
   sed -i 's/option domain-name-servers ns1.example.org, ns2.example.org;/#option domain-name-servers ns1.example.org, ns2.example.org;/g' /etc/dhcp/dhcpd.conf
7263 7263
   sed -i 's/#authoritative;/authoritative;/g' /etc/dhcp/dhcpd.conf
@@ -7276,11 +7276,6 @@ function enable_wifi_hotspot {
7276 7276
 
7277 7277
   sed -i "s/INTERFACES=.*/INTERFACES='$WIFI_INTERFACE'/g" /etc/default/isc-dhcp-server
7278 7278
 
7279
-  service networking restart
7280
-  service hostapd restart
7281
-  systemctl daemon-reload
7282
-  service isc-dhcp-server restart
7283
-
7284 7279
   # Add details to the README file
7285 7280
   if ! grep -q "Wifi Hotspot" /home/$MY_USERNAME/README; then
7286 7281
       echo '' >> /home/$MY_USERNAME/README
@@ -7338,12 +7333,6 @@ function enable_wifi {
7338 7333
       sed -i "s/wifipassword/$WIFI_PASSWORD/g" /etc/network/interfaces
7339 7334
   fi
7340 7335
 
7341
-  service networking restart
7342
-  if [ ! "$?" = "0" ]; then
7343
-      echo 'Unable to restart networking'
7344
-      exit 855
7345
-  fi
7346
-
7347 7336
   # Add details to the README file
7348 7337
   if [[ ENABLE_WIFI != "yes" ]]; then
7349 7338
       if ! grep -q "Wifi Settings" /home/$MY_USERNAME/README; then
@@ -7361,6 +7350,12 @@ function enable_wifi {
7361 7350
       fi
7362 7351
   fi
7363 7352
 
7353
+  service networking restart
7354
+  if [ ! "$?" = "0" ]; then
7355
+      echo 'Unable to restart networking'
7356
+      exit 855
7357
+  fi
7358
+
7364 7359
   echo 'enable_wifi' >> $COMPLETION_FILE
7365 7360
 }
7366 7361