sudo apt update
sudo apt install -y fail2ban
sudo tee /etc/fail2ban/jail.d/sshd.local >/dev/null <<'EOF'
[sshd]
enabled = true
maxretry = 3
findtime = 10m
bantime = 24h
EOF

sudo fail2ban-client -t
sudo systemctl enable --now fail2ban
sudo systemctl restart fail2ban
sudo fail2ban-client status sshd
sleep 3
systemctl is-active fail2ban
fail2ban-client ping
fail2ban-client status sshd
echo "$SSH_CONNECTION" | awk '{print "当前SSH服务端口:", $4}'
sshd -T | awk '$1=="port"{print "SSH配置端口:", $2}'
tee /etc/fail2ban/jail.d/sshd.local >/dev/null <<'EOF'
[sshd]
enabled = true
port = 61902
backend = systemd
maxretry = 3
findtime = 10m
bantime = 24h
EOF

fail2ban-client -t
systemctl reset-failed fail2ban
systemctl enable fail2ban
systemctl restart fail2ban
sleep 3
systemctl is-active fail2ban
fail2ban-client ping
fail2ban-client status sshd
ls
clear
apt install iperf3
iperf3 -s -p 53891
wget -qO- https://raw.githubusercontent.com/zywe03/realm-xwPF/main/xwPF.sh | bash -s install
pf
fail2ban-client status sshd
clear
wget -qO- https://raw.githubusercontent.com/komari-monitor/komari-agent/refs/heads/main/install.sh | sudo bash -s -- -e https://stats.shuuqin.com -t Dl7aQ6PR5leJpqfChqyzkK --disable-web-ssh
pkill iperf3
exit
