Skip to content

Commit 7dd25f2

Browse files
committed
first commit
0 parents  commit 7dd25f2

9 files changed

+5661
-0
lines changed

.gitignore

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Object files
2+
*.o
3+
*.ko
4+
*.obj
5+
*.elf
6+
7+
# Precompiled Headers
8+
*.gch
9+
*.pch
10+
11+
# Libraries
12+
*.lib
13+
*.a
14+
*.la
15+
*.lo
16+
17+
# Shared objects (inc. Windows DLLs)
18+
*.dll
19+
*.so
20+
*.so.*
21+
*.dylib
22+
23+
# Executables
24+
*.exe
25+
*.out
26+
*.app
27+
*.i*86
28+
*.x86_64
29+
*.hex
30+
31+
# Debug files
32+
*.dSYM/
33+
*.su

.travis.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
sudo: required
2+
3+
language: c
4+
5+
services:
6+
- docker
7+
8+
before_install:
9+
- docker build -t me2digital/haproxy-waf2 .
10+
11+
script:
12+
- docker run --entrypoint /usr/local/sbin/haproxy --rm me2digital/haproxy-waf2 -vv

Dockerfile

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
FROM centos:latest
2+
3+
# take a look at http://www.lua.org/download.html for
4+
# newer version
5+
6+
ENV HAPROXY_MAJOR=1.8 \
7+
HAPROXY_VERSION=1.8.x \
8+
HAPROXY_MD5=ed84c80cb97852d2aa3161ed16c48a1c \
9+
LUA_VERSION=5.3.4 \
10+
LUA_URL=http://www.lua.org/ftp/lua-5.3.4.tar.gz \
11+
LUA_MD5=53a9c68bcc0eda58bdc2095ad5cdfc63 \
12+
MODDEV_URL=https://github.com/VultureProject/mod_defender.git
13+
14+
# RUN cat /etc/redhat-release
15+
# RUN yum provides "*lib*/libc.a"
16+
17+
COPY containerfiles /
18+
19+
# cyrus-sasl must be added to not remove systemd 8-O strange.
20+
21+
RUN set -x \
22+
&& export buildDeps='pcre-devel openssl-devel gcc make zlib-devel readline-devel openssl patch git apr-devel apr-util-devel libevent-devel libxml2-devel libcurl-devel httpd-devel pcre-devel yajl-devel libstdc++-devel gcc-c++' \
23+
&& yum -y install pcre openssl-libs zlib bind-utils curl iproute tar strace libevent libxml2 libcurl apr apr-util yajl cyrus-sasl libstdc++ ${buildDeps} \
24+
&& curl -sSL ${LUA_URL} -o lua-${LUA_VERSION}.tar.gz \
25+
&& echo "${LUA_MD5} lua-${LUA_VERSION}.tar.gz" | md5sum -c \
26+
&& mkdir -p /usr/src/lua /data \
27+
&& tar -xzf lua-${LUA_VERSION}.tar.gz -C /usr/src/lua --strip-components=1 \
28+
&& rm lua-${LUA_VERSION}.tar.gz \
29+
&& make -C /usr/src/lua linux test install \
30+
&& cd /usr/src \
31+
&& git clone ${MODDEV_URL} \
32+
&& git clone http://git.haproxy.org/git/haproxy.git/ \
33+
&& patch -d /usr/src/haproxy -p 1 -i /patches/0001-MINOR-Add-Mod-Defender-integration-as-contrib.patch \
34+
&& cd /usr/src/haproxy/contrib/mod_defender \
35+
&& make MOD_DEFENDER_SRC=/usr/src/mod_defender \
36+
APACHE2_INC=/usr/include/httpd \
37+
APR_INC=/usr/include/apr-1 \
38+
&& make install \
39+
&& mkdir -p /usr/local/etc/haproxy \
40+
&& mkdir -p /usr/local/etc/haproxy/ssl \
41+
&& mkdir -p /usr/local/etc/haproxy/ssl/cas \
42+
&& mkdir -p /usr/local/etc/haproxy/ssl/crts \
43+
&& cp -R /usr/src/haproxy/examples/errorfiles /usr/local/etc/haproxy/errors \
44+
&& rm -rf /usr/src/[a-z]* /*tar.gz \
45+
&& yum -y autoremove $buildDeps \
46+
&& yum -y clean all
47+
48+
# && openssl dhparam -out /usr/local/etc/haproxy/ssl/dh-param_4096 4096 \
49+
50+
# I know it's not very efficient to copy this files twice but
51+
# I accept this small inefficient
52+
COPY containerfiles /
53+
54+
RUN chmod 555 /container-entrypoint.sh
55+
56+
EXPOSE 13443
57+
58+
ENTRYPOINT ["/container-entrypoint.sh"]
59+
60+
#CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.conf"]
61+
#CMD ["haproxy", "-vv"]
62+
#CMD ["/usr/local/bin/modsecurity","-f","/root/owasp-modsecurity-crs-3.0.0/crs-setup.conf.example"]

Dockerfile.back

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
FROM centos:latest
2+
3+
# take a look at http://www.lua.org/download.html for
4+
# newer version
5+
6+
ENV HAPROXY_MAJOR=1.8 \
7+
HAPROXY_VERSION=1.8.x \
8+
HAPROXY_MD5=ed84c80cb97852d2aa3161ed16c48a1c \
9+
LUA_VERSION=5.3.4 \
10+
LUA_URL=http://www.lua.org/ftp/lua-5.3.4.tar.gz \
11+
LUA_MD5=53a9c68bcc0eda58bdc2095ad5cdfc63 \
12+
MODDEV_URL=https://www.modsecurity.org/tarball/2.9.1/modsecurity-2.9.1.tar.gz \
13+
14+
# RUN cat /etc/redhat-release
15+
# RUN yum provides "*lib*/libc.a"
16+
17+
COPY containerfiles /
18+
19+
# cyrus-sasl must be added to not remove systemd 8-O strange.
20+
21+
RUN set -x \
22+
&& export buildDeps='pcre-devel openssl-devel gcc make zlib-devel readline-devel openssl patch git apr-devel apr-util-devel libevent-devel libxml2-devel libcurl-devel httpd-devel pcre-devel yajl-devel libstdc++-devel' \
23+
&& yum -y install pcre openssl-libs zlib bind-utils curl iproute tar strace libevent libxml2 libcurl apr apr-util yajl cyrus-sasl libstdc++ ${buildDeps} \
24+
&& curl -sSL ${LUA_URL} -o lua-${LUA_VERSION}.tar.gz \
25+
&& echo "${LUA_MD5} lua-${LUA_VERSION}.tar.gz" | md5sum -c \
26+
&& mkdir -p /usr/src/lua /data \
27+
&& tar -xzf lua-${LUA_VERSION}.tar.gz -C /usr/src/lua --strip-components=1 \
28+
&& rm lua-${LUA_VERSION}.tar.gz \
29+
&& make -C /usr/src/lua linux test install \
30+
&& cd /usr/src \
31+
&& git clone https://github.com/VultureProject/mod_defender.git \
32+
&& git clone http://git.haproxy.org/git/haproxy.git/ \
33+
&& make -C /usr/src/haproxy \
34+
TARGET=linux2628 \
35+
USE_PCRE=1 \
36+
USE_OPENSSL=1 \
37+
USE_ZLIB=1 \
38+
USE_LINUX_SPLICE=1 \
39+
USE_TFO=1 \
40+
USE_PCRE_JIT=1 \
41+
USE_LUA=1 \
42+
all \
43+
install-bin \
44+
&& patch -d /usr/src/haproxy -p 1 -i /patches/0001-MINOR-Add-Mod-Defender-integration-as-contrib.patch \
45+
&& cd /usr/src/haproxy/contrib/mod_defender \
46+
&& make MOD_DEFENDER_SRC=/usr/src/mod_defender \
47+
APACHE2_INC=/usr/include/httpd \
48+
APR_INC=/usr/include/apr-1 \
49+
&& make install \
50+
&& mkdir -p /usr/local/etc/haproxy \
51+
&& mkdir -p /usr/local/etc/haproxy/ssl \
52+
&& mkdir -p /usr/local/etc/haproxy/ssl/cas \
53+
&& mkdir -p /usr/local/etc/haproxy/ssl/crts \
54+
&& cp -R /usr/src/haproxy/examples/errorfiles /usr/local/etc/haproxy/errors \
55+
&& rm -rf /usr/src/[a-z]* /*tar.gz \
56+
&& yum -y autoremove $buildDeps \
57+
&& yum -y clean all
58+
59+
# && openssl dhparam -out /usr/local/etc/haproxy/ssl/dh-param_4096 4096 \
60+
61+
# I know it's not very efficient to copy this files twice but
62+
# I accept this small inefficient
63+
COPY containerfiles /
64+
65+
RUN chmod 555 /container-entrypoint.sh
66+
67+
EXPOSE 13443
68+
69+
ENTRYPOINT ["/container-entrypoint.sh"]
70+
71+
#CMD ["haproxy", "-f", "/usr/local/etc/haproxy/haproxy.conf"]
72+
#CMD ["haproxy", "-vv"]
73+
#CMD ["/usr/local/bin/modsecurity","-f","/root/owasp-modsecurity-crs-3.0.0/crs-setup.conf.example"]

0 commit comments

Comments
 (0)