×ðÁú¿­Ê±¹ÙÍøµÇ¼

ÔõÑùͨ¹ýÏÂÁîÐй¤¾ß±  £»¤ÄãµÄLinuxЧÀÍÆ÷

ÔõÑùͨ¹ýÏÂÁîÐй¤¾ß±  £»¤ÄãµÄLinuxЧÀÍÆ÷

LinuxЧÀÍÆ÷µÄÇå¾²ÐÔÖÁ¹ØÖ÷Òª£¬ËüÃÇͨ³£³ÐÔØ×ÅÖ÷ÒªµÄÓ¦ÓóÌÐòºÍÊý¾Ý¡£ÔÚÐí¶àÇéÐÎÏ£¬Í¨¹ýÏÂÁîÐй¤¾ßÀ´±  £»¤ÄãµÄLinuxЧÀÍÆ÷ÊÇÒ»ÖÖ¼òÆÓ²¢ÇÒ¸ßЧµÄ·½·¨¡£±¾ÎĽ«ÏÈÈÝһЩ³£ÓõÄÏÂÁîÐй¤¾ß£¬²¢Ìṩ´úÂëʾÀý£¬ÒÔ×ÊÖúÄã±  £»¤ÄãµÄLinuxЧÀÍÆ÷¡£

ʹÓÃiptables¾ÙÐзÀ»ðǽÉèÖÃ

iptablesÊÇLinuxЧÀÍÆ÷ÉÏÓÃÓÚÉèÖ÷À»ðǽµÄÏÂÁîÐй¤¾ß¡£Í¨¹ýÔÊÐí»ò¾Ü¾øÌض¨µÄÍøÂçÅþÁ¬£¬Äã¿ÉÒÔ±  £»¤ÄãµÄЧÀÍÆ÷ÃâÊܶñÒâÁ÷Á¿µÄ¹¥»÷¡£

ÒÔÏÂÊÇһЩ³£ÓõÄiptablesÏÂÁîʾÀý£º

ÔÊÐíÌض¨IPµØµãµÄ»á¼û

iptables -A INPUT -s 192.168.0.1 -j ACCEPT

µÇ¼ºó¸´ÖÆ

¾Ü¾øÌض¨µÄIPµØµã»á¼û

iptables -A INPUT -s 192.168.0.2 -j DROP

µÇ¼ºó¸´ÖÆ

ÔÊÐíÌض¨¶Ë¿ÚµÄ»á¼û

iptables -A INPUT -p tcp --dport 22 -j ACCEPT

µÇ¼ºó¸´ÖÆ

¾Ü¾øÌض¨¶Ë¿ÚµÄ»á¼û

iptables -A INPUT -p tcp --dport 23 -j DROP

µÇ¼ºó¸´ÖÆ

ʹÓÃfail2ban¾ÙÐÐÈëÇÖ¼ì²âºÍÔ¤·À

fail2banÊÇÒ»¸öÓÃÓÚ¼ì²â²¢×èÖ¹¶ñÒâIPµØµãµÄ¹¤¾ß¡£Ëü¿ÉÒÔ¼à¿ØµÇ¼ʵÑ鲢ͨ¹ýiptables×èÖ¹¶ñÒâIPµÄµÇ¼¡£

ÒÔÏÂÊÇÔõÑùʹÓÃfail2banÉèÖ÷À»¤SSHµÄʾÀý£º

×°ÖÃfail2ban

sudo apt-get install fail2ban

µÇ¼ºó¸´ÖÆ

±à¼­fail2banµÄÉèÖÃÎļþ

sudo vi /etc/fail2ban/jail.conf

µÇ¼ºó¸´ÖÆ

·­¿ªSSH±  £»¤µÄÉèÖÃ

[sshd]
enabled = true
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 3

µÇ¼ºó¸´ÖÆ

Æô¶¯fail2banЧÀÍ

sudo systemctl start fail2ban

µÇ¼ºó¸´ÖÆ

ʹÓÃssh-keygenÌìÉúSSHÃÜÔ¿

ʹÓÃSSHÃÜÔ¿×÷ΪÉí·ÝÑéÖ¤·½·¨±ÈʹÓÃÃÜÂëÔ½·¢Çå¾²¡£Äã¿ÉÒÔʹÓÃssh-keygenÏÂÁîÌìÉúÒ»¶ÔÃÜÔ¿£ºË½Ô¿ºÍ¹«Ô¿¡£½«¹«Ô¿°²Åŵ½Ð§ÀÍÆ÷ÉÏ£¬²¢½«Ë½Ô¿ÉúÑÄÔÚÍâµØ¡£

ÌìÉúSSHÃÜÔ¿¶Ô

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

µÇ¼ºó¸´ÖÆ

½«¹«Ô¿¸´ÖƵ½Ð§ÀÍÆ÷ÉÏ

ssh-copy-id -i ~/.ssh/id_rsa.pub user@server

µÇ¼ºó¸´ÖÆ

ÏÖÔÚ£¬Äã¿ÉÒÔʹÓÃ˽Կͨ¹ýSSH¾ÙÐÐÉí·ÝÑéÖ¤£¬¶øÎÞÐèÊäÈëÃÜÂë¡£

ʹÓÃhtpasswd½¨Éè»ù±¾ÈÏÖ¤

ÈôÊÇÄã½öÏ£ÍûÌض¨Óû§²Å»ª»á¼ûÄãµÄÍøÕ¾»òÓ¦ÓóÌÐò£¬Äã¿ÉÒÔʹÓÃhtpasswd¹¤¾ß½¨Éè»ù±¾ÈÏÖ¤¡£

×°ÖÃapache2-utils£¨°üÀ¨htpasswd£©

sudo apt-get install apache2-utils

µÇ¼ºó¸´ÖÆ

½¨ÉèÒ»¸öÓû§

sudo htpasswd -c /etc/apache2/.htpasswd user1

µÇ¼ºó¸´ÖÆ

½«.htpasswdÎļþÓëÄãÒª±  £»¤µÄĿ¼»òÓ¦ÓóÌÐòÏà¹ØÁª¡£

ÕâÑù£¬Ö»ÓÐÓµÓÐÓÐÓÃÓû§ÃûºÍÃÜÂëµÄÓû§²Å»ª»á¼û¸ÃĿ¼»òÓ¦ÓóÌÐò¡£

×ܽá

ͨ¹ýʹÓÃÏÂÁîÐй¤¾ßÀ´±  £»¤ÄãµÄLinuxЧÀÍÆ÷£¬Äã¿ÉÒÔÔöÇ¿ËüµÄÇå¾²ÐÔ¡£±¾ÎÄÏÈÈÝÁËһЩ³£ÓõÄÏÂÁîÐй¤¾ß£¬°üÀ¨iptables¡¢fail2ban¡¢ssh-keygenºÍhtpasswd¡£Í¨¹ý׼ȷÉèÖúÍʹÓÃÕâЩ¹¤¾ß£¬Äã¿ÉÒÔÓÐÓõر  £»¤ÄãµÄЧÀÍÆ÷ÃâÊܶñÒâ¹¥»÷ºÍδ¾­ÊÚȨµÄ»á¼û¡£

Çë¼Ç×Å£¬ÓÅÒìµÄÇ徲ʵ¼ùÊÇÒ»Á¬Ò»Ö±µÄÀú³Ì£¬ÄãÓ¦¸Ã¾­³£¸üÐÂÄãµÄЧÀÍÆ÷£¬²¢°´ÆÚ¼ì²éºÍÉó²éÇå¾²ÉèÖá£

ÒÔÉϾÍÊÇÔõÑùͨ¹ýÏÂÁîÐй¤¾ß±  £»¤ÄãµÄLinuxЧÀÍÆ÷µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ