update 2026-10-29 18:46:39

This commit is contained in:
action committed 2026-10-29 18:46:39 +08:00
1 parent e2f86e09f4
commit 95f76f26d3
5034 files changed
+2043234

No files matched your search

+112
View File
@@ -0,0 +1,112 @@
#!/bin/sh
if [ -e "/etc/config/ucitrack" ]; then
uci -q batch <<-EOF
delete ucitrack.@passwall[-1]
add ucitrack passwall
set ucitrack.@passwall[-1].init=passwall
commit ucitrack
EOF
fi
uci -q batch <<-EOF
delete firewall.passwall
set firewall.passwall=include
set firewall.passwall.type='script'
set firewall.passwall.path='/var/etc/passwall.include'
set dhcp.@dnsmasq[0].localuse=1
commit dhcp
set uhttpd.main.max_requests=50
commit uhttpd
EOF
if [ -x "/sbin/fw3" ]; then
uci -q set firewall.passwall.reload='1'
else
uci -q delete firewall.passwall.reload
uci -q delete firewall.passwall.fw4_compatible
fi
uci commit firewall
[ ! -s "/etc/config/passwall" ] && cp -f /usr/share/passwall/0_default_config /etc/config/passwall
mkdir -p /etc/passwall/rules
for file in \
direct_host \
direct_ip \
proxy_host \
proxy_ip \
block_host \
block_ip \
lanlist_ipv4 \
lanlist_ipv6 \
domains_excluded
do
[ -f "/etc/passwall/rules/$file" ] || cp "/usr/share/passwall/rules/$file" "/etc/passwall/rules/$file"
done
chmod +x /usr/share/passwall/*.sh
[ "$(uci -q get passwall.@global_xray[0].sniffing)" == "1" ] && [ "$(uci -q get passwall.@global_xray[0].route_only)" != "1" ] && uci -q set passwall.@global_xray[0].sniffing_override_dest=1
uci -q delete passwall.@global_xray[0].sniffing
uci -q delete passwall.@global_xray[0].route_only
[ "$(uci -q get passwall.@global_haproxy[0].health_check_type)" = "passwall_logic" ] && uci -q set passwall.@global_haproxy[0].health_check_type='script_logic'
for sid in $(uci show passwall | grep "=socks" | awk -F '.' '{print $2}' | awk -F '=' '{print $1}'); do
if [ -z "$(echo ${sid} | grep '^socks_')" ]; then
new_id="socks_$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5)"
old_ref="Socks_${sid}"
uci -q rename passwall.${sid}="${new_id}"
for item in $(uci show passwall | grep "='${old_ref}'\$" | cut -d '=' -sf 1); do
uci -q set ${item}="${new_id}"
done
unset sid new_id old_ref item
fi
done
for sid in $(uci show passwall | grep "@acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do
new_id="acl_$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5)"
uci -q rename passwall.${sid}="${new_id}"
unset sid new_id
done
for sid in $(uci show passwall | grep "@subscribe_list" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do
new_id="sub_$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 5)"
uci -q rename passwall.${sid}="${new_id}"
unset sid new_id
done
migrate_option() {
local section="$1"
local old="$2"
local new="$3"
local prefix="passwall.${section}"
if uci -q show "${prefix}.${new}" >/dev/null; then
uci -q delete "${prefix}.${old}"
elif uci -q show "${prefix}.${old}" >/dev/null; then
uci -q set "${prefix}.${new}=$(uci -q get "${prefix}.${old}")"
uci -q delete "${prefix}.${old}"
fi
}
migrate_option "@global[0]" tcp_node node
uci -q delete "passwall.@global[0].udp_node"
migrate_option "@global[0]" tcp_node_socks_port node_socks_port
migrate_option "@global[0]" tcp_node_socks_bind_local node_socks_bind_local
migrate_option "@global[0]" log_tcp log_node
uci -q delete "passwall.@global[0].log_udp"
for sid in $(uci show passwall | grep "=acl_rule" | cut -d '.' -sf 2 | cut -d '=' -sf 1); do
migrate_option "${sid}" tcp_node node
uci -q delete "passwall.${sid}.udp_node"
done
uci -q commit passwall
sed -i "s#add_from#group#g" /etc/config/passwall 2>/dev/null
rm -f /tmp/etc/passwall_tmp/binver_* /tmp/luci-indexcache /tmp/luci-indexcache.*
rm -rf /tmp/luci-modulecache/
killall -HUP rpcd 2>/dev/null
exit 0
@@ -0,0 +1,29 @@
#!/bin/sh
if [ -e "/etc/config/ucitrack" ]; then
uci -q batch <<-EOF
delete ucitrack.@passwall_server[-1]
add ucitrack passwall_server
set ucitrack.@passwall_server[-1].init=passwall_server
commit ucitrack
EOF
fi
# Migrate server sections from the old `user` section type. New user entries
# also use `user`, so only sections with a server `type` option are renamed.
for sid in $(uci -q show passwall_server | sed -n 's/^passwall_server\.\([^.=]*\)=user$/\1/p'); do
if [ -n "$(uci -q get "passwall_server.${sid}.type")" ]; then
uci -q set "passwall_server.${sid}=server"
fi
done
for sid in $(uci -q show passwall_server | sed -n 's/^passwall_server\.\([^.=]*\)\.protocol=dokodemo-door$/\1/p'); do
uci -q set "passwall_server.${sid}.protocol=tunnel"
done
uci -q commit passwall_server
rm -f /tmp/luci-indexcache /tmp/luci-indexcache.*
rm -rf /tmp/luci-modulecache/
killall -HUP rpcd 2>/dev/null
exit 0