forked from coreruleset/modsecurity-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
51 lines (43 loc) · 1.32 KB
/
Dockerfile
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
FROM fedora:25
MAINTAINER Chaim Sanders [email protected]
# Install Prereqs
RUN dnf -y update && \
dnf install -y httpd \
httpd-devel \
lua-devel \
pcre-devel \
libxml2-devel \
libcurl-devel \
libtool \
yajl-devel \
git \
unzip \
ssdeep \
gcc \
wget && \
dnf clean all
# Download ModSecurity
RUN mkdir -p /usr/share/ModSecurity && \
cd /usr/share/ModSecurity && \
wget --quiet "https://github.com/SpiderLabs/ModSecurity/releases/download/v2.9.2/modsecurity-2.9.2.tar.gz" && \
tar -xvzf modsecurity-2.9.2.tar.gz
# Install ModSecurity
RUN cd /usr/share/ModSecurity/modsecurity-2.9.2/ && \
sh autogen.sh && \
./configure && \
make && \
make install && \
make clean
# Move Files
RUN cd /usr/share/ModSecurity/modsecurity-2.9.2/ && \
mkdir -p /etc/httpd/modsecurity.d && \
mv modsecurity.conf-recommended /etc/httpd/modsecurity.d/modsecurity.conf && \
mv unicode.mapping /etc/httpd/modsecurity.d/
# Setup Config
Run printf "LoadModule security2_module modules/mod_security2.so\nInclude modsecurity.d/*.conf" > /etc/httpd/conf.modules.d/10-modsecurty.conf && \
echo "ServerName localhost" > /etc/httpd/conf.d/ServerName.conf
# Remove Apache defaults
Run rm -f /etc/httpd/conf.d/welcome.conf && \
printf "hello world" > /var/www/html/index.html
EXPOSE 80
CMD ["httpd", "-D", "FOREGROUND"]