diff options
Diffstat (limited to 'recipes-security/samhain/files')
5 files changed, 245 insertions, 0 deletions
diff --git a/recipes-security/samhain/files/samhain-client.default b/recipes-security/samhain/files/samhain-client.default new file mode 100644 index 0000000..9899577 --- /dev/null +++ b/recipes-security/samhain/files/samhain-client.default | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | # Set this to "yes" to start the server, after you configure it, of | ||
| 2 | # course. | ||
| 3 | SAMHAIN_CLIENT_START="no" \ No newline at end of file | ||
diff --git a/recipes-security/samhain/files/samhain-client.init b/recipes-security/samhain/files/samhain-client.init new file mode 100644 index 0000000..730e1c4 --- /dev/null +++ b/recipes-security/samhain/files/samhain-client.init | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # chkconfig: 2345 99 10 | ||
| 3 | # description: File Integrity Checking Daemon | ||
| 4 | # | ||
| 5 | # processname: samhain | ||
| 6 | # config : /etc/samhainrc | ||
| 7 | # logfile : /var/log/samhain_log | ||
| 8 | # database: /var/lib/samhain/samhain_file | ||
| 9 | # | ||
| 10 | |||
| 11 | NAME=samhain | ||
| 12 | DAEMON=/usr/sbin/samhain | ||
| 13 | RETVAL=0 | ||
| 14 | PIDFILE=/var/run/samhain.pid | ||
| 15 | |||
| 16 | . /etc/default/rcS | ||
| 17 | |||
| 18 | . /etc/default/samhain-client | ||
| 19 | |||
| 20 | if [ "x$SAMHAIN_CLIENT_START" != "xyes" ]; then | ||
| 21 | echo "${0}: client disabled in /etc/default/samhain-client" | ||
| 22 | exit 0 | ||
| 23 | fi | ||
| 24 | |||
| 25 | if [ -x $DAEMON ]; then | ||
| 26 | : | ||
| 27 | else | ||
| 28 | echo "${0}: executable ${DAEMON} not found" | ||
| 29 | exit 1 | ||
| 30 | fi | ||
| 31 | |||
| 32 | if [ ! -e /var/lib/samhain/samhain_file ]; then | ||
| 33 | echo "${0}: /var/lib/samhain/samhain_file does not exist. You must" | ||
| 34 | echo " run 'samhain -t init' before samhian-client can start." | ||
| 35 | exit 1 | ||
| 36 | fi | ||
| 37 | |||
| 38 | samhain_done() | ||
| 39 | { | ||
| 40 | if [ $RETVAL -eq 0 ]; then | ||
| 41 | echo "." | ||
| 42 | else | ||
| 43 | echo " failed." | ||
| 44 | fi | ||
| 45 | } | ||
| 46 | |||
| 47 | log_stat_msg () { | ||
| 48 | case "$1" in | ||
| 49 | 0) | ||
| 50 | echo "Service $NAME: Running"; | ||
| 51 | ;; | ||
| 52 | 1) | ||
| 53 | echo "Service $NAME: Stopped and /var/run pid file exists"; | ||
| 54 | ;; | ||
| 55 | 3) | ||
| 56 | echo "Service $NAME: Stopped"; | ||
| 57 | ;; | ||
| 58 | *) | ||
| 59 | echo "Service $NAME: Status unknown"; | ||
| 60 | ;; | ||
| 61 | esac | ||
| 62 | } | ||
| 63 | |||
| 64 | case "$1" in | ||
| 65 | start) | ||
| 66 | # | ||
| 67 | # Remove a stale PID file, if found | ||
| 68 | # | ||
| 69 | if test -f ${PIDFILE}; then | ||
| 70 | /bin/rm -f ${PIDFILE} | ||
| 71 | fi | ||
| 72 | # | ||
| 73 | echo -n "Starting ${NAME}" | ||
| 74 | /sbin/start-stop-daemon --start --quiet --exec $DAEMON | ||
| 75 | RETVAL=$? | ||
| 76 | samhain_done | ||
| 77 | ;; | ||
| 78 | |||
| 79 | stop) | ||
| 80 | echo -n "Stopping $NAME" | ||
| 81 | ( /sbin/start-stop-daemon --stop --quiet --exec $DAEMON ) | ||
| 82 | RETVAL=$? | ||
| 83 | |||
| 84 | # | ||
| 85 | # Remove a stale PID file, if found | ||
| 86 | # | ||
| 87 | if test -f ${PIDFILE}; then | ||
| 88 | /bin/rm -f ${PIDFILE} | ||
| 89 | fi | ||
| 90 | if test -S /var/run/${NAME}.sock; then | ||
| 91 | /bin/rm -f /var/run/${NAME}.sock | ||
| 92 | fi | ||
| 93 | samhain_done | ||
| 94 | ;; | ||
| 95 | |||
| 96 | restart) | ||
| 97 | $0 stop | ||
| 98 | sleep 3 | ||
| 99 | $0 start | ||
| 100 | RETVAL=$? | ||
| 101 | ;; | ||
| 102 | |||
| 103 | reload|force-reload) | ||
| 104 | echo -n "Reloading $NAME configuration files" | ||
| 105 | /sbin/start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON | ||
| 106 | RETVAL=$? | ||
| 107 | samhain_done | ||
| 108 | ;; | ||
| 109 | |||
| 110 | status) | ||
| 111 | $DAEMON status | ||
| 112 | RETVAL=$? | ||
| 113 | log_stat_msg ${RETVAL} | ||
| 114 | ;; | ||
| 115 | |||
| 116 | *) | ||
| 117 | echo "$0 usage: {start|stop|status|restart|reload}" | ||
| 118 | exit 1 | ||
| 119 | ;; | ||
| 120 | esac | ||
| 121 | |||
| 122 | exit $RETVAL | ||
diff --git a/recipes-security/samhain/files/samhain-server-volatiles b/recipes-security/samhain/files/samhain-server-volatiles new file mode 100644 index 0000000..6b80709 --- /dev/null +++ b/recipes-security/samhain/files/samhain-server-volatiles | |||
| @@ -0,0 +1 @@ | |||
| d daemon daemon 0775 /var/log/yule none | |||
diff --git a/recipes-security/samhain/files/samhain-server.default b/recipes-security/samhain/files/samhain-server.default new file mode 100644 index 0000000..bc3d67c --- /dev/null +++ b/recipes-security/samhain/files/samhain-server.default | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | # Set this to "yes" to start the server, after you configure it, of | ||
| 2 | # course. | ||
| 3 | SAMHAIN_SERVER_START="no" \ No newline at end of file | ||
diff --git a/recipes-security/samhain/files/samhain-server.init b/recipes-security/samhain/files/samhain-server.init new file mode 100644 index 0000000..89bd0aa --- /dev/null +++ b/recipes-security/samhain/files/samhain-server.init | |||
| @@ -0,0 +1,116 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # chkconfig: 2345 98 11 | ||
| 3 | # description: File Integrity Checking Daemon | ||
| 4 | # | ||
| 5 | # processname: yule | ||
| 6 | # config : /etc/yulerc | ||
| 7 | # logfile : /var/log/yule/yule_log | ||
| 8 | # database: /var/lib/yule/yule_file | ||
| 9 | # | ||
| 10 | |||
| 11 | NAME=yule | ||
| 12 | DAEMON=/usr/sbin/yule | ||
| 13 | RETVAL=0 | ||
| 14 | PIDFILE=/var/run/yule.pid | ||
| 15 | |||
| 16 | . /etc/default/rcS | ||
| 17 | |||
| 18 | . /etc/default/samhain-server | ||
| 19 | |||
| 20 | if [ "x$SAMHAIN_SERVER_START" != "xyes" ]; then | ||
| 21 | echo "${0}: server disabled in /etc/default/samhain-server" | ||
| 22 | exit 0 | ||
| 23 | fi | ||
| 24 | |||
| 25 | if [ -x $DAEMON ]; then | ||
| 26 | : | ||
| 27 | else | ||
| 28 | echo "${0}: executable ${DAEMON} not found" | ||
| 29 | exit 1 | ||
| 30 | fi | ||
| 31 | |||
| 32 | samhain_done() | ||
| 33 | { | ||
| 34 | if [ $RETVAL -eq 0 ]; then | ||
| 35 | echo "." | ||
| 36 | else | ||
| 37 | echo " failed." | ||
| 38 | fi | ||
| 39 | } | ||
| 40 | |||
| 41 | log_stat_msg () { | ||
| 42 | case "$1" in | ||
| 43 | 0) | ||
| 44 | echo "Service $NAME: Running"; | ||
| 45 | ;; | ||
| 46 | 1) | ||
| 47 | echo "Service $NAME: Stopped and /var/run pid file exists"; | ||
| 48 | ;; | ||
| 49 | 3) | ||
| 50 | echo "Service $NAME: Stopped"; | ||
| 51 | ;; | ||
| 52 | *) | ||
| 53 | echo "Service $NAME: Status unknown"; | ||
| 54 | ;; | ||
| 55 | esac | ||
| 56 | } | ||
| 57 | |||
| 58 | case "$1" in | ||
| 59 | start) | ||
| 60 | # | ||
| 61 | # Remove a stale PID file, if found | ||
| 62 | # | ||
| 63 | if test -f ${PIDFILE}; then | ||
| 64 | /bin/rm -f ${PIDFILE} | ||
| 65 | fi | ||
| 66 | # | ||
| 67 | echo -n "Starting ${NAME}" | ||
| 68 | /sbin/start-stop-daemon --start --quiet --exec $DAEMON | ||
| 69 | RETVAL=$? | ||
| 70 | samhain_done | ||
| 71 | ;; | ||
| 72 | |||
| 73 | stop) | ||
| 74 | echo -n "Stopping $NAME" | ||
| 75 | ( /sbin/start-stop-daemon --stop --quiet --exec $DAEMON ) | ||
| 76 | RETVAL=$? | ||
| 77 | |||
| 78 | # | ||
| 79 | # Remove a stale PID file, if found | ||
| 80 | # | ||
| 81 | if test -f ${PIDFILE}; then | ||
| 82 | /bin/rm -f ${PIDFILE} | ||
| 83 | fi | ||
| 84 | if test -S /var/run/${NAME}.sock; then | ||
| 85 | /bin/rm -f /var/run/${NAME}.sock | ||
| 86 | fi | ||
| 87 | samhain_done | ||
| 88 | ;; | ||
| 89 | |||
| 90 | restart) | ||
| 91 | $0 stop | ||
| 92 | sleep 3 | ||
| 93 | $0 start | ||
| 94 | RETVAL=$? | ||
| 95 | ;; | ||
| 96 | |||
| 97 | reload|force-reload) | ||
| 98 | echo -n "Reloading $NAME configuration files" | ||
| 99 | /sbin/start-stop-daemon --stop --signal 1 --quiet --exec $DAEMON | ||
| 100 | RETVAL=$? | ||
| 101 | samhain_done | ||
| 102 | ;; | ||
| 103 | |||
| 104 | status) | ||
| 105 | $DAEMON status | ||
| 106 | RETVAL=$? | ||
| 107 | log_stat_msg ${RETVAL} | ||
| 108 | ;; | ||
| 109 | |||
| 110 | *) | ||
| 111 | echo "$0 usage: {start|stop|status|restart|reload}" | ||
| 112 | exit 1 | ||
| 113 | ;; | ||
| 114 | esac | ||
| 115 | |||
| 116 | exit $RETVAL | ||
