第一次提交

This commit is contained in:
rjb
2026-01-19 00:09:36 +08:00
parent de4b5059e9
commit 6674060f2f
191 changed files with 40940 additions and 0 deletions

43
开放端口脚本.sh Executable file
View File

@@ -0,0 +1,43 @@
#!/bin/bash
# 开放8037和8038端口的脚本
echo "正在检查并开放端口 8037 和 8038..."
# 方法1: 使用firewalld (CentOS/RHEL 7+)
if command -v firewall-cmd &> /dev/null; then
echo "检测到 firewalld使用 firewalld 开放端口..."
sudo firewall-cmd --permanent --add-port=8037/tcp
sudo firewall-cmd --permanent --add-port=8038/tcp
sudo firewall-cmd --reload
echo "✅ firewalld 端口已开放"
exit 0
fi
# 方法2: 使用ufw (Ubuntu/Debian)
if command -v ufw &> /dev/null; then
echo "检测到 ufw使用 ufw 开放端口..."
sudo ufw allow 8037/tcp
sudo ufw allow 8038/tcp
echo "✅ ufw 端口已开放"
exit 0
fi
# 方法3: 使用iptables
echo "使用 iptables 开放端口..."
sudo iptables -I INPUT -p tcp --dport 8037 -j ACCEPT
sudo iptables -I INPUT -p tcp --dport 8038 -j ACCEPT
# 保存iptables规则根据系统不同
if [ -f /etc/redhat-release ]; then
# CentOS/RHEL
sudo service iptables save 2>/dev/null || sudo iptables-save > /etc/sysconfig/iptables
elif [ -f /etc/debian_version ]; then
# Debian/Ubuntu
sudo iptables-save > /etc/iptables/rules.v4 2>/dev/null || echo "请手动保存iptables规则"
fi
echo "✅ iptables 端口已开放"
echo ""
echo "⚠️ 注意:如果使用云服务器(如腾讯云、阿里云等),还需要在云控制台配置安全组规则:"
echo " - 开放入站规则TCP 8037"
echo " - 开放入站规则TCP 8038"