-
线上维护必备工具:
检查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