很多就纠结如果统计ssh用户的流量,关于限速可以使用py来做,这里有一个googlecode的开源项目,可以实现对IP的ssh流量统计,32位系统使用我修改的Makefile文件:

CFLAGS = -I/usr/local/include -L/usr/lib/mysql/
all : mysql.c mysql.h sshband.c sshband.h pcap.c pcap.h userinfo.c userinfo.h
gcc -Wall -"sshband" pcap.c userinfo.c sshband.c mysql.c -lmysqlclient $(CFLAGS) -lpcap -I/usr/include/mysql

install : sshband
cp sshband /usr/sbin/
chmod +/usr/sbin/sshband
cp sshband.init /etc/init.d/sshband
chmod +/etc/init.d/sshband
if test ! -/etc/sshband.conf; then cp sshband.conf /etc/; chown root /etc/sshband.conf; chmod 600 /etc/sshband.conf; fi

uninstall :
rm -/usr/sbin/sshband
rm -/etc/init.d/sshband

clean :
rm -*.o
rm -f sshband

 
make && make install
 
创建文件:
mkdir /lib/lsb
touch /lib/lsb/init-functions
 
修改配置文件:
vim /etc/sshband.conf   #需要指向你的Mysql数据库
 
运行
/etc/init.d/sshbond start
 
SSHBond还是不错的,目前运作在Airssh网络加速系统的在线SSH流量统计中