summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorManuel Munz <freifunk@somakoma.de>2012-07-09 17:57:24 +0000
committerManuel Munz <freifunk@somakoma.de>2012-07-09 17:57:24 +0000
commitdc7cf4417d7bdaa95227de2e476b8c82ae11be6a (patch)
treec13d40d9b86e959131225c5d9bc270e2d1b6961d
parent1e7a41732fa299d5dc56d573a97c4ce97491b35c (diff)
contrib/meshwizard: allowssh and allowweb can be set for wan dhcp proto too now
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh27
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh11
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_static.sh28
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh4
4 files changed, 42 insertions, 28 deletions
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh
index 33ff9a2bd..7eceb5088 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_firewall.sh
@@ -109,4 +109,31 @@ if [ "$profile_ipv6_config" = "auto-ipv6-dhcpv6" ]; then
EOF
fi
+# Firewall rules to allow incoming ssh and web if enabled
+
+if [ "$wan_allowssh" == 1 ]; then
+ uci batch <<- EOF
+ set firewall.wanssh=rule
+ set firewall.wanssh.src=wan
+ set firewall.wanssh.target=ACCEPT
+ set firewall.wanssh.proto=tcp
+ set firewall.wanssh.dest_port=22
+ EOF
+fi
+
+if [ "$wan_allowweb" == 1 ]; then
+ uci batch <<- EOF
+ set firewall.wanweb=rule
+ set firewall.wanweb.src=wan
+ set firewall.wanweb.target=ACCEPT
+ set firewall.wanweb.proto=tcp
+ set firewall.wanweb.dest_port=80
+ set firewall.wanwebhttps=rule
+ set firewall.wanwebhttps.src=wan
+ set firewall.wanwebhttps.target=ACCEPT
+ set firewall.wanwebhttps.proto=tcp
+ set firewall.wanwebhttps.dest_port=443
+ EOF
+fi
+
uci_commitverbose "Setup rules, forwardings, advanced config and includes." firewall
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh
new file mode 100755
index 000000000..98b941b84
--- /dev/null
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_dhcp.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Setup dhcp interface settings for wan. This is the OpenWrt default,
+# so all we need to do here is to delete wan from meshwizard after setup.
+
+[ ! "$(uci -q get network.wan)" == "interface" ] && exit
+
+. /lib/functions.sh
+. $dir/functions.sh
+
+uci delete meshwizard.wan && uci commit meshwizard
+
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_static.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_static.sh
index 01352d2c1..570470aa7 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_static.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wan_static.sh
@@ -18,31 +18,3 @@ uci_commitverbose "Setup static ip settings for wan" network
uci delete meshwizard.wan && uci commit meshwizard
-# Firewall rules to allow incoming ssh and web
-
-if [ "$wan_allowssh" == 1 ]; then
- uci batch <<- EOF
- set firewall.wanssh=rule
- set firewall.wanssh.src=wan
- set firewall.wanssh.target=ACCEPT
- set firewall.wanssh.proto=tcp
- set firewall.wanssh.dest_port=22
- EOF
- uci_commitverbose "Allow incoming connections to port 22 (ssh) on wan" firewall
-fi
-
-if [ "$wan_allowweb" == 1 ]; then
- uci batch <<- EOF
- set firewall.wanweb=rule
- set firewall.wanweb.src=wan
- set firewall.wanweb.target=ACCEPT
- set firewall.wanweb.proto=tcp
- set firewall.wanweb.dest_port=80
- set firewall.wanwebhttps=rule
- set firewall.wanwebhttps.src=wan
- set firewall.wanwebhttps.target=ACCEPT
- set firewall.wanwebhttps.proto=tcp
- set firewall.wanwebhttps.dest_port=443
- EOF
- uci_commitverbose "Allow incoming connections to port 80 and 443 (http and https) on wan" firewall
-fi
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
index f159268d3..eae4de87e 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/wizard.sh
@@ -64,6 +64,10 @@ if [ "$wan_proto" == "static" ] && [ -n "$wan_ip4addr" ] && [ -n "$wan_netmask"
$dir/helpers/setup_wan_static.sh
fi
+if [ "$wan_proto" == "dhcp" ]; then
+ $dir/helpers/setup_wan_dhcp.sh
+fi
+
if [ "$lan_proto" == "static" ] && [ -n "$lan_ip4addr" ] && [ -n "$lan_netmask" ]; then
$dir/helpers/setup_lan_static.sh
fi