ÔõÑùʹÓÃLinux¾ÙÐÐϵͳÇå¾²Éó¼ÆºÍ¼à¿Ø
ÔõÑùʹÓÃlinux¾ÙÐÐϵͳÇå¾²Éó¼ÆºÍ¼à¿Ø
СÐò£º
Ëæ×Å»¥ÁªÍøµÄ¿ìËÙÉú³¤ºÍÊÖÒÕµÄһֱǰ½ø£¬ÏµÍ³Çå¾²ÎÊÌâ±äµÃÔ½À´Ô½Ö÷Òª¡£ÎªÁËÈ·±£ÏµÍ³µÄÎȹ̺ÍÇå¾²£¬ÏµÍ³ÖÎÀíÔ±ÐèÒª¾ÙÐÐͨÀýµÄÇå¾²Éó¼ÆºÍ¼à¿Ø¡£Linux×÷ΪһÖÖÎȹ̡¢¿É¿¿¡¢¿ªÔ´µÄ²Ù×÷ϵͳ£¬ÌṩÁ˸»ºñµÄ¹¤¾ßºÍ¹¦Ð§£¬¿ÉÒÔ×ÊÖúÖÎÀíÔ±¾ÙÐÐϵͳÇå¾²Éó¼ÆºÍ¼à¿Ø¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃlinux¾ÙÐÐϵͳÇå¾²Éó¼ÆºÍ¼à¿Ø£¬ÒÔ¼°Ò»Ð©³£ÓõĴúÂëʾÀý¡£
Ò»¡¢ÏµÍ³Çå¾²Éó¼Æ
ϵͳÇå¾²Éó¼ÆÖ¼ÔÚ¼ì²éϵͳÊÇ·ñ±£´æÇå¾²Îó²î£¬ÒÔ¼°ÊÇ·ñÓÐδÊÚȨµÄ»á¼ûºÍ²Ù×÷¡£LinuxÌṩÁ˶àÖÖ¹¤¾ßºÍÊÖÒÕ£¬¿ÉÒÔ×ÊÖúÖÎÀíÔ±¾ÙÐÐϵͳÇå¾²Éó¼Æ¡£
1.1 ϵͳÈÕÖ¾Éó¼Æ
ϵͳÈÕÖ¾¼Í¼ÁËϵͳÖб¬·¢µÄÖÖÖÖÊÂÎñ£¬ÈçµÇ¼¡¢Îļþ»á¼û¡¢Àú³ÌÆô¶¯µÈ¡£ÖÎÀíÔ±¿ÉÒÔͨ¹ýÉó²éϵͳÈÕÖ¾À´ÅжÏÊÇ·ñ±£´æÒì³£²Ù×÷¡£ÏÂÃæÊÇÒ»¸öʹÓÃLinuxµÄÈÕÖ¾ÆÊÎö¹¤¾ßawkµÄʾÀý£º
# ²éÕҵǼʧ°ÜµÄ¼Í¼ grep "Failed password" /var/log/auth.log | awk '{ print $1 " " $2 " " $3 " " $11 }' # ²éÕÒÀֳɵǼµÄ¼Í¼ grep "Accepted password" /var/log/auth.log | awk '{ print $1 " " $2 " " $3 " " $9 }'
µÇ¼ºó¸´ÖÆ
1.2 ÎļþÍêÕûÐÔ¼à¿Ø
ÎļþÍêÕûÐÔ¼à¿Ø¹¤¾ß¿ÉÒÔ½ÏÁ¿ÏµÍ³ÎļþµÄÄ¿½ñ״̬ºÍÔ¤ÆÚ״̬£¬ÈôÊÇ·¢Ã÷Îļþ±»¸Ä¶¯£¬Ôò»áÌìÉú¾¯±¨¡£LinuxÌṩÁËÒ»¿î³£ÓõÄÎļþÍêÕûÐÔ¼à¿Ø¹¤¾ßTripwire¡£ÏÂÃæÊÇÒ»¸öʹÓÃTripwire¾ÙÐÐÎļþÍêÕûÐÔ¼à¿ØµÄʾÀý£º
# ³õʼ»¯TripwireÊý¾Ý¿â twadmin -m i -S /etc/twcfg.txt # ¼ì²éÎļþÍêÕûÐÔ tripwire --check
µÇ¼ºó¸´ÖÆ
1.3 ÍøÂçÁ÷Á¿¼à¿Ø
ÍøÂçÁ÷Á¿¼à¿Ø¿ÉÒÔ×ÊÖúÖÎÀíÔ±¼ì²âÊÇ·ñÓÐδÊÚȨµÄ»á¼ûºÍÊý¾Ý´«Êä¡£LinuxÌṩÁËÖî¶à¹¤¾ßºÍÊÖÒÕ£¬Èçiptables¡¢tcpdumpµÈ£¬¿ÉÒÔ×ÊÖúÖÎÀíÔ±¾ÙÐÐÍøÂçÁ÷Á¿¼à¿Ø¡£ÏÂÃæÊÇÒ»¸öʹÓÃiptables¾ÙÐÐÍøÂçÁ÷Á¿¼à¿ØµÄʾÀý£º
# ½¨ÉèÒ»¸öеÄiptablesÁ´ iptables -N LOGGING # ½«ËùÓÐÁ÷Á¿×ª·¢µ½LOGGINGÁ´ iptables -A INPUT -j LOGGING iptables -A OUTPUT -j LOGGING iptables -A FORWARD -j LOGGING # ÔÚLOGGINGÁ´ÖмͼÈÕÖ¾ iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables-Dropped: " --log-level 4 # Éó²éÈÕÖ¾ tail -f /var/log/messages
µÇ¼ºó¸´ÖÆ
¶þ¡¢ÏµÍ³Çå¾²¼à¿Ø
ϵͳÇå¾²¼à¿ØÖ¼ÔÚʵʱ¼à¿ØϵͳµÄ״̬£¬ÊµÊ±·¢Ã÷Òì³£Ô˶¯²¢½ÓÄÉÏìÓ¦²½·¥¡£LinuxÌṩÁ˶àÖÖ¹¤¾ßºÍÊÖÒÕ£¬¿ÉÒÔ×ÊÖúÖÎÀíÔ±¾ÙÐÐϵͳÇå¾²¼à¿Ø¡£
2.1 Àú³Ì¼à¿Ø
Àú³Ì¼à¿Ø¿ÉÒÔ×ÊÖúÖÎÀíÔ±¼ì²âϵͳÖÐÕýÔÚÔËÐеÄÀú³Ì£¬²¢¼à¿ØÆäÔ˶¯¡£LinuxÌṩÁ˶àÖÖÏÂÁîºÍ¹¤¾ß£¬Èçps¡¢top¡¢htopµÈ£¬¿ÉÒÔ×ÊÖúÖÎÀíÔ±¾ÙÐÐÀú³Ì¼à¿Ø¡£ÏÂÃæÊÇÒ»¸öʹÓÃpsÏÂÁî¾ÙÐÐÀú³Ì¼à¿ØµÄʾÀý£º
# ÁгöËùÓÐÀú³Ì ps aux # ƾ֤Àú³ÌÃû¹ýÂËÀú³Ì ps aux | grep "process_name"
µÇ¼ºó¸´ÖÆ
2.2 ϵͳÐÔÄܼà¿Ø
ϵͳÐÔÄܼà¿Ø¿ÉÒÔ×ÊÖúÖÎÀíԱʵʱ¼à¿ØϵͳµÄ¸ºÔØ¡¢CPUʹÓÃÂÊ¡¢ÄÚ´æʹÓÃÂʵÈÒªº¦Ö¸±ê¡£LinuxÌṩÁ˶àÖÖÏÂÁîºÍ¹¤¾ß£¬Èçtop¡¢vmstat¡¢sarµÈ£¬¿ÉÒÔ×ÊÖúÖÎÀíÔ±¾ÙÐÐϵͳÐÔÄܼà¿Ø¡£ÏÂÃæÊÇÒ»¸öʹÓÃtopÏÂÁî¾ÙÐÐϵͳÐÔÄܼà¿ØµÄʾÀý£º
#ʵʱÉó²éϵͳ¸ºÔغÍÀú³Ì״̬ top #°´CPUʹÓÃÂÊÅÅÐòÀú³Ì top -o %CPU #°´ÄÚ´æʹÓÃÂÊÅÅÐòÀú³Ì top -o %MEM
µÇ¼ºó¸´ÖÆ
2.3 ÍøÂçÅþÁ¬¼à¿Ø
ÍøÂçÅþÁ¬¼à¿Ø¿ÉÒÔ×ÊÖúÖÎÀíԱʵʱ¼à¿ØϵͳµÄÍøÂçÅþÁ¬ÇéÐΣ¬ÊµÊ±·¢Ã÷Òì³£ÅþÁ¬¡£LinuxÌṩÁ˶àÖÖÏÂÁîºÍ¹¤¾ß£¬Èçnetstat¡¢ssµÈ£¬¿ÉÒÔ×ÊÖúÖÎÀíÔ±¾ÙÐÐÍøÂçÅþÁ¬¼à¿Ø¡£ÏÂÃæÊÇÒ»¸öʹÓÃnetstatÏÂÁî¾ÙÐÐÍøÂçÅþÁ¬¼à¿ØµÄʾÀý£º
# Éó²éËùÓÐÍøÂçÅþÁ¬ netstat -a # Éó²éÌض¨¶Ë¿ÚµÄÍøÂçÅþÁ¬ netstat -an | grep ":port_number"
µÇ¼ºó¸´ÖÆ
½áÂÛ£º
±¾ÎÄÏÈÈÝÁËÔõÑùʹÓÃlinux¾ÙÐÐϵͳÇå¾²Éó¼ÆºÍ¼à¿Ø£¬²¢ÌṩÁËһЩ³£ÓõĴúÂëʾÀý¡£ÏµÍ³Çå¾²Éó¼ÆºÍ¼à¿ØÊÇÈ·±£ÏµÍ³Çå¾²µÄÖ÷Òª²½·¥£¬ÖÎÀíԱӦƾ֤ÏÖÕæÏàÐÎÎÞаÔËÓÃÖÖÖÖ¹¤¾ßºÍÊÖÒÕ£¬ÊµÊ±·¢Ã÷Ï¢Õù¾öϵͳÇå¾²ÎÊÌ⡣ͨ¹ýÒ»Á¬µÄÇå¾²Éó¼ÆºÍ¼à¿Ø£¬¿ÉÒÔÓÐÓÃÌá¸ßϵͳµÄÎȹÌÐÔºÍÇå¾²ÐÔ¡£
ÒÔÉϾÍÊÇÔõÑùʹÓÃLinux¾ÙÐÐϵͳÇå¾²Éó¼ÆºÍ¼à¿ØµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡