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