From: Dengfeng Liu Date: Wed, 10 Jul 2024 09:02:46 +0000 (+0800) Subject: apfree-wifidog: support wildcard domain X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=ca8fe51fd8b6067bf671d627c57911d299ab940c;p=feed%2Fpackages.git apfree-wifidog: support wildcard domain Signed-off-by: Dengfeng Liu --- diff --git a/net/apfree-wifidog/files/wifidogx.conf b/net/apfree-wifidog/files/wifidogx.conf index 0733853219..7026418648 100644 --- a/net/apfree-wifidog/files/wifidogx.conf +++ b/net/apfree-wifidog/files/wifidogx.conf @@ -14,25 +14,38 @@ config wifidogx 'common' option enable_dns_forward 1 config group 'wechat' - option g_type '1' - list domain_name 'open.weixin.qq.com' - list domain_name 'api.weixin.qq.com' + option g_type '3' + list wildcard_domain '.weixin.qq.com' + option g_desc '微信泛域名' + +config group 'wechat2' + option g_type '1' list domain_name 'weixin.qq.com' - option g_desc '微信' + option g_desc '微信域名' config group 'dingtalk' - option g_type '1' - list domain_name 'oapi.dingtalk.com' - list domain_name 'open-dev.dingtalk.com' - list domain_name 'dingtalk.com' + option g_type '3' + list wildcard_domain '.dingtalk.com' option g_desc '钉钉' +config group 'dingtalk2' + option g_type '1' + list domain_name 'dingtalk.com' + option g_desc '钉钉域名' + config group 'alipay' + option g_type '3' + list wildcard_domain '.alipay.com' + list wildcard_domain '.alipayobjects.com' + list wildcard_domain '.alipaydev.com' + option g_desc '支付宝' + +config group 'alipay2' option g_type '1' list domain_name 'alipay.com' list domain_name 'alipayobjects.com' list domain_name 'alipaydev.com' - option g_desc '支付宝' + option g_desc '支付宝域名' config group 'macdemo' option g_type '2' diff --git a/net/apfree-wifidog/files/wifidogx.init b/net/apfree-wifidog/files/wifidogx.init index 31795e5125..db2e7a74cb 100644 --- a/net/apfree-wifidog/files/wifidogx.init +++ b/net/apfree-wifidog/files/wifidogx.init @@ -26,9 +26,11 @@ prepare_wifidog_conf() { 'apple_cna:bool:0' \ 'channel_path:string' \ 'trusted_domains:list(host)' \ + 'trusted_wildcard_domains:list(string)' \ 'trusted_macs:list(string)' \ 'app_white_list:list(string)' \ 'mac_white_list:list(string)' \ + 'wildcard_white_list:list(string)' \ 'enable_dns_forward:bool:1' \ 'enable_websocket:bool:1' \ 'js_filter:bool:1' @@ -72,6 +74,16 @@ prepare_wifidog_conf() { done fi + if [ ! -z "$wildcard_white_list" ]; then + # iterate wildcard_white_list and find the corresponding domain according to the item + for group in $wildcard_white_list; do + group_wildcard_list=$(uci get wifidogx.$group.wildcard_domain) + if [ ! -z "$group_wildcard_list" ]; then + trusted_wildcard_domains="$trusted_wildcard_domains $group_wildcard_list" + fi + done + fi + # set above variables to config file echo "GatewayID $gateway_id" > ${CONFIGFILE} echo "GatewayInterface $gateway_interface" >> ${CONFIGFILE} @@ -97,6 +109,11 @@ prepare_wifidog_conf() { trusted_macs=$(echo $trusted_macs | tr ' ' ',') echo "TrustedMACList $trusted_macs" >> ${CONFIGFILE} fi + # if has trusted_wildcard_domains, add it to config file + if [ ! -z "$trusted_wildcard_domains" ]; then + trusted_wildcard_domains=$(echo $trusted_wildcard_domains | tr ' ' ',') + echo "TrustedPanDomains $trusted_wildcard_domains" >> ${CONFIGFILE} + fi } start_service() {