snort 服务启动脚本 iptables 联动启动脚本 开机启动
来源:互联网 发布:wps数据有效性在哪 编辑:程序博客网 时间:2024/05/22 23:48
snort服务启动脚本
vi /etc/init.d/snort
********************
#!/bin/sh
#
# chkconfig: 2345 98 82
# description: Starts and stops the snort intrusion detection system
#
# config: /etc/snort.conf
# processname: snort
# Source function library
. /etc/rc.d/init.d/functions
BASE=snort
DAEMON="-D"
INTERFACE="-i eth0"
CONF="/etc/snort.conf"
# Check that $BASE exists.
[ -f /usr/local/bin/$BASE ] || exit 0
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
RETVAL=0
# See how we were called.
case "$1" in
start)
if [ -n "`/sbin/pidof $BASE`" ]; then
echo -n $"$BASE: already running"
echo ""
exit $RETVAL
fi
echo -n "Starting snort service: "
/usr/local/bin/$BASE $INTERFACE -c $CONF $DAEMON
sleep 1
action "" /sbin/pidof $BASE
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/snort
;;
stop)
echo -n "Shutting down snort service: "
killproc $BASE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/snort
;;
restart|reload)
$0 stop
$0 start
RETVAL=$?
;;
status)
status $BASE
RETVAL=$?
;;
*)
echo "Usage: snort {start|stop|restart|reload|status}"
exit 1
esac
exit $RETVAL
chmod +x /etc/init.d/snort
chkconfig –add snort
* /usr/bin/perl /usr/local/bin/guardian.pl -c /etc/guardian.conf
* 将上一条命令加入 /etc/rc.d/rc.local
至此,完成设置
guardian有时会自动退出,可以使用如下脚本解决:
#!/bin/sh
/usr/local/bin/killguardian
/usr/local/bin/guardian.pl -c /etc/guardian.conf
exit 0
将上述脚本存为restartguardian,放置到/usr/local/bin
同时,crontab -e,加入如下一句:
* */6 * * * /usr/local/bin/restartguardian
意思为:每6小时重新启动guardian
perl -MCPAN -e shell
install Proc::ProcessTable
脚本:killguardian
#!/usr/bin/perl
#杀死当前guardian.pl进程,需要安装perl module Proc::ProcessTable
#访问http://www.cpan.org可以获得上述module
use Proc::ProcessTable;
$t = new Proc::ProcessTable;
foreach $p (@{$t->table})
{
kill 9, $p->pid if $p->cmndline =~ 'guardian.pl';
}
- snort 服务启动脚本 iptables 联动启动脚本 开机启动
- iptables启动脚本分析
- 开机启动服务chkconfig开机启动脚本/etc/rc.local
- linux开机启动脚本、服务等
- 自定义shell脚本服务开机自启动
- 【centos7】添加开机启动服务/脚本
- linux 开机启动脚本或者服务
- centos7如何添加开机启动服务/脚本
- centos7如何添加开机启动服务/脚本
- Nginx开机启动脚本
- oracle开机启动脚本
- linux 开机启动脚本
- suse开机启动脚本
- Linux 开机启动脚本
- linux 开机启动脚本
- CentOS 开机启动脚本
- ubuntu开机启动脚本
- nginx开机启动脚本
- 用户管理的完全恢复
- 在中国能找到的最好的BMP文件结构
- ubuntu 804精简U盘系统
- WinCE开始菜单中添加应用程序
- 在WinForm应用程序中实现自动升级
- snort 服务启动脚本 iptables 联动启动脚本 开机启动
- VC中ListCtrl控件的使用(一)
- Tapestry总架构
- Gtk中调用Mplayer
- Linux下安装RPM文件包
- VC中ListCtrl控件的使用(二)
- ScrumBut: Failure to Deliver
- 经典语录
- 智能电网的好处有哪些