Pārlūkot izejas kodu

Batman firewall

Bob Mottram 9 gadus atpakaļ
vecāks
revīzija
32c290857e
1 mainītis faili ar 26 papildinājumiem un 5 dzēšanām
  1. 26
    5
      src/freedombone

+ 26
- 5
src/freedombone Parādīt failu

@@ -1626,25 +1626,30 @@ function mesh_batman {
1626 1626
   echo '# stop network manager to make the mesh network work' >> /usr/bin/mesh
1627 1627
   echo 'service networking stop' >> /usr/bin/mesh
1628 1628
   echo '' >> /usr/bin/mesh
1629
-  echo '# configure the wlan interface to operate with mtus of 1532(batman requires it) and turn enc off to ensure it works' >> /usr/bin/mesh
1629
+  echo -n '# configure the wlan interface to operate with ' >> /usr/bin/mesh
1630
+  echo 'mtus of 1532(batman requires it) and turn enc off ' >> /usr/bin/mesh
1631
+  echo 'to ensure it works' >> /usr/bin/mesh
1630 1632
   echo 'ifconfig wlan0 down' >> /usr/bin/mesh
1631 1633
   echo 'ifconfig wlan0 mtu 1532' >> /usr/bin/mesh
1632 1634
   echo 'iwconfig wlan0 enc off' >> /usr/bin/mesh
1633 1635
   echo '' >> /usr/bin/mesh
1634 1636
   echo '# add the interface to the ad-hoc network - or create it.' >> /usr/bin/mesh
1635
-  echo "iwconfig wlan0 mode ad-hoc essid mesh-$MESH_ESSID ap $BATMAN_IPV6 channel 2" >> /usr/bin/mesh
1637
+  echo -n "iwconfig wlan0 mode ad-hoc essid mesh-$MESH_ESSID ap " >> /usr/bin/mesh
1638
+  echo "$BATMAN_IPV6 channel 2" >> /usr/bin/mesh
1636 1639
   echo '' >> /usr/bin/mesh
1637
-  echo '# add wlan0 to the batman-adv virtual interface(so it can communicate with other batman-adv nodes)' >> /usr/bin/mesh
1640
+  echo -n '# add wlan0 to the batman-adv virtual interface(so it can ' >> /usr/bin/mesh
1641
+  echo 'communicate with other batman-adv nodes)' >> /usr/bin/mesh
1638 1642
   echo 'batctl if add wlan0' >> /usr/bin/mesh
1639 1643
   echo 'ifconfig wlan0 up' >> /usr/bin/mesh
1640 1644
   echo 'ifconfig bat0 up' >> /usr/bin/mesh
1641 1645
   echo '' >> /usr/bin/mesh
1642
-  echo '# make the bridge linking the batman-adv virtual interface to the ethernet port' >> /usr/bin/mesh
1646
+  echo -n '# make the bridge linking the batman-adv virtual ' >> /usr/bin/mesh
1647
+  echo 'interface to the ethernet port' >> /usr/bin/mesh
1643 1648
   echo 'brctl addbr bridge-link' >> /usr/bin/mesh
1644 1649
   echo 'brctl addif bridge-link bat0' >> /usr/bin/mesh
1645 1650
   echo 'brctl addif bridge-link eth0' >> /usr/bin/mesh
1646 1651
   echo '' >> /usr/bin/mesh
1647
-  echo '#get the ip address for the bridge from the dhcp server' >> /usr/bin/mesh
1652
+  echo '# get the ip address for the bridge from the dhcp server' >> /usr/bin/mesh
1648 1653
   echo 'dhclient bridge-link' >> /usr/bin/mesh
1649 1654
   echo '' >> /usr/bin/mesh
1650 1655
   echo 'exit 0' >> /usr/bin/mesh
@@ -5465,6 +5470,21 @@ function configure_firewall_for_cjdns {
5465 5470
   echo 'configure_firewall_for_cjdns' >> $COMPLETION_FILE
5466 5471
 }
5467 5472
 
5473
+function configure_firewall_for_batman {
5474
+  if grep -Fxq "configure_firewall_for_batman" $COMPLETION_FILE; then
5475
+      return
5476
+  fi
5477
+  if [[ $ENABLE_BATMAN != "yes" ]]; then
5478
+      return
5479
+  fi
5480
+  # DHCP
5481
+  #iptables -A INPUT -i eth0 -p udp --dport 547 -j ACCEPT
5482
+  # BATMAN
5483
+  #iptables -A INPUT -i eth0 -p udp --dport 1966 -j ACCEPT
5484
+  save_firewall_settings
5485
+  echo 'configure_firewall_for_batman' >> $COMPLETION_FILE
5486
+}
5487
+
5468 5488
 function configure_firewall_for_dlna {
5469 5489
   if grep -Fxq "configure_firewall_for_dlna" $COMPLETION_FILE; then
5470 5490
       return
@@ -9720,6 +9740,7 @@ configure_firewall_for_dns
9720 9740
 configure_firewall_for_ftp
9721 9741
 configure_firewall_for_web_access
9722 9742
 configure_firewall_for_cjdns
9743
+configure_firewall_for_batman
9723 9744
 configure_firewall_for_voip
9724 9745
 remove_proprietary_repos
9725 9746
 change_debian_repos