mirror of
https://github.com/monlor/MIXBOX-ARCHIVE.git
synced 2026-03-14 09:21:27 +00:00
2018-12-31
This commit is contained in:
8
apps/firewall/config/firewall.uci
Normal file
8
apps/firewall/config/firewall.uci
Normal file
@@ -0,0 +1,8 @@
|
||||
service="FireWall"
|
||||
appname="firewall"
|
||||
needver="0.0.1"
|
||||
supports="linux_arm,linux_mips,linux_x86_64"
|
||||
openport=1
|
||||
appinfo="防火墙端口开放插件"
|
||||
newinfo="支持添加多种端口号类型"
|
||||
version="0.0.2"
|
||||
52
apps/firewall/config/mixbox.conf
Normal file
52
apps/firewall/config/mixbox.conf
Normal file
@@ -0,0 +1,52 @@
|
||||
#------------------【FireWall】--------------------
|
||||
firewall() {
|
||||
|
||||
eval `mbdb export firewall`
|
||||
source /etc/mixbox/bin/base
|
||||
echo "********* $service ***********"
|
||||
echo "[${appinfo}]"
|
||||
readsh "启动${appname}服务[1/0] " "enable" "1"
|
||||
|
||||
if [ "$enable" == '1' ]; then
|
||||
echo "已开放端口(工具箱插件默认已开通端口): "
|
||||
allport=$(mbdb show $appname.openport)
|
||||
[ -z "$allport" ] && echo "没有开通端口!" || echo "$allport"
|
||||
read -p "是否要更改${appname}配置?[1/0] " res
|
||||
if [ "$res" == '1' ]; then
|
||||
read -p "添加${appname}配置?[1/0] " res
|
||||
if [ "$res" == '1' ]; then
|
||||
while(true)
|
||||
do
|
||||
read -p "请输入配置名称: " name
|
||||
read -p "请输入开通端口(列入70或70,80,10或100:110): " port
|
||||
if [ ! -z "$name" -a ! -z "${port}" ]; then
|
||||
mbdb set $appname.openport.$name="${port}"
|
||||
else
|
||||
echo "配置为空,未添加!"
|
||||
fi
|
||||
read -p "继续添加配置?[1/0] " res
|
||||
[ "$res" == '0' -o -z "$res" ] && break
|
||||
done
|
||||
fi
|
||||
read -p "删除${appname}配置?[1/0] " res
|
||||
if [ "$res" == '1' ]; then
|
||||
read -p "清空配置再添加?[1/0] " res
|
||||
[ "$res" == '1' ] && mbdb clear $appname.openport
|
||||
echo "`mbdb keys $appname.openport`"
|
||||
while(true)
|
||||
do
|
||||
read -p "请输入要删除的配置名: " res
|
||||
[ ! -z "$res" ] && mbdb del $appname.openport.$res
|
||||
read -p "继续删除配置?[1/0] " res
|
||||
[ "$res" == '0' -o -z "$res" ] && break
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
${mbroot}/apps/${appname}/scripts/${appname}.sh restart
|
||||
else
|
||||
${mbroot}/apps/${appname}/scripts/${appname}.sh stop
|
||||
fi
|
||||
|
||||
}
|
||||
#------------------【FireWall】--------------------
|
||||
1
apps/firewall/config/version.txt
Normal file
1
apps/firewall/config/version.txt
Normal file
@@ -0,0 +1 @@
|
||||
1.1.0
|
||||
Reference in New Issue
Block a user