|
@ -12,7 +12,12 @@ FWKNOPD_BIN=/usr/sbin/fwknopd |
|
|
start() |
|
|
start() |
|
|
{ |
|
|
{ |
|
|
gen_confs |
|
|
gen_confs |
|
|
$FWKNOPD_BIN |
|
|
|
|
|
|
|
|
if [ $UCI_ENABLED ]; then |
|
|
|
|
|
$FWKNOPD_BIN -c /var/etc/fwknopd.conf -a /var/etc/access.conf |
|
|
|
|
|
else |
|
|
|
|
|
$FWKNOPD_BIN |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
stop() |
|
|
stop() |
|
@ -51,10 +56,10 @@ gen_confs() |
|
|
local option="$1" |
|
|
local option="$1" |
|
|
local value="$2" |
|
|
local value="$2" |
|
|
if [ "$option" = "uci_enabled" ] && [ "$value" -eq 1 ] ; then |
|
|
if [ "$option" = "uci_enabled" ] && [ "$value" -eq 1 ] ; then |
|
|
> /etc/fwknop/fwknopd.conf |
|
|
|
|
|
> /etc/fwknop/access.conf |
|
|
|
|
|
chmod 600 /etc/fwknop/fwknopd.conf |
|
|
|
|
|
chmod 600 /etc/fwknop/access.conf |
|
|
|
|
|
|
|
|
> /var/etc/fwknopd.conf |
|
|
|
|
|
> /var/etc/access.conf |
|
|
|
|
|
chmod 600 /var/etc/fwknopd.conf |
|
|
|
|
|
chmod 600 /var/etc/access.conf |
|
|
UCI_ENABLED=1 |
|
|
UCI_ENABLED=1 |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
@ -63,20 +68,20 @@ gen_confs() |
|
|
local option="$1" |
|
|
local option="$1" |
|
|
local value="$2" |
|
|
local value="$2" |
|
|
if [ $UCI_ENABLED ]; then |
|
|
if [ $UCI_ENABLED ]; then |
|
|
echo "$option $value" >> /etc/fwknop/fwknopd.conf #writing each option to fwknopd.conf |
|
|
|
|
|
|
|
|
echo "$option $value" >> /var/etc/fwknopd.conf #writing each option to fwknopd.conf |
|
|
fi |
|
|
fi |
|
|
} |
|
|
} |
|
|
elif [ "$type" = "access" ] |
|
|
elif [ "$type" = "access" ] |
|
|
then |
|
|
then |
|
|
if [ -f /tmp/access.conf.tmp ] ; then |
|
|
if [ -f /tmp/access.conf.tmp ] ; then |
|
|
cat /tmp/access.conf.tmp >> /etc/fwknop/access.conf |
|
|
|
|
|
|
|
|
cat /tmp/access.conf.tmp >> /var/etc/access.conf |
|
|
rm /tmp/access.conf.tmp |
|
|
rm /tmp/access.conf.tmp |
|
|
fi |
|
|
fi |
|
|
option_cb() { |
|
|
option_cb() { |
|
|
local option="$1" |
|
|
local option="$1" |
|
|
local value="$2" |
|
|
local value="$2" |
|
|
if [ $UCI_ENABLED ] && [ $option = "SOURCE" ]; then |
|
|
if [ $UCI_ENABLED ] && [ $option = "SOURCE" ]; then |
|
|
echo "$option $value" >> /etc/fwknop/access.conf #writing each option to access.conf |
|
|
|
|
|
|
|
|
echo "$option $value" >> /var/etc/access.conf #writing each option to access.conf |
|
|
fi |
|
|
fi |
|
|
if [ $UCI_ENABLED ] && [ $option != "SOURCE" ]; then |
|
|
if [ $UCI_ENABLED ] && [ $option != "SOURCE" ]; then |
|
|
echo "$option $value" >> /tmp/access.conf.tmp #writing each option to access.conf |
|
|
echo "$option $value" >> /tmp/access.conf.tmp #writing each option to access.conf |
|
@ -88,7 +93,7 @@ gen_confs() |
|
|
if [ -f /etc/config/fwknopd ]; then |
|
|
if [ -f /etc/config/fwknopd ]; then |
|
|
config_load fwknopd |
|
|
config_load fwknopd |
|
|
if [ -f /tmp/access.conf.tmp ] ; then |
|
|
if [ -f /tmp/access.conf.tmp ] ; then |
|
|
cat /tmp/access.conf.tmp >> /etc/fwknop/access.conf |
|
|
|
|
|
|
|
|
cat /tmp/access.conf.tmp >> /var/etc/access.conf |
|
|
rm /tmp/access.conf.tmp |
|
|
rm /tmp/access.conf.tmp |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|