2 # Init functions for the OSSEC HIDS
3 # Author: Daniel B. Cid <daniel.cid@gmail.com>
11 # Checking if it is a Redhat system.
12 if [ -r "/etc/redhat-release" ]; then
13 if [ -d /etc/rc.d/init.d ]; then
14 echo " - ${systemis} Redhat Linux."
15 echo " - ${modifiedinit}"
16 cp -pr ./src/init/ossec-hids-rh.init /etc/rc.d/init.d/ossec
17 chmod 555 /etc/rc.d/init.d/ossec
18 chown root:ossec /etc/rc.d/init.d/ossec
19 /sbin/chkconfig --add ossec > /dev/null 2>&1
24 if [ -r "/etc/gentoo-release" ]; then
25 echo " - ${systemis} Gentoo Linux."
26 echo " - ${modifiedinit}"
27 cp -pr ./src/init/ossec-hids-gentoo.init /etc/init.d/ossec
28 chmod 555 /etc/init.d/ossec
29 chown root:ossec /etc/init.d/ossec
30 rc-update add ossec default
35 if [ -r "/etc/SuSE-release" ]; then
36 echo " - ${systemis} Suse Linux."
37 echo " - ${modifiedinit}"
39 cp -pr ./src/init/ossec-hids-suse.init /etc/init.d/ossec
40 chmod 555 /etc/init.d/ossec
41 chown root:ossec /etc/init.d/ossec
43 /sbin/chkconfig --add ossec > /dev/null 2>&1
47 # Checking for slackware (by Jack S. Lai)
48 if [ -r "/etc/slackware-version" ]; then
49 echo " - ${systemis} Slackware Linux."
50 echo " - ${modifiedinit}"
51 cp -pr ./src/init/ossec-hids.init /etc/rc.d/rc.ossec
52 chmod 555 /etc/rc.d/rc.ossec
53 chown root:ossec /etc/rc.d/rc.ossec
55 grep ossec /etc/rc.d/rc.local > /dev/null 2>&1
57 echo "if [ -x /etc/rc.d/rc.ossec ]; then" >> /etc/rc.d/rc.local
58 echo " /etc/rc.d/rc.ossec start" >>/etc/rc.d/rc.local
59 echo "fi" >>/etc/rc.d/rc.local
65 # Darwin init script (by Lorenzo Costanzia di Costigliole <mummie@tin.it>)
66 if [ "X${NUNAME}" = "XDarwin" ]; then
67 # Generating darwin init script.
69 echo " - ${systemis} Darwin."
70 echo " - ${modifiedinit}"
71 sh ./src/init/darwin-init.sh
75 if [ "X${UN}" = "XSunOS" ]; then
76 echo " - ${systemis} Solaris (SunOS)."
77 echo " - ${modifiedinit}"
78 cp -pr ./src/init/ossec-hids-solaris.init /etc/init.d/ossec
79 chmod 755 /etc/init.d/ossec
80 ln -s /etc/init.d/ossec /etc/rc2.d/S97ossec
81 ln -s /etc/init.d/ossec /etc/rc3.d/S97ossec
85 if [ "X${UN}" = "XAIX" ]; then
86 echo " - ${systemis} AIX."
87 echo " - ${modifiedinit}"
88 cp -pr ./src/init/ossec-hids-aix.init /etc/rc.d/init.d/ossec
89 chmod 755 /etc/rc.d/init.d/ossec
90 ln -s /etc/rc.d/init.d/ossec /etc/rc.d/rc2.d/S97ossec
91 ln -s /etc/rc.d/init.d/ossec /etc/rc.d/rc3.d/S97ossec
95 if [ "X${UN}" = "XOpenBSD" -o "X${UN}" = "XNetBSD" -o "X${UN}" = "XFreeBSD" -o "X${UN}" = "XDragonFly" ]; then
96 # Checking for the presence of ossec-control on rc.local
97 grep ossec-control /etc/rc.local > /dev/null 2>&1
99 echo "echo \"${starting}\"" >> /etc/rc.local
100 echo "${INSTALLDIR}/bin/ossec-control start" >> /etc/rc.local
102 echo " - ${systemis} ${NUNAME}."
103 echo " - ${modifiedinit}"
105 elif [ "X${NUNAME}" = "XLinux" ]; then
106 if [ -e "/etc/rc.d/rc.local" ]; then
107 echo " - ${systemis} Linux."
108 echo " - ${modifiedinit}"
110 grep ossec-control /etc/rc.d/rc.local > /dev/null 2>&1
112 echo "echo \"${starting}\"" >> /etc/rc.d/rc.local
113 echo "${INSTALLDIR}/bin/ossec-control start" >> /etc/rc.d/rc.local
116 elif [ -d "/etc/rc.d/init.d" ]; then
117 echo " - ${systemis} Linux (SysV)."
118 echo " - ${modifiedinit}"
119 cp -pr ./src/init/ossec-hids.init /etc/rc.d/init.d/ossec
120 chmod 555 /etc/rc.d/init.d/ossec
121 chown root:ossec /etc/rc.d/init.d/ossec
123 # Taken from Stephen Bunn ossec howto.
124 elif [ -d "/etc/init.d" -a -f "/usr/sbin/update-rc.d" ]; then
125 echo " - ${systemis} Debian (Ubuntu or derivative)."
126 echo " - ${modifiedinit}"
127 cp -pr ./src/init/ossec-hids-debian.init /etc/init.d/ossec
128 chmod +x /etc/init.d/ossec
129 chmod go-w /etc/init.d/ossec
130 chown root:ossec /etc/init.d/ossec
131 update-rc.d ossec defaults > /dev/null 2>&1
133 elif [ -e "/etc/alpine-release" ]; then
134 echo " - ${systemis} Alpine Linux."
135 echo " - ${modifiedinit}"
136 cp -pr ./src/init/ossec-hids-alpine.init /etc/init.d/ossec
137 chmod +x /etc/init.d/ossec
138 chmod go-w /etc/init.d/ossec
139 chown root:ossec /etc/init.d/ossec