瀏覽代碼

cjdns firewall

Bob Mottram 10 年之前
父節點
當前提交
12746ce140
共有 1 個檔案被更改,包括 16 行新增1 行删除
  1. 16
    1
      install-freedombone.sh

+ 16
- 1
install-freedombone.sh 查看文件

@@ -687,7 +687,8 @@ function install_cjdns {
687 687
   sed -i 's/net.ipv6.conf.all.disable_ipv6.*/net.ipv6.conf.all.disable_ipv6 = 0/g' /etc/sysctl.conf
688 688
   #sed -i "s/net.ipv6.conf.all.accept_redirects.*/net.ipv6.conf.all.accept_redirects = 1/g" /etc/sysctl.conf
689 689
   #sed -i "s/net.ipv6.conf.all.accept_source_route.*/net.ipv6.conf.all.accept_source_route = 1/g" /etc/sysctl.conf
690
-  #sed -i "s/net.ipv6.conf.all.forwarding.*/net.ipv6.conf.all.forwarding=1/g" /etc/sysctl.conf
690
+  sed -i "s/net.ipv6.conf.all.forwarding.*/net.ipv6.conf.all.forwarding=1/g" /etc/sysctl.conf
691
+  echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
691 692
 
692 693
   echo '#!/bin/sh -e' > /etc/init.d/cjdns
693 694
   echo '### BEGIN INIT INFO' >> /etc/init.d/cjdns
@@ -3747,6 +3748,19 @@ function save_firewall_settings {
3747 3748
   chmod +x /etc/network/if-up.d/iptables
3748 3749
 }
3749 3750
 
3751
+function configure_firewall_for_cjdns {
3752
+  if grep -Fxq "configure_firewall_for_cjdns" $COMPLETION_FILE; then
3753
+      return
3754
+  fi
3755
+  if [[ $ENABLE_CJDNS != "yes" ]]; then
3756
+      return
3757
+  fi
3758
+  ip6tables -t nat -A POSTROUTING -o tun0 -j MASQUERADE
3759
+  ip6tables -A FORWARD -i tun0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
3760
+  save_firewall_settings
3761
+  echo 'configure_firewall_for_cjdns' >> $COMPLETION_FILE
3762
+}
3763
+
3750 3764
 function configure_firewall_for_dlna {
3751 3765
   if grep -Fxq "configure_firewall_for_dlna" $COMPLETION_FILE; then
3752 3766
       return
@@ -7459,6 +7473,7 @@ configure_firewall_for_ssh
7459 7473
 configure_firewall_for_dns
7460 7474
 configure_firewall_for_ftp
7461 7475
 configure_firewall_for_web_access
7476
+configure_firewall_for_cjdns
7462 7477
 remove_proprietary_repos
7463 7478
 change_debian_repos
7464 7479
 enable_backports