Portál AbcLinuxu, 5. května 2025 05:03
kex_exchange_identification: read: Connection reset by peer Connection reset by 195.47.xxx.yyy port 22Měl by někdo nápad, co s tím a jak případně a lépe bojovat ?
Najjednoduchšie riešenie je zablokovať ip rozsah z ktorého ide útok. Týmto zamedzíš aplikácii limitu na neoverené súčasne pripojenia MaxStartups
. Môžeš tiež znížiť čas po ktorý ssh čaká na úspešne pripojenie LoginGraceTime
Ďalej je možnosť nahlásiť dané ip hostingu alebo IPS cez ktorého je server pripojený.
Nenapísal si akou metódou sa prihlasuješ. Heslo, kľúč alebo certifikát ?
cat /etc/ssh/sshd_config Port 22 AddressFamily inet SyslogFacility AUTH LogLevel INFO MaxAuthTries 3 MaxSessions 20 ChallengeResponseAuthentication no UsePAM yes X11Forwarding yes PrintMotd no MaxStartups 1:30:100 AcceptEnv LANG LC_* Subsystem sftp internal-sftp AllowGroups group1 group2 group3 Match group group1 ChrootDirectory /var/www/%u X11Forwarding no AllowTcpForwarding no ForceCommand internal-sftp Match group group2 ChrootDirectory /var/www2/%u X11Forwarding no AllowTcpForwarding no ForceCommand internal-sftp ...A tady konfig Fail2Ban
cat /etc/fail2ban/jail.local # # JAILS # # # SSH servers # [sshd] # To use more aggressive sshd modes set filter parameter "mode" in jail.local: # normal (default), ddos, extra or aggressive (combines all). # See "tests/files/logs/sshd" or "filter.d/sshd.conf" for usage example and details. mode = ddos port = ssh logpath = %(sshd_log)s backend = %(sshd_backend)s enabled = true [dropbear] port = ssh logpath = %(dropbear_log)s backend = %(dropbear_backend)s [selinux-ssh] port = ssh logpath = %(auditd_log)sFail2Ban jako takový funguje, viz...
iptables -L -v -n ... Chain f2b-sshd (1 references) pkts bytes target prot opt in out source destination 0 0 REJECT all -- * * 106.52.183.129 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.52.181.142 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.52.145.100 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.52.125.223 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.52.107.254 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.52.107.123 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.51.3.214 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.51.168.98 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.37.72.112 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.252.20.88 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.251.237.171 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.248.231.66 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.246.224.154 0.0.0.0/0 reject-with icmp-port-unreachable 0 0 REJECT all -- * * 106.241.54.211 0.0.0.0/0 reject-with icmp-port-unreachable ...Nějaký nápad ?
no matching key exchange method found. Their offer: (prastaré blbiny)Je to kvôli používaniu starých sftp klientov.
kex_exchange_identification
sshd_config ... MaxSessions 50 MaxStartups 100 Match Address ************** ...
jail.local ... bantime = 1440m findtime = 30m maxretry = 3 ...
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.