2 # Init functions for the OSSEC HIDS
4 # Author: Daniel B. Cid <daniel.cid@gmail.com>
5 # Last modification: May 04, 2006 (by Kayvan A. Sylvan <kayvan@sylvan.com>)
15 # Checking if it is a Redhat system.
16 if [ -r "/etc/redhat-release" ]; then
17 if [ -d /etc/rc.d/init.d ]; then
18 echo " - ${systemis} Redhat Linux."
19 echo " - ${modifiedinit}"
20 cp -pr ./src/init/ossec-hids-rh.init /etc/rc.d/init.d/ossec
21 chmod 555 /etc/rc.d/init.d/ossec
22 chown root:ossec /etc/rc.d/init.d/ossec
23 /sbin/chkconfig --add ossec > /dev/null 2>&1
28 if [ -r "/etc/gentoo-release" ]; then
29 echo " - ${systemis} Gentoo Linux."
30 echo " - ${modifiedinit}"
31 cp -pr ./src/init/ossec-hids-gentoo.init /etc/init.d/ossec
32 chmod 555 /etc/init.d/ossec
33 chown root:ossec /etc/init.d/ossec
34 rc-update add ossec default
39 if [ -r "/etc/SuSE-release" ]; then
40 echo " - ${systemis} Suse Linux."
41 echo " - ${modifiedinit}"
43 cp -pr ./src/init/ossec-hids-suse.init /etc/init.d/ossec
44 chmod 555 /etc/init.d/ossec
45 chown root:ossec /etc/init.d/ossec
47 /sbin/chkconfig --add ossec > /dev/null 2>&1
51 # Checking for slackware (by Jack S. Lai)
52 if [ -r "/etc/slackware-version" ]; then
53 echo " - ${systemis} Slackware Linux."
54 echo " - ${modifiedinit}"
55 cp -pr ./src/init/ossec-hids.init /etc/rc.d/rc.ossec
56 chmod 555 /etc/rc.d/rc.ossec
57 chown root:ossec /etc/rc.d/rc.ossec
59 grep ossec /etc/rc.d/rc.local > /dev/null 2>&1
61 echo "if [ -x /etc/rc.d/rc.ossec ]; then" >> /etc/rc.d/rc.local
62 echo " /etc/rc.d/rc.ossec start" >>/etc/rc.d/rc.local
63 echo "fi" >>/etc/rc.d/rc.local
69 # Darwin init script (by Lorenzo Costanzia di Costigliole <mummie@tin.it>)
70 if [ "X${NUNAME}" = "XDarwin" ]; then
71 # Generating darwin init script.
73 echo " - ${systemis} Darwin."
74 echo " - ${modifiedinit}"
75 sh ./src/init/darwin-init.sh
79 if [ "X${UN}" = "XSunOS" ]; then
80 echo " - ${systemis} Solaris (SunOS)."
81 echo " - ${modifiedinit}"
82 cp -pr ./src/init/ossec-hids-solaris.init /etc/init.d/ossec
83 chmod 755 /etc/init.d/ossec
84 ln -s /etc/init.d/ossec /etc/rc2.d/S97ossec
85 ln -s /etc/init.d/ossec /etc/rc3.d/S97ossec
89 if [ "X${UN}" = "XAIX" ]; then
90 echo " - ${systemis} AIX."
91 echo " - ${modifiedinit}"
92 cp -pr ./src/init/ossec-hids-aix.init /etc/rc.d/init.d/ossec
93 chmod 755 /etc/rc.d/init.d/ossec
94 ln -s /etc/rc.d/init.d/ossec /etc/rc.d/rc2.d/S97ossec
95 ln -s /etc/rc.d/init.d/ossec /etc/rc.d/rc3.d/S97ossec
99 if [ "X${UN}" = "XOpenBSD" -o "X${UN}" = "XNetBSD" -o "X${UN}" = "XFreeBSD" -o "X${UN}" = "XDragonFly" ]; then
100 # Checking for the presence of ossec-control on rc.local
101 grep ossec-control /etc/rc.local > /dev/null 2>&1
103 echo "echo \"${starting}\"" >> /etc/rc.local
104 echo "${INSTALLDIR}/bin/ossec-control start" >> /etc/rc.local
106 echo " - ${systemis} ${NUNAME}."
107 echo " - ${modifiedinit}"
109 elif [ "X${NUNAME}" = "XLinux" ]; then
110 if [ -e "/etc/rc.d/rc.local" ]; then
111 echo " - ${systemis} Linux."
112 echo " - ${modifiedinit}"
114 grep ossec-control /etc/rc.d/rc.local > /dev/null 2>&1
116 echo "echo \"${starting}\"" >> /etc/rc.d/rc.local
117 echo "${INSTALLDIR}/bin/ossec-control start" >> /etc/rc.d/rc.local
120 elif [ -d "/etc/rc.d/init.d" ]; then
121 echo " - ${systemis} Linux (SysV)."
122 echo " - ${modifiedinit}"
123 cp -pr ./src/init/ossec-hids.init /etc/rc.d/init.d/ossec
124 chmod 555 /etc/rc.d/init.d/ossec
125 chown root:ossec /etc/rc.d/init.d/ossec
127 # Taken from Stephen Bunn ossec howto.
128 elif [ -d "/etc/init.d" -a -f "/usr/sbin/update-rc.d" ]; then
129 echo " - ${systemis} Debian (Ubuntu or derivative)."
130 echo " - ${modifiedinit}"
131 cp -pr ./src/init/ossec-hids-debian.init /etc/init.d/ossec
132 chmod +x /etc/init.d/ossec
133 chmod go-w /etc/init.d/ossec
134 chown root:ossec /etc/init.d/ossec
135 update-rc.d ossec defaults > /dev/null 2>&1