From 47d0a0fd229f971717a0c6a2a05765e479f0f19d Mon Sep 17 00:00:00 2001 From: Konano Date: Sun, 26 Apr 2026 17:56:36 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4=20iptables=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=84=9A=E6=9C=AC=E5=8F=8A=E5=85=B6=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- configure_priv.sh | 80 ++++++++++----------- files/{ => .archived}/iptables-load | 0 files/{ => .archived}/iptables-load.service | 0 3 files changed, 40 insertions(+), 40 deletions(-) rename files/{ => .archived}/iptables-load (100%) rename files/{ => .archived}/iptables-load.service (100%) diff --git a/configure_priv.sh b/configure_priv.sh index 7f68efd..1115f0b 100755 --- a/configure_priv.sh +++ b/configure_priv.sh @@ -353,49 +353,49 @@ configure_fail2ban() { fi } -configure_iptables() { - [ $offline -eq 1 ] && return - [ "$(uname)" = "Darwin" ] && return +# configure_iptables() { +# [ $offline -eq 1 ] && return +# [ "$(uname)" = "Darwin" ] && return - # 如果 ufw 是 active,就直接返回 - if command_exists ufw; then - if sudo ufw status | grep -q "Status: active"; then - echo "检测到 ufw 已启用,跳过 iptables 配置。" - return - fi - if confirm_action "检测到 ufw 已存在,是否直接使用 ufw 进行管理,跳过 iptables" "Y"; then - return - fi - fi +# # 如果 ufw 是 active,就直接返回 +# if command_exists ufw; then +# if sudo ufw status | grep -q "Status: active"; then +# echo "检测到 ufw 已启用,跳过 iptables 配置。" +# return +# fi +# if confirm_action "检测到 ufw 已存在,是否直接使用 ufw 进行管理,跳过 iptables" "Y"; then +# return +# fi +# fi - if command_exists ifquery && systemctl is-active --quiet networking; then - # ifupdown: /etc/network/if-pre-up.d/iptables-load - [ -f /etc/network/if-pre-up.d/iptables-load ] && return - if confirm_action "要配置 iptables 吗?" "N"; then - sudo cp $scriptdir/files/iptables-load /etc/network/if-pre-up.d/iptables-load - sudo chmod +x /etc/network/if-pre-up.d/iptables-load - sudo sh /etc/network/if-pre-up.d/iptables-load - fi - else - # systemd: /etc/network/iptables-load - [ -f /etc/network/iptables-load ] && return - if confirm_action "要配置 iptables 吗?" "N"; then - if [ -f /etc/network/if-pre-up.d/iptables-load ]; then - sudo mv /etc/network/if-pre-up.d/iptables-load /etc/network/iptables-load - else - sudo cp $scriptdir/files/iptables-load /etc/network/iptables-load - sudo chmod +x /etc/network/iptables-load - sudo sh /etc/network/iptables-load - fi +# if command_exists ifquery && systemctl is-active --quiet networking; then +# # ifupdown: /etc/network/if-pre-up.d/iptables-load +# [ -f /etc/network/if-pre-up.d/iptables-load ] && return +# if confirm_action "要配置 iptables 吗?" "N"; then +# sudo cp $scriptdir/files/iptables-load /etc/network/if-pre-up.d/iptables-load +# sudo chmod +x /etc/network/if-pre-up.d/iptables-load +# sudo sh /etc/network/if-pre-up.d/iptables-load +# fi +# else +# # systemd: /etc/network/iptables-load +# [ -f /etc/network/iptables-load ] && return +# if confirm_action "要配置 iptables 吗?" "N"; then +# if [ -f /etc/network/if-pre-up.d/iptables-load ]; then +# sudo mv /etc/network/if-pre-up.d/iptables-load /etc/network/iptables-load +# else +# sudo cp $scriptdir/files/iptables-load /etc/network/iptables-load +# sudo chmod +x /etc/network/iptables-load +# sudo sh /etc/network/iptables-load +# fi - sudo cp $scriptdir/files/iptables-load.service /etc/systemd/system/iptables-load.service - sudo chmod +x /etc/systemd/system/iptables-load.service - sudo systemctl daemon-reload - sudo systemctl start iptables-load.service - sudo systemctl enable iptables-load.service - fi - fi -} +# sudo cp $scriptdir/files/iptables-load.service /etc/systemd/system/iptables-load.service +# sudo chmod +x /etc/systemd/system/iptables-load.service +# sudo systemctl daemon-reload +# sudo systemctl start iptables-load.service +# sudo systemctl enable iptables-load.service +# fi +# fi +# } configure_ufw() { [ $offline -eq 1 ] && return diff --git a/files/iptables-load b/files/.archived/iptables-load similarity index 100% rename from files/iptables-load rename to files/.archived/iptables-load diff --git a/files/iptables-load.service b/files/.archived/iptables-load.service similarity index 100% rename from files/iptables-load.service rename to files/.archived/iptables-load.service