Luci-app-fwknopd:add a couple config options to the interface
[project/luci.git] / applications / luci-app-fwknopd / root / etc / uci-defaults / luci-fwknopd
index a7c433f..01b85de 100644 (file)
@@ -1,6 +1,7 @@
 #!/bin/sh
 #-- Copyright 2015 Jonathan Bennett <jbennett@incomsystems.biz>
 #-- Licensed to the public under the GNU General Public License v2.
+. /lib/functions/network.sh
 
 uci batch <<EOF
        add ucitrack fwknopd
@@ -8,12 +9,14 @@ uci batch <<EOF
        commit ucitrack
 EOF
 
-if [ -f /usr/bin/fwknop ]; then
-       uci set fwknopd.@access[0].keytype='Base 64 key'
-       uci set fwknopd.@access[0].hkeytype='Base 64 key'
-       uci set fwknopd.@access[0].KEY_BASE64=`fwknop --key-gen | awk '/^KEY/ {print $2;}'`
-       uci set fwknopd.@access[0].HMAC_KEY_BASE64=`fwknop --key-gen | awk '/^HMAC/ {print $2;}'`
-       uci commit fwknopd
-fi
+uci delete fwknopd.@access[0].KEY
+uci delete fwknopd.@access[0].HMAC_KEY
+uci set fwknopd.@access[0].keytype='Base 64 key'
+uci set fwknopd.@access[0].hkeytype='Base 64 key'
+uci set fwknopd.@access[0].KEY_BASE64=`fwknopd --key-gen | awk '/^KEY/ {print $2;}'`
+uci set fwknopd.@access[0].HMAC_KEY_BASE64=`fwknopd --key-gen | awk '/^HMAC/ {print $2;}'`
+uci set fwknopd.@config[0].ENABLE_IPT_FORWARDING='y'
+
+uci commit fwknopd
 rm -f /tmp/luci-indexcache
 exit 0