-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_apache_modsec.sh
executable file
·56 lines (50 loc) · 1.03 KB
/
install_apache_modsec.sh
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
#!/bin/bash
# /********************************************************************
# HTTP2 Benchmark Modify Server for ModSecurity install Apache modsec
# *********************************************************************/
silent() {
if [[ $debug ]] ; then
"$@"
else
"$@" >/dev/null 2>&1
fi
}
### Tools
echoY() {
echo -e "\033[38;5;148m${1}\033[39m"
}
echoG() {
echo -e "\033[38;5;71m${1}\033[39m"
}
echoR()
{
echo -e "\033[38;5;203m${1}\033[39m"
}
fail_exit(){
echoR "${1}"
}
if [ $# -ne 2 ] ; then
if [ $# -eq 0 ]; then
./modsec.sh "apache"
exit $?
fi
fail_exit_fatal "Needs to be run by modsec.sh"
fi
APADIR="${1}"
OSNAME="${2}"
WD=$(pwd)
install_apacheModSec(){
if [ -x "$APADIR/modules/mod_security2.so" ]; then
echoG "Apache modsecurity module already installed"
return 0
fi
if [ ${OSNAME} = 'centos' ]; then
yum install mod_security -y
else
apt install libapache2-mod-security2
fi
}
main(){
install_apacheModSec
}
main