ÔõÑùÉèÖÃCentOSϵͳÒÔ×èÖ¹Íⲿ¹¥»÷ÕߵĶ˿ÚɨÃè
ÔõÑùÉèÖÃcentosϵͳÒÔ×èÖ¹Íⲿ¹¥»÷ÕߵĶ˿ÚɨÃè
ͻ񻣼
Ëæ×Å»¥ÁªÍøµÄÒ»Ö±Éú³¤£¬ÍøÂçÇå¾²ÎÊÌâÔ½À´Ô½Í»³ö¡£Íⲿ¹¥»÷Õß¾³£Í¨¹ý¶Ë¿ÚɨÃèÀ´Ñ°ÕÒϵͳÖеÄÇå¾²Îó²î¡£ÎªÁ˱£»¤ÎÒÃǵÄϵͳ£¬ÎÒÃÇÐèÒª½ÓÄɲ½·¥À´×èÖ¹ÕâЩɨÃè¡£±¾ÎĽ«ÏÈÈÝÔõÑùÉèÖÃcentosϵͳÒÔ×èÖ¹Íⲿ¹¥»÷ÕߵĶ˿ÚɨÃ裬²¢ÌṩÁËÏà¹ØµÄ´úÂëʾÀý¡£
Ò»¡¢×°Öò¢ÉèÖ÷À»ðǽ
CentOSϵͳ×Ô´øÁËfirewalld·À»ðǽ£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÉèÖ÷À»ðǽÀ´ÏÞÖƶÔϵͳµÄ¶Ë¿ÚɨÃè¡£
1.×°ÖÃfirewalld£º
sudo yum install firewalld
2.Æô¶¯firewalldЧÀÍ£º
sudo systemctl start firewalld
3.ÉèÖÃfirewalld¿ª»ú×ÔÆô¶¯£º
sudo systemctl enable firewalld
4.Éó²éfirewalld״̬£º
sudo firewall-cmd –state
¶þ¡¢Ìí¼Ó¶Ë¿Ú¹æÔò
ÎÒÃÇ¿ÉÒÔʹÓÃfirewalldÏÂÁîÀ´Ìí¼Ó¶Ë¿Ú¹æÔò£¬ÒÔ×èÖ¹Íⲿ¹¥»÷ÕߵĶ˿ÚɨÃè¡£
1.Éó²éϵͳ¿ª·ÅµÄ¶Ë¿Ú£º
sudo firewall-cmd –list-ports
2.Ìí¼ÓÔÊÐí»á¼ûµÄ¶Ë¿Ú£º
sudo firewall-cmd –add-port=80/tcp –permanent
sudo firewall-cmd –add-port=443/tcp –permanent
3.ÒƳýĬÈÏ¿ª·ÅµÄ¶Ë¿Ú£º
sudo firewall-cmd –remove-service=http –permanent
sudo firewall-cmd –remove-service=https –permanent
4.ÖØмÓÔØfirewalldÉèÖãº
sudo firewall-cmd –reload
Èý¡¢½ûÓÃICMP»ØÓ¦
³ýÁËÏÞÖƶ˿ڻá¼û£¬ÎÒÃÇ»¹¿ÉÒÔ½ûÓÃICMP»ØÓ¦£¬ÕâÑù¿ÉÒÔÓÐÓÃ×èÖ¹Íⲿ¹¥»÷Õß¾ÙÐÐͨÀýµÄpingɨÃè¡£
1.½ûÓÃICMP»ØÓ¦£º
sudo firewall-cmd –permanent –add-rich-rule=’rule protocol value=”icmp” drop’
2.ÖØмÓÔØfirewalldÉèÖãº
sudo firewall-cmd –reload
ËÄ¡¢¿ªÆôSYN Cookie±£»¤
SYN CookieÊÇÒ»ÖÖÌá·ÀDoSºÍDDoS¹¥»÷µÄ»úÖÆ£¬Í¨¹ý¿ªÆôSYN Cookie±£»¤£¬ÎÒÃÇ¿ÉÒÔÓÐÓñÜÃâÍⲿ¹¥»÷Õ߶Ôϵͳ¾ÙÐж˿ÚɨÃè¡£
1.¿ªÆôSYN Cookie±£»¤£º
sudo echo “net.ipv4.tcp_syncookies = 1” >> /etc/sysctl.conf
sudo sysctl -p
2.ÖØмÓÔØsysctlÉèÖãº
sudo sysctl –system
Îå¡¢ÏÞÖÆSSH»á¼û
SSHÊÇÍⲿ¹¥»÷Õß³£ÓõÄÈëÇÖÊÖ¶ÎÖ®Ò»£¬ÎÒÃÇ¿ÉÒÔͨ¹ýÏÞÖÆSSH»á¼ûÀ´ïÔÌϵͳÊܵ½¹¥»÷µÄΣº¦¡£
1.±à¼SSHÉèÖÃÎļþ£º
sudo vi /etc/ssh/sshd_config
2.½«ÒÔÏÂÐÐ×¢ÊÍ×÷·Ï²¢ÐÞ¸ÄΪָ¶¨µÄ¶Ë¿ÚºÍIP£º
Port 22
PermitRootLogin yes
PasswordAuthentication yes
AllowUsers user_name@ip_address
3.ÉúÑÄÎļþ²¢ÖØÐÂÆô¶¯SSHЧÀÍ£º
sudo service sshd restart
Áù¡¢¼à¿ØϵͳÈÕÖ¾
×îºó£¬ÎÒÃÇÓ¦¸Ã°´ÆÚ¼à¿ØϵͳµÄÈÕÖ¾£¬ÒÔ±ãʵʱ·¢Ã÷²¢Ó¦¶Ô¿ÉÄܵĹ¥»÷¡£
1.Éó²éϵͳÈÕÖ¾£º
sudo tail -f /var/log/messages
´úÂëʾÀý£º
1.Ìí¼ÓÔÊÐí80ºÍ443¶Ë¿Ú»á¼ûµÄ¹æÔò£º
sudo firewall-cmd –add-port=80/tcp –permanent
sudo firewall-cmd –add-port=443/tcp –permanent
2.½ûÓÃICMP»ØÓ¦µÄʾÀý£º
sudo firewall-cmd –permanent –add-rich-rule=’rule protocol value=”icmp” drop’
3.¿ªÆôSYN Cookie±£»¤µÄʾÀý£º
sudo echo “net.ipv4.tcp_syncookies = 1” >> /etc/sysctl.conf
sudo sysctl -p
×ܽ᣺
ͨ¹ý×°Öò¢ÉèÖ÷À»ðǽ¡¢Ìí¼Ó¶Ë¿Ú¹æÔò¡¢½ûÓÃICMP»ØÓ¦¡¢¿ªÆôSYN Cookie±£»¤ºÍÏÞÖÆSSH»á¼ûµÈ²½·¥£¬ÎÒÃÇ¿ÉÒÔÓÐÓõØ×èÖ¹Íⲿ¹¥»÷ÕߵĶ˿ÚɨÃ裬Ìá¸ßϵͳµÄÇå¾²ÐÔ¡£Í¬Ê±£¬ÎÒÃÇÒ²Ó¦¸Ã°´ÆÚ¼à¿ØϵͳÈÕÖ¾£¬ÊµÊ±·¢Ã÷²¢Ó¦¶ÔDZÔڵĹ¥»÷¡£Ö»ÓÐ×ÛºÏÔËÓÃÖÖÖÖÇå¾²²½·¥£¬ÎÒÃDzŻª¸üºÃµØ±£»¤ÎÒÃǵÄϵͳÃâÊÜÍⲿ¹¥»÷µÄÍþв¡£
ÒÔÉϾÍÊÇÔõÑùÉèÖÃCentOSϵͳÒÔ×èÖ¹Íⲿ¹¥»÷ÕߵĶ˿ÚɨÃèµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡