SSH bağlantıları - IP adreslerine izin verme veya Engelleme
nano /etc/hosts.allow
#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
sshd sshd1 sshd2 : 127.0.0.1 : ALLOW
sshd sshd1 sshd2 : 10.1.1. : ALLOW
sshd sshd1 sshd2 : ALL : DENY
burada dikkat etmemiz gereken nokta en son satırdaki Deny bölümü kurallar yukarıda aşağıya göre eklendiği için DENY satırını en sona koymazsanız onun altındaki ipler engelli olacaktır.
İşlemleri tamamlandıktan sonra kuralın aktif olması için
service sshd restart
yazarak SSH servisini resetlememiz gerekmektedir.işlem öncesi:
Mar 28 23:16:15 raspberrypi sshd[3477]: Failed password for root from 115.230.126.148 port 58939 ssh2
Mar 28 23:16:17 raspberrypi sshd[3477]: Failed password for root from 115.230.126.148 port 58939 ssh2
Mar 28 23:16:20 raspberrypi sshd[3477]: Failed password for root from 115.230.126.148 port 58939 ssh2
Mar 28 23:16:21 raspberrypi sshd[3477]: Received disconnect from 115.230.126.148: 11: [preauth]
Mar 28 23:16:21 raspberrypi sshd[3477]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=115.230.126.148 user=root
Mar 28 23:16:25 raspberrypi sshd[3486]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=115.230.126.148 user=root
Mar 28 23:16:27 raspberrypi sshd[3486]: Failed password for root from 115.230.126.148 port 48758 ssh2
Mar 28 23:16:30 raspberrypi sshd[3486]: Failed password for root from 115.230.126.148 port 48758 ssh2
Mar 28 23:16:33 raspberrypi sshd[3486]: Failed password for root from 115.230.126.148 port 48758 ssh2
Mar 28 23:16:33 raspberrypi sshd[3486]: Received disconnect from 115.230.126.148: 11: [preauth]
Mar 28 23:16:33 raspberrypi sshd[3486]: PAM 2 more authentication failures; logname= uid=0 euid=0 tty=ssh ruser= rhost=115.230.126.148 user=root
Mar 28 23:16:37 raspberrypi sshd[3488]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=115.230.126.148 user=root
Mar 28 23:16:39 raspberrypi sshd[3488]: Failed password for root from 115.230.126.148 port 40391 ssh2
Mar 28 23:16:42 raspberrypi sshd[3488]: Failed password for root from 115.230.126.148 port 40391 ssh2
işlemden sonra :
Mar 28 23:16:39 raspberrypi sshd[3488]: Failed password for root from 115.230.126.148 port 40391 ssh2
Mar 28 23:16:42 raspberrypi sshd[3488]: Failed password for root from 115.230.126.148 port 40391 ssh2
Mar 28 23:37:36 raspberrypi sshd[4431]: refused connect from 115.230.124.229 (115.230.124.229)
Mar 28 23:38:22 raspberrypi sshd[4432]: refused connect from 182.100.67.113 (182.100.67.113)
Mar 28 23:39:01 raspberrypi sshd[4433]: refused connect from 115.230.124.229 (115.230.124.229)
KAYNAK ADRES: http://www.ozgurmazlum.com/ssh-baglantisi-icin-ip-adreslerine-izin-verme-engelleme.html