|
| 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