NEWRULE=$(ctlmgr_ctl r forwardrules settings/rule/count)
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/fwip 10.10.10.$(( 10 + ${NEWRULE} ))
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/description testeintrag_${NEWRULE}
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/fwport $(( 100 + ${NEWRULE} ))
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/endport $(( 100 + ${NEWRULE} ))
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/port $(( 100 + ${NEWRULE} ))
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/protocol TCP
[b]ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/activated 1[/b]
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/activated 0
#!/bin/sh
local FW_IP=${1}
local FW_PORT=${2}
local FW_PORT_ST=${3}
local FW_PORT_EN=${4}
local FW_PRT=${5}
local FW_DESCR=${6}
local FW_ACT=${7}
local NEWRULE=$(ctlmgr_ctl r forwardrules settings/rule/count)
if [ $# -eq 7 ] ; then
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/fwip ${FW_IP}
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/port ${FW_PORT}
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/fwport ${FW_PORT_ST}
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/endport ${FW_PORT_EN}
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/protocol ${FW_PRT}
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/description ${FW_DESCR}
ctlmgr_ctl w forwardrules settings/rule${NEWRULE}/activated ${FW_ACT}
else
echo -ne $(basename ${0})\
': Need 7 arguments!\n'\
'[fwip] [port] [fwport] [endport] [protocol] [description] [activated]\n'\
'Rules:\n'
fb_fw_stat.sh
fi
#EOF
#!/bin/sh
local maxcount=$(ctlmgr_ctl r forwardrules settings/rule/count)
if [ ${maxcount} -gt 0 ] ; then
local count=0
while [ ${count} -lt ${maxcount} ] ; do
local FW_IP=$(ctlmgr_ctl r forwardrules settings/rule${count}/fwip)
local FW_PORT=$(ctlmgr_ctl r forwardrules settings/rule${count}/port)
local FW_PORT_ST=$(ctlmgr_ctl r forwardrules settings/rule${count}/fwport)
local FW_PORT_EN=$(ctlmgr_ctl r forwardrules settings/rule${count}/endport)
local FW_PRT=$(ctlmgr_ctl r forwardrules settings/rule${count}/protocol)
local FW_DESCR=$(ctlmgr_ctl r forwardrules settings/rule${count}/description)
local FW_ACT=$(ctlmgr_ctl r forwardrules settings/rule${count}/activated)
echo -ne ${FW_IP}\
', '\
${FW_DESCR}\
', Port: '\
${FW_PORT}\
' an Port: '\
${FW_PORT_ST}\
' bis '\
${FW_PORT_EN}\
', Aktiviert: '\
${FW_ACT}'\n'
: $((count++))
done
else
echo -ne 'No rules present!\n'
fi
#EOF