diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2018-07-14 21:03:06 +0100 |
commit | 8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch) | |
tree | 7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /app-admin/swatchdog/files | |
parent | 30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff) |
gentoo resync : 14.07.2018
Diffstat (limited to 'app-admin/swatchdog/files')
-rw-r--r-- | app-admin/swatchdog/files/swatchdog-confd | 25 | ||||
-rw-r--r-- | app-admin/swatchdog/files/swatchdog-init | 53 | ||||
-rw-r--r-- | app-admin/swatchdog/files/swatchdogrc | 10 |
3 files changed, 88 insertions, 0 deletions
diff --git a/app-admin/swatchdog/files/swatchdog-confd b/app-admin/swatchdog/files/swatchdog-confd new file mode 100644 index 000000000000..13f8a0aed79e --- /dev/null +++ b/app-admin/swatchdog/files/swatchdog-confd @@ -0,0 +1,25 @@ +# /etc/conf.d/swatchdog: config file for /etc/init.d/swatchdog + +# Path to the swatchdog program. +#SWATCHDOG_BINARY="/usr/bin/swatchdog" + +# Swatchrc to read patterns and actions from. +#SWATCHDOGRC="/etc/swatchdogrc" + +# File to monitor +#SWATCHDOG_TAILFILE="/var/log/syslog" + +# Arguments to tail program +#SWATCHDOG_TAILARGS="" + +# Swatch log file +#SWATCHDOG_LOGFILE="/var/log/swatchdog.log" + +# Swatch error file +#SWATCHDOG_ERRFILE="/var/log/swatchdog-err.log" + +# Where to output the generated script to. Should not be writable by others. +#SWATCHDOG_SCRIPT="/run/swatchdog/swatchdog_script.pl" + +# Whether to parse the complete file once at startup. Defaults to "NO". +PARSE_FULL="NO" diff --git a/app-admin/swatchdog/files/swatchdog-init b/app-admin/swatchdog/files/swatchdog-init new file mode 100644 index 000000000000..d623070073f7 --- /dev/null +++ b/app-admin/swatchdog/files/swatchdog-init @@ -0,0 +1,53 @@ +#!/sbin/openrc-run +# This script is based on the one created by Phil (bug #255329). + +depend() { + need logger +} + +SWATCHDOG_BINARY=${SWATCHDOG_BINARY:-/usr/bin/swatchdog} +SWATCHDOGRC=${SWATCHDOGRC:-/etc/swatchdogrc} +SWATCHDOG_TAILFILE=${SWATCHDOG_TAILFILE:-/var/log/syslog} +SWATCHDOG_LOGFILE=${SWATCHDOG_LOGFILE:-/var/log/swatchdog.log} +SWATCHDOG_ERRFILE=${SWATCHDOG_ERRFILE:-/var/log/swatchdog-err.log} +SWATCHDOG_SCRIPT=${SWATCHDOG_SCRIPT:-/run/swatchdog/swatchdog_script.pl} + +gen_script() { + local tailargs="" + if [ "${SWATCHDOG_TAILARGS}" ]; then + tailargs="--tail-args=\"${SWATCHDOG_TAILARGS}\"" + fi + ebegin "Generating swatchdog script from config" + ${SWATCHDOG_BINARY} --dump-script="${SWATCHDOG_SCRIPT}" \ + --use-cpan-file-tail ${tailargs} \ + --config-file "${SWATCHDOGRC}" $1 "${SWATCHDOG_TAILFILE}" + eend $? +} + +parse_full() { + gen_script --examine + ebegin "Parsing complete file once" + /usr/bin/perl ${SWATCHDOG_SCRIPT} 1>/dev/null + eend $? +} + +start() { + checkpath -d -q -m 0750 -o root:root /run/swatchdog + if [ "${PARSE_FULL}" = "YES" ]; then + parse_full + fi + gen_script --tail-file + ebegin "Starting swatchdog" + start-stop-daemon --start --quiet --background \ + --make-pidfile --pidfile /run/swatchdog/swatchdog.pid \ + --stdout ${SWATCHDOG_LOGFILE} --stderr ${SWATCHDOG_ERRFILE} \ + --exec /usr/bin/perl -- ${SWATCHDOG_SCRIPT} + eend $? +} + +stop() { + ebegin "Stopping swatchdog" + start-stop-daemon --stop --exec /usr/bin/perl \ + --pidfile /run/swatchdog/swatchdog.pid --quiet + eend $? +} diff --git a/app-admin/swatchdog/files/swatchdogrc b/app-admin/swatchdog/files/swatchdogrc new file mode 100644 index 000000000000..5132f855852b --- /dev/null +++ b/app-admin/swatchdog/files/swatchdogrc @@ -0,0 +1,10 @@ +# +# A sample configuration file for swatchdog. +# +# See "man swatchdog" for details. + +# Mails root when invalid remote login attempted. +watchfor /(.*) (.*) (.*) (.*) (.*):( [iI]nvalid [uU]ser )(.*)( from )(.*)$/ + threshold track_by=$9,type=limit,count=3,seconds=30 + mail root,subject="Invalid user" + |