This file is indexed.

/usr/lib/icinga2/prepare-dirs is in icinga2-common 2.6.0-2+deb9u1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/sh
#
# This script prepares directories and files needed for running Icinga2
#

# load system specific defines
SYSCONFIGFILE=$1
if [ -f "$SYSCONFIGFILE" ]; then
	. $SYSCONFIGFILE
else
	echo "Error: You need to supply the path to the Icinga2 sysconfig file as parameter."
	exit 1
fi


ICINGA2_USER=`$DAEMON variable get --current RunAsUser`
if [ $? != 0 ]; then
        echo "Could not fetch RunAsUser variable. Error '$ICINGA2_USER'. Exiting."
        exit 6
fi

ICINGA2_GROUP=`$DAEMON variable get --current RunAsGroup`
if [ $? != 0 ]; then
        echo "Could not fetch RunAsGroup variable. Error '$ICINGA2_GROUP'. Exiting."
        exit 6
fi

getent passwd $ICINGA2_USER >/dev/null 2>&1 || (echo "Icinga user '$ICINGA2_USER' does not exist. Exiting." && exit 6)
getent group $ICINGA2_GROUP >/dev/null 2>&1 || (echo "Icinga group '$ICINGA2_GROUP' does not exist. Exiting." && exit 6)
getent group $ICINGA2_COMMAND_GROUP >/dev/null 2>&1 || (echo "Icinga command group '$ICINGA2_COMMAND_GROUP' does not exist. Exiting." && exit 6)

mkdir -p $(dirname -- $ICINGA2_PID_FILE)
chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $(dirname -- $ICINGA2_PID_FILE)
if [ -f $ICINGA2_PID_FILE ]; then
	chown $ICINGA2_USER:$ICINGA2_GROUP $ICINGA2_PID_FILE
fi

mkdir -p $(dirname -- $ICINGA2_ERROR_LOG)
chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $(dirname -- $ICINGA2_ERROR_LOG)
chmod 750 $(dirname -- $ICINGA2_ERROR_LOG)
if [ -f $ICINGA2_ERROR_LOG ]; then
	chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $ICINGA2_ERROR_LOG
fi
if [ -f $ICINGA2_LOG ]; then
	chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $ICINGA2_LOG
fi

mkdir -p $ICINGA2_RUN_DIR/icinga2/cmd
chown $ICINGA2_USER:$ICINGA2_COMMAND_GROUP $ICINGA2_RUN_DIR/icinga2/cmd
if type restorecon >/dev/null 2>&1; then
	restorecon -R $ICINGA2_RUN_DIR/icinga2/
fi
chmod 2750 $ICINGA2_RUN_DIR/icinga2/cmd