Skip to content
Snippets Groups Projects
Commit 011e6230 authored by Jan Mach's avatar Jan Mach
Browse files

Implemented Debian SysV init file and Systemd service unit files for Mentat system.

(Redmine issue: #3387)
parent c146013b
No related branches found
No related tags found
No related merge requests found
......@@ -228,16 +228,30 @@ module.exports = function(grunt) {
{
expand: true,
flatten: true,
cwd: 'etc/',
src: './bash_mentat-ng-completion',
dest: '<%= project_paths.package_dir %>etc/bash_completion.d/'
cwd: 'etc/bash_completion.d/',
src: './mentat',
dest: '<%= project_paths.package_dir %>etc/bash_completion.d'
},
{
expand: true,
flatten: true,
cwd: 'etc/',
src: './default_mentat',
dest: '<%= project_paths.package_dir %>etc/default/'
cwd: 'etc/default/',
src: './mentat',
dest: '<%= project_paths.package_dir %>etc/default'
},
{
expand: true,
flatten: true,
cwd: 'etc/init.d/',
src: './mentat',
dest: '<%= project_paths.package_dir %>etc/init.d'
},
{
expand: true,
flatten: true,
cwd: 'etc/systemd/',
src: './mentat.service',
dest: '<%= project_paths.package_dir %>lib/systemd/system'
}
]
},
......@@ -388,15 +402,15 @@ module.exports = function(grunt) {
mode: '755'
},
deb_control: {
// Target-specific file/dir lists and/or options go here.
src: ['<%= project_paths.package_dir %>DEBIAN/postinst']
},
deb_init: {
src: ['<%= project_paths.package_dir %>etc/init.d/*']
},
deb_bin: {
// Target-specific file/dir lists and/or options go here.
src: ['<%= project_paths.package_dir %><%= paths_deb.bin_dir %>/*']
},
deb_scr: {
// Target-specific file/dir lists and/or options go here.
src: ['<%= project_paths.package_dir %><%= paths_deb.scr_dir %>/*']
}
}
......
/etc/default/mentat
/etc/mentat/cron/fetch-geoipdb-sh.cron
/etc/mentat/cron/fetch-negistry-sh.cron
/etc/mentat/cron/mentat-backup-py.cron
......
File moved
#-------------------------------------------------------------------------------
# Default settings for Mentat server. This file is sorced by post-instalation
# Default settings for Mentat server. This file is sourced by post-instalation
# script.
#
# Copyright (C) since 2011 CESNET, z.s.p.o
# Use of this source is governed by the MIT license, see LICENSE file.
#-------------------------------------------------------------------------------
# Options to pass to sshd
MENTAT_IS_ENABLED=yes
MENTAT_USER=mentat
MENTAT_GROUP=mentat
#!/bin/bash
#
### BEGIN INIT INFO
# Provides: mentat
# Required-Start: $local_fs $syslog
# Required-Stop: $local_fs $syslog
# Should-Start: $network $named
# Should-Stop: $network $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Mentat - IDS and SIEM system
# Description: Start the IDS and SIEM system Mentat
# This script will start the Mentat IDS and SIEM system.
### END INIT INFO
#
# Following configuration values may be overriden in /etc/default/mentat or
# /etc/sysconfig/mentat customizable configuration files.
#
MENTAT_IS_ENABLED=yes
MENTAT_USER=mentat
MENTAT_GROUP=mentat
# Check, that Mentat controller module is properly installed.
if test ! -x /usr/local/bin/mentat-controller.py; then
echo "Mentat system does not seem to be properly installed"
exit 0
fi
# Check, that Mentat system is enabled.
if test "x$MENTAT_IS_ENABLED" != "xyes"; then
exit 0
fi
# Try Debian & Fedora/RHEL/Suse sysconfig load
for n in default sysconfig; do
[ -f /etc/$n/"$SERVICE_NAME" ] && . /etc/$n/"$SERVICE_NAME"
done
# Fallback in case LSB init functions will not be loaded successfully.
function log_daemon_msg () { echo -n "$@"; }
function log_end_msg () { [ $1 -eq 0 ] && echo " OK" || echo " Failed"; }
function status_of_proc () { [ -f "$PID" ] && ps u -p $(<"$PID") || echo "$PID not found."; }
# Load LSB init functions.
[ -f /lib/lsb/init-functions ] && . /lib/lsb/init-functions
ACTION="$1"
case "$ACTION" in
start)
log_daemon_msg "Starting $SERVICE_DESC" "$SERVICE_NAME"
/usr/local/bin/mentat-controller.py --command start
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $SERVICE_DESC" "$SERVICE_NAME"
/usr/local/bin/mentat-controller.py --command stop
log_end_msg $?
;;
restart|force-reload)
/usr/local/bin/mentat-controller.py --command restart
;;
status)
/usr/local/bin/mentat-controller.py --command status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 2
;;
esac
[Unit]
Description=Mentat - IDS and SIEM system
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
Environment=MENTAT_STARTED_BY_SYSTEMD=true
ExecStart=/usr/local/bin/mentat-controller.py --command start
ExecStop=/usr/local/bin/mentat-controller.py --command stop
Restart=no
[Install]
WantedBy=multi-user.target
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment