new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / init / shared.sh
1 #!/bin/sh
2 # Shared variables and functions
3 # Author: Daniel B. Cid <daniel.cid@gmail.com>
4
5 ### Setting up variables
6 VERSION_FILE="./src/VERSION"
7 VERSION=`cat ${VERSION_FILE}`
8 LOCATION="./src/LOCATION"
9 UNAME=`uname -snr`
10 NUNAME=`uname`
11
12 # If whoami does not exist, try id
13 ls "`which whoami`" > /dev/null 2>&1
14 if [ ! $? = 0 ]; then
15     ME=`id | cut -d " " -f 1`
16     if [ "X${ME}" = "Xuid=0(root)" ]; then
17         ME="root"
18     fi
19 else
20     ME=`whoami 2>/dev/null`
21 fi
22
23 OSSEC_INIT="/etc/ossec-init.conf"
24 HOST=`hostname`
25 NAMESERVERS=`cat /etc/resolv.conf | grep "^nameserver" | cut -d " " -sf 2`
26 NAMESERVERS2=`cat /etc/resolv.conf | grep "^nameserver" | cut -sf 2`
27 HOST_CMD=`which host`
28 NAME="OSSEC HIDS"
29 INSTYPE="server"
30 DEFAULT_DIR=`grep DIR ${LOCATION} | cut -f2 -d\"`
31 INSTALLDIR="$DEFAULT_DIR";
32 WORKDIR="$INSTALLDIR"
33 CEXTRA=""
34
35 # Internal definitions
36 NEWCONFIG="./etc/ossec.mc"
37 PRECONFIG="./etc/PRECONFIG"
38
39 ## Templates
40 TEMPLATE="./etc/templates"
41 ERROR="errors"
42 MSG="messages"
43
44 ## Config templates
45 SYSCHECK_TEMPLATE="./etc/templates/config/syscheck.template"
46 SYSLOG_TEMPLATE="./etc/templates/config/syslog-logs.template"
47 APACHE_TEMPLATE="./etc/templates/config/apache-logs.template"
48 SNORT_TEMPLATE="./etc/templates/config/snort-logs.template"
49 PGSQL_TEMPLATE="./etc/templates/config/pgsql-logs.template"
50 HOST_DENY_TEMPLATE="./etc/templates/config/ar-host-deny.template"
51 FIREWALL_DROP_TEMPLATE="./etc/templates/config/ar-firewall-drop.template"
52 DISABLE_ACCOUNT_TEMPLATE="./etc/templates/config/ar-disable-account.template"
53 ACTIVE_RESPONSE_TEMPLATE="./etc/templates/config/active-response.template"
54 ROUTENULL_TEMPLATE="./etc/templates/config/ar-routenull.template"
55 RULES_TEMPLATE="./etc/templates/config/rules.template"
56
57 ## Host output
58 OSSECMX="devmail.ossec.net mail is handled by 10 ossec.mooo.com."
59 OSSECMX2="devmail.ossec.net mail is handled (pri=10) by ossec.mooo.com"
60 OSSECMX3="devmail.ossec.net mail is handled by 10 ossec.mooo.COM."
61
62 ## Predefined file
63 PREDEF_FILE="./etc/preloaded-vars.conf"
64