aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ossec-hids/alpine-install-server.patch
blob: 3399c2b0e2a3ea40819a3bbc77d9320f293ca916 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
diff --git a/src/InstallServer.sh b/src/InstallServer.sh
index e619d99..307ada7 100755
--- a/src/InstallServer.sh
+++ b/src/InstallServer.sh
@@ -1,37 +1,14 @@
 #!/bin/sh
 
-
-# Checking if it is executed from the right place
-LOCATION=./LOCATION
-ls ${LOCATION} > /dev/null 2>&1
-if [ $? != 0 ]; then
-    echo "Cannot execute. Wrong directory"
-    exit 1;
-fi
-
-# Getting any argument
-if [ "X$1" = "Xlocal" ]; then
-    # Setting local install
-    LOCAL="local"
-fi
-    
 UNAME=`uname`;
-
-# Getting default variables
-DIR=`grep DIR ${LOCATION} | cut -f2 -d\"`
-GROUP="ossec"
-USER="ossec"
-USER_MAIL="ossecm"
-USER_REM="ossecr"
+DIR=$5/var/ossec
+# Need this to have $pkgusers and $pkggroups being passed from APKBUILD
+GROUP="$4"
+USER="$1"
+USER_MAIL="$2"
+USER_REM="$3"
 subdirs="logs logs/archives logs/alerts logs/firewall bin stats rules queue queue/alerts queue/ossec queue/fts queue/syscheck queue/rootcheck queue/diff queue/agent-info queue/agentless queue/rids tmp var var/run etc etc/shared active-response active-response/bin agentless .ssh"
 
-# ${DIR} must be set 
-if [ "X${DIR}" = "X" ]; then
-    echo "Error building OSSEC HIDS."
-    exit 1;
-fi    
-
-    
 # Creating root directory
 ls ${DIR} > /dev/null 2>&1    
 if [ $? != 0 ]; then mkdir -m 700 -p ${DIR}; fi
@@ -42,78 +19,6 @@ if [ $? != 0 ]; then
 fi
 
 
-# Creating groups/users
-if [ "$UNAME" = "FreeBSD" -o "$UNAME" = "DragonFly" ]; then
-    grep "^${USER_REM}" /etc/passwd > /dev/null 2>&1
-    if [ ! $? = 0 ]; then
-    /usr/sbin/pw groupadd ${GROUP}
-	/usr/sbin/pw useradd ${USER} -d ${DIR} -s /sbin/nologin -g ${GROUP}
-	/usr/sbin/pw useradd ${USER_MAIL} -d ${DIR} -s /sbin/nologin -g ${GROUP}
-	/usr/sbin/pw useradd ${USER_REM} -d ${DIR} -s /sbin/nologin -g ${GROUP}
-    fi
-
-elif [ "$UNAME" = "SunOS" ]; then
-    grep "^${USER_REM}" /etc/passwd > /dev/null 2>&1
-    if [ ! $? = 0 ]; then
-    /usr/sbin/groupadd ${GROUP}
-    /usr/sbin/useradd -d ${DIR} -s /bin/false -g ${GROUP} ${USER}
-    /usr/sbin/useradd -d ${DIR} -s /bin/false -g ${GROUP} ${USER_MAIL}
-    /usr/sbin/useradd -d ${DIR} -s /bin/false -g ${GROUP} ${USER_REM}
-    fi
-
-elif [ "$UNAME" = "AIX" ]; then
-    AIXSH=""
-    ls -la /bin/false > /dev/null 2>&1
-    if [ $? = 0 ]; then
-        AIXSH="-s /bin/false"
-    fi
-
-    grep "^${USER_REM}" /etc/passwd > /dev/null 2>&1
-    if [ ! $? = 0 ]; then
-    /usr/bin/mkgroup ${GROUP}
-    /usr/sbin/useradd -d ${DIR} ${AIXSH} -g ${GROUP} ${USER}
-    /usr/sbin/useradd -d ${DIR} ${AIXSH} -g ${GROUP} ${USER_MAIL}
-    /usr/sbin/useradd -d ${DIR} ${AIXSH} -g ${GROUP} ${USER_REM}
-    fi
-
-# Thanks Chuck L. for the mac addusers    
-elif [ "$UNAME" = "Darwin" ]; then
-    id -u ${USER} > /dev/null 2>&1
-    if [ ! $? = 0 ]; then
-
-        # Creating for <= 10.4
-        /usr/bin/sw_vers 2>/dev/null| grep "ProductVersion" | grep -E "10.2.|10.3|10.4" > /dev/null 2>&1
-        if [ $? = 0 ]; then
-            chmod +x ./init/darwin-addusers.pl
-            ./init/darwin-addusers.pl    
-        else
-            chmod +x ./init/osx105-addusers.sh
-            ./init/osx105-addusers.sh
-        fi        
-    fi    
-else
-    grep "^${USER_REM}" /etc/passwd > /dev/null 2>&1
-    if [ ! $? = 0 ]; then
-	/usr/sbin/groupadd ${GROUP}
-
-    # We first check if /sbin/nologin is present. If it is not,
-    # we look for bin/false. If none of them is present, we
-    # just stick with nologin (no need to fail the install for that).
-    OSMYSHELL="/sbin/nologin"
-    ls -la ${OSMYSHELL} > /dev/null 2>&1
-    if [ ! $? = 0 ]; then
-        ls -la /bin/false > /dev/null 2>&1
-        if [ $? = 0 ]; then
-            OSMYSHELL="/bin/false"
-        fi    
-    fi    
-	/usr/sbin/useradd -d ${DIR} -s ${OSMYSHELL} -g ${GROUP} ${USER}
-	/usr/sbin/useradd -d ${DIR} -s ${OSMYSHELL} -g ${GROUP} ${USER_MAIL}
-	/usr/sbin/useradd -d ${DIR} -s ${OSMYSHELL} -g ${GROUP} ${USER_REM}
-    fi
-fi
-
-
 # Creating sub directories
 for i in ${subdirs}; do
     ls ${DIR}/${i} > /dev/null 2>&1
@@ -221,13 +126,6 @@ if [ $? = 0 ]; then
     chown root:${GROUP} ${DIR}/etc/localtime 
 fi
 
-# Solaris Needs some extra files
-if [ "$UNAME" = "SunOS" ]; then
-    mkdir -p ${DIR}/usr/share/lib/zoneinfo/
-    chmod -R 550 ${DIR}/usr/
-    cp -pr /usr/share/lib/zoneinfo/* ${DIR}/usr/share/lib/zoneinfo/
-fi
-
 ls /etc/TIMEZONE > /dev/null 2>&1
 if [ $? = 0 ]; then
     cp -p /etc/TIMEZONE ${DIR}/etc/;
@@ -263,13 +161,6 @@ cp -pr ../contrib/util.sh ${DIR}/bin/
 chown root:${GROUP} ${DIR}/bin/util.sh
 chmod +x ${DIR}/bin/util.sh
 
-# Local install chosen
-if [ "X$LOCAL" = "Xlocal" ]; then
-    cp -pr ./init/ossec-local.sh ${DIR}/bin/ossec-control
-else    
-    cp -pr ./init/ossec-server.sh ${DIR}/bin/ossec-control
-fi
-
 # Moving the decoders/internal_conf file.
 cp -pr ../etc/decoder.xml ${DIR}/etc/
 
@@ -281,7 +172,6 @@ cp -pr ../etc/client.keys ${DIR}/etc/ > /dev/null 2>&1
 # Copying agentless files.
 cp -pr agentlessd/scripts/* ${DIR}/agentless/
 
-
 # Backup currently internal_options file.
 ls ${DIR}/etc/internal_options.conf > /dev/null 2>&1
 if [ $? = 0 ]; then