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