#!/bin/sh # OSSEC Controls OSSEC HIDS on Redhat-based systems # Author: Kayvan A. Sylvan # Author: Daniel B. Cid # # chkconfig: 2345 99 15 # description: Starts and stops OSSEC HIDS (Host Intrusion Detection System) # # This will work on Redhat systems (maybe others too) # Source function library. export LANG=C . /etc/init.d/functions . /etc/ossec-init.conf if [ "X${DIRECTORY}" = "X" ]; then DIRECTORY="/var/ossec" fi start() { echo -n "Starting OSSEC: " ${DIRECTORY}/bin/ossec-control start > /dev/null RETVAL=$? if [ $RETVAL -eq 0 ]; then success else failure fi echo return $RETVAL } stop() { echo -n "Stopping OSSEC: " ${DIRECTORY}/bin/ossec-control stop > /dev/null RETVAL=$? if [ $RETVAL -eq 0 ]; then success else failure fi echo return $RETVAL } status() { ${DIRECTORY}/bin/ossec-control status RETVAL=$? return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; status) status ;; *) echo "*** Usage: ossec {start|stop|restart|status}" exit 1 esac exit $?