-
線上維護必備工具:
檢查CPU常用工具
#top
#ps
檢查內存常用工具
#vmstat 1
#free
檢查磁盤IO常用工具
#iostat -x 1
檢查網絡IO常用工具
#sar -n DEV 1 //網卡視覺來查看流量
#iftop // TCP層的視覺來查網絡流量
#nmap -sV 127.0.01 //探測端口服務
#netstat -antp //查看監聽進程
#netstat -ant|grep SYN |wc –l //查看是否存在syn flood
檢查內核錯誤日誌
#dmesg
#less /var/log/messages
-
Iptable 防火牆工具:
iptables的所有擴展模塊(功能非常多而且非常強大)
- bash 執行#man iptables-extensions
- http://ipset.netfilter.org/iptables-extensions.man.html
重點關注(限制單個IP的併發連接數):
iptables -A INPUT -p tcp --syn --dport 2907 -m connlimit --connlimit-above 8 -j REJECT
-
Selinux HIPS工具:
selinux相關包(選擇性安裝,紅色必裝)
- policycoreutils:提供與SELinux相關的命令,比如semanage,restorecon,audit2allow,semodule,load_policy,以及setsebool等,來操作和管理SELinux。
- policycoreutils-gui:提供圖形化的工具system-config-selinux來管理SELinux。
- selinux-policy:提供SeLinux應用策略。該應用策略包括了所有的SELinux策略,並作爲其他諸如目標策略(targeted policy)的基礎使用。
- selinux-policy-policy:提供SELinux策略。對於目標策略,安裝selinux-policy-targeted包,對於MLS策略,則安裝selinux-policy-mls包。需要說明的是:在fedora 8中,strict策略與目標策略結合在一起。
- setroubleshoot-server:翻譯SELinux拒絕操作信息,成爲sealert軟件可以查看的詳細描述信息。
- setools,setools-gui和setools-console:這些安裝包提供了與SELinux有關的策略分析和檢索、審計日誌監控、文件上下文管理等命令和工具。
- libselinux-utils:提供諸如avsstat,getenforce,getsebool,matchpathcon,selinuxconlist,selinuxdefcon,selinuxenabled,setenforce,togglesebools等工具。
- mcstrans:提供對SELinux上下文中級別(比如s0-s0:c0.c1023)信息的翻譯工作,在缺省情況下該軟件包不安裝
Ubuntu 啓動selinux:
#apt install libsemanage-common python-semanage checkpolicy libustr-1.0-1 libsemanage1 selinux-policy-ubuntu policycoreutils selinux
/etc/selinux/config
/var/log/audit/audit.log
/var/log/messages
另外還依賴auditd
https://linux.cn/article-4907-1.html
# apt-get install auditd
# service auditd restart
查看selinux狀態:
#getenforce
#sestatus -v
#setenforce [ Enforcing | Permissive | 1 | 0 ]
可顯化打開警告日誌
#sealert -b
#apt install libsemanage-common python-semanage checkpolicy libustr-1.0-1 libsemanage1 selinux-policy-ubuntu policycoreutils selinux setools selinux-utils
只查看策略
# ausearch -c 'test' --raw | audit2allow -m my-test
通過審計日誌,自動生成規則模塊
# ausearch -c 'test' --raw | audit2allow -M ex_test
安裝規則模塊
# semodule -i ex_test.pp