分享几款常用的Linux安全运维工具

1. 查看进程占用带宽情况 - Nethogs

Nethogs 是一个终端下的网络流量监控工具可以直观的显示每个进程占用的带宽。

root@localhost ~]#yum  -y install libpcap-devel  ncurses-devel

[root@localhost ~]# tar zxvf nethogs-
0.8
.
0.tar
.gz

[root@localhost ~]# cd nethogs

[root@localhost nethogs]# make && make install

[root@localhost nethogs]# nethogs eth0

硬盘读取性能测试 - IOZone

IOZone 是一款 Linux 文件系统性能测试工具 可以测试不同的操作系统中文件系统的读写性能。
-a 使用全自动模式
-n 为自动模式设置最小文件大小 (Kbytes)。
-g 设置自动模式可使用的最大文件大小 Kbytes。
-i 用来指定运行哪个测试。-f 指定测试文件的名字完成后自动删除-R 产生 Excel 到标准输出
-b 指定输出到指定文件上

[root@localhost current]# tar xvf iozone3_420.tar
[root@localhost ~]# cd iozone3_420/src/current/
[root@localhost current]# make linux
[root@localhost current]# ./iozone -a -n 512m -g 16g -i 0-i 1 -i 5 -f/mnt/iozone -Rb ./iozone.xls

实时监控磁盘 IO-IOTop

IOTop 命令是专门显示硬盘 IO 的命令, 界面风格类似 top 命令。

[root@localhost ~]# yum -y install iotop

网络流量监控 - IPtraf

IPtraf 是一个运行在 Linux 下的简单的网络状况分析工具。

[root@localhost ~]# yum -y install iptraf

网络流量监控 - IFTop

Download:http://www.ex-parrot.com/~pdw/iftop/下载链接

[root@localhost ~]# tar zxvf iftop-0.17.tar.gz
root@localhost ~]# cd iftop-0.17
[root@localhost iftop-0.17]# ./configure
[root@localhost iftop-0.17]# make && make install
[root@localhost iftop-0.17]# iftop
[root@localhost iftop-0.17]# iftop -i eth0 

TX:发送流量
RX:接收流量
TOTAL:总流量
Cumm:运行 iftop 到目前时间的总流量
peak:流量峰值
rates:分别表示过去 2s 10s 40s 的平均流量

进程实时监控 - HTop

HTop 是一个 Linux 下的交互式的进程浏览器可以用来替换 Linux 下的 top 命令。

[root@localhost ~]# yum -y install htop

系统资源监控 - NMON

[root@localhost ~]# chmod +x nmon_x86_64_rhel6
[root@localhost ~]# mv nmon_x86_64_rhel6 /usr/sbin/nmon
[root@localhost ~]# nmon

SSH 暴力破解防护 - Fail2ban

http://www.fail2ban.org/wiki/index.php/Downloads
下载地址

[root@localhost ~]# cd fail2ban-0.8.11
[root@localhost fail2ban-0.8.11]# python setup.py install
[root@localhost fail2ban-0.8.11]# cd files/
[root@localhost files]# cp ./redhat-initd /etc/init.d/fail2ban
[root@localhost files]# service fail2ban start
[root@localhost files]# chkconfig --add fail2ban
[root@localhost files]# chkconfig fail2ban on
[root@localhost ~]# grep -v "^#" /etc/fail2ban/jail.conf | grep -v 
"^$"
[DEFAULT]
ignoreip = 127.0.0.1/8# 忽略本机 IP
bantime  = 600 #符合规则后封锁时间
findtime  = 600 
# 在多长时间内符合规则执行封锁如 600 秒达到 3 次则执行
maxretry = 3 # 最大尝试次数
backend = auto
#日志修改检测日志 gamin、polling 和 auto 这三种
usedns = warn
[ssh-iptables]
enabled  = true
# 默认是禁用 false
filter   = sshd
action   = iptables[name=SSH, port=ssh, protocol=tcp]
# sendmail-whois[name=SSH,dest = 收件人邮箱, sender = 发件人邮箱, sendername="Fail2Ban"]
logpath  = /var/log/sshd.log  
# 响应的错误日志一般在 / var/log/secure
maxretry = 5   
# 尝试错误次数覆盖全局中的 maxretry

fail2ban 的原理是调用 iptables 实时阻挡外界的攻击。
所以如果重启iptables了也要fail2ban

[root@localhost ~]# touch /var/log/sshd.log
[root@localhost ~]# service fail2ban restart
[root@localhost ~]# fail2ban-client status    
# 查看监控已经开启
Status
|- 
Number of jail:      1
`- Jail list:           ssh-iptables
[root@localhost ~]# iptables -L  #iptables 过滤表有 fail2ban 一条规则
fail2ban-SSH  tcp  --  anywhere             anywhere            tcp dpt:ssh

诸神之眼:安全扫描工具 - NMap

http://nmap.org/download.html下载地址

猜你喜欢

转载自blog.csdn.net/qq_43332010/article/details/120611240
今日推荐