-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Felipe Zipitria <[email protected]>
- Loading branch information
Showing
14 changed files
with
132 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v*-{apache,nginx}/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
VERSIONS = v3.3.0 | ||
SERVERS = apache nginx | ||
TAG = owasp/modsecurity-crs | ||
|
||
TARGETS = $(foreach server,$(SERVERS),$(foreach version,$(VERSIONS),$(addsuffix -$(server),$(version)))) | ||
IMAGES = $(addprefix image/, $(TARGETS)) | ||
|
||
.PHONY: clean | ||
|
||
all: $(TARGETS) $(IMAGES) | ||
|
||
v%: $(addsufix /Dockerfile, $(SERVERS)) | ||
./src/release.sh "v$*" | ||
|
||
image/%: $(TARGETS) | ||
docker build --tag $(TAG):$* -f $*/Dockerfile . | ||
|
||
clean: | ||
rm -rfv v* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,7 @@ FROM owasp/modsecurity:2 | |
|
||
LABEL maintainer="Chaim Sanders <[email protected]>" | ||
|
||
ARG COMMIT=v3.3/dev | ||
ARG BRANCH=v3.3/dev | ||
ARG REPO=coreruleset/coreruleset | ||
ARG RELEASE=%%RELEASE%% | ||
|
||
ENV PARANOIA=1 \ | ||
ANOMALY_INBOUND=5 \ | ||
|
@@ -28,23 +26,25 @@ ENV PARANOIA=1 \ | |
|
||
COPY src/etc/modsecurity.d/*.conf /etc/modsecurity.d/ | ||
COPY src/opt/modsecurity/activate-rules.sh /opt/modsecurity/ | ||
COPY 3.3-apache/conf/extra/*.conf /usr/local/apache2/conf/extra/ | ||
COPY 3.3-apache/docker-entrypoint.sh / | ||
COPY apache/conf/extra/*.conf /usr/local/apache2/conf/extra/ | ||
COPY apache/docker-entrypoint.sh / | ||
|
||
# Change default shell to bash | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
# hadolint ignore=DL3008,SC2016 | ||
RUN apt-get update \ | ||
&& apt-get -y install \ | ||
&& apt-get -y install --no-install-recommends \ | ||
ca-certificates \ | ||
git \ | ||
curl \ | ||
iproute2 \ | ||
&& mkdir /opt/owasp-crs \ | ||
&& cd /opt/owasp-crs \ | ||
&& git init \ | ||
&& git remote add origin https://github.com/${REPO} \ | ||
&& git fetch --depth 1 origin ${BRANCH} \ | ||
&& git checkout ${COMMIT} \ | ||
&& mv -v crs-setup.conf.example crs-setup.conf \ | ||
&& curl -SL https://github.com/coreruleset/coreruleset/archive/${RELEASE}.tar.gz \ | ||
| tar -zxf - --strip-components=1 -C /opt/owasp-crs \ | ||
&& mv -v /opt/owasp-crs/crs-setup.conf.example /opt/owasp-crs/crs-setup.conf \ | ||
&& ln -sv /opt/owasp-crs /etc/modsecurity.d/ \ | ||
&& sed -i -E 's/(Listen) [0-9]+/\1 ${PORT}/g' /usr/local/apache2/conf/httpd.conf | ||
&& sed -i -E 's/(Listen) [0-9]+/\1 ${PORT}/g' /usr/local/apache2/conf/httpd.conf \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
CMD ["apachectl", "-D", "FOREGROUND"] |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,7 @@ FROM owasp/modsecurity:3 | |
|
||
LABEL maintainer="Chaim Sanders <[email protected]>" | ||
|
||
ARG COMMIT=v3.3/dev | ||
ARG BRANCH=v3.3/dev | ||
ARG REPO=coreruleset/coreruleset | ||
ARG RELEASE=%%RELEASE%% | ||
|
||
ENV PARANOIA=1 \ | ||
ANOMALY_INBOUND=5 \ | ||
|
@@ -25,25 +23,26 @@ ENV PARANOIA=1 \ | |
MODSEC_PCRE_MATCH_LIMIT=100000 \ | ||
MODSEC_PCRE_MATCH_LIMIT_RECURSION=100000 | ||
|
||
COPY 3.3-nginx/docker-entrypoint.sh / | ||
COPY 3.3-nginx/nginx.conf /etc/nginx/nginx.conf | ||
COPY src/opt/modsecurity/activate-rules.sh /opt/modsecurity/ | ||
COPY src/etc/modsecurity.d/*.conf /etc/modsecurity.d/ | ||
COPY nginx/docker-entrypoint.sh / | ||
COPY nginx/nginx.conf /etc/nginx/nginx.conf | ||
|
||
# Change default shell to bash | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
# hadolint ignore=DL3008,SC2016 | ||
RUN apt-get update \ | ||
&& apt-get -y install \ | ||
&& apt-get -y install --no-install-recommends \ | ||
ca-certificates \ | ||
git \ | ||
curl \ | ||
iproute2 \ | ||
moreutils \ | ||
&& mkdir /opt/owasp-crs \ | ||
&& cd /opt/owasp-crs \ | ||
&& git init \ | ||
&& git remote add origin https://github.com/${REPO} \ | ||
&& git fetch --depth 1 origin ${BRANCH} \ | ||
&& git checkout ${COMMIT} \ | ||
&& mv -v crs-setup.conf.example crs-setup.conf \ | ||
&& ln -sv /opt/owasp-crs /etc/modsecurity.d/ | ||
&& curl -SL https://github.com/coreruleset/coreruleset/archive/${RELEASE}.tar.gz \ | ||
| tar -zxf - --strip-components=1 -C /opt/owasp-crs \ | ||
&& mv -v /opt/owasp-crs/crs-setup.conf.example /opt/owasp-crs/crs-setup.conf \ | ||
&& ln -sv /opt/owasp-crs /etc/modsecurity.d/ \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
CMD ["nginx", "-g", "daemon off;"] |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# Release will use master branch as stable | ||
|
||
set -e | ||
|
||
target="$1" | ||
|
||
if [ -z "$target" ]; then | ||
echo "usage: $0 vX.Y-(apache|nginx)" >&2 | ||
exit 1 | ||
fi | ||
|
||
# relases might be release candidates, which are named with '-rcX' | ||
release="${target%-*}" | ||
server="${target#*-}" | ||
server_no_rc="${server#*-}" | ||
|
||
cd "$(dirname "$0")/.." | ||
mkdir -p "${target}" | ||
|
||
|
||
sed -e "s,%%RELEASE%%,${release},g" \ | ||
"${server_no_rc}/Dockerfile" > "${target}/Dockerfile" | ||
|