-
Notifications
You must be signed in to change notification settings - Fork 0
/
unconfig_apache_modsec.sh
executable file
·62 lines (55 loc) · 1.24 KB
/
unconfig_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
57
58
59
60
61
62
#!/bin/bash
# /********************************************************************
# HTTP2 Benchmark Modify Server for ModSecurity unconfig Nginx 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}"
}
fail_exit_fatal(){
echoR "${1}"
if [ $# -gt 1 ] ; then
popd "+${2}"
fi
exit 1
}
if [ $# -eq 0 ]; then
./modsec_ctl.sh unconfig apache
exit $?
elif [ $# -ne 3 ] ; then
fail_exit "Needs to be run by uninstall_modsec.sh"
exit 1
fi
TEMP_DIR="${1}"
OWASP_DIR="${2}"
APADIR="${3}"
unconfig_apacheModSec(){
silent grep "http2Benchmark" $APADIR/conf.d/mod_security.conf
if [ $? -ne 0 ] ; then
echoG "Apache already unconfigured for modsecurity"
return 0
fi
if [ -f $APADIR/conf.d/mod_security.conf.nomodsec ] ; then
cp -f $APADIR/conf.d/mod_security.conf.nomodsec $APADIR/conf.d/mod_security.conf
else
rm $APADIR/conf.d/mod_security.conf
fi
}
unconfig_apacheModSec