Skip to content

Commit b321148

Browse files
committed
Move <MODSEC> to base http {} block in an effort to minimize KNOWN modsec memory leaks.
1 parent c935714 commit b321148

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

docker/rootfs/etc/cont-init.d/97_modsecurity.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ fi
3333
# Enable modsecurity in the server block of :80 and :443
3434
# Can disable this (default) and add the modsec directives in each ___location block
3535
if [ "${MODSEC_ENABLE}" == "1" ] || [ "${MODSEC_ENABLE}" -eq 1 ]; then
36-
log "Enabling modsecurity in server block of port 80 and 443"
37-
sed -i "s|#<MODSEC_ON>|modsecurity on;|g" /etc/nginx/conf.d/default.conf
38-
sed -i "s|#<MODSEC_RULES>|modsecurity_rules_file /etc/nginx/modsec/main.conf;|g" /etc/nginx/conf.d/default.conf
36+
message="Enabling modsecurity in ROOT http block"
37+
sed -i "s|#<MODSEC_ON>|modsecurity on;|g" /etc/nginx/nginx.conf
38+
sed -i "s|#<MODSEC_RULES>|modsecurity_rules_file /etc/nginx/modsec/main.conf;|g" /etc/nginx/nginx.conf
39+
# Enabled modsecurity in the server block of :81 (admin dashboard)
40+
if [ "${MODSEC_ADMIN_PANEL}" == "0" ] || [ "${MODSEC_ADMIN_PANEL}" -eq 0 ]; then
41+
log "${message} and DISABLING in Admin dashboard port 81"
42+
sed -i "s|#<MODSEC_ON>|modsecurity off;|g" /etc/nginx/conf.d/production.conf
43+
else
44+
log "${message} and Admin dashboard port 81"
45+
fi
3946
fi
40-
# Enabled modsecurity in the server block of :81 (admin dashboard)
41-
if [ "${MODSEC_ADMIN_PANEL}" == "1" ] || [ "${MODSEC_ADMIN_PANEL}" -eq 1 ]; then
42-
log "Enabling modsecurity in server block of admin dashboard port 81"
43-
sed -i "s|#<MODSEC_ON>|modsecurity on;|g" /etc/nginx/conf.d/production.conf
44-
sed -i "s|#<MODSEC_RULES>|modsecurity_rules_file /etc/nginx/modsec/main.conf;|g" /etc/nginx/conf.d/production.conf
45-
46-
fi

docker/rootfs/etc/nginx/nginx.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ http {
5656
map $host $forward_scheme {
5757
default http;
5858
}
59-
59+
#<MODSEC_ON>
60+
#<MODSEC_RULES>
6061
# Real IP Determination
6162

6263
# Local subnets:

local-build.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ export BUILD_VERSION=dev
1919
export BUILD_COMMIT=
2020
export BUILD_DATE="$(date '+%Y-%m-%d %T %Z')"
2121
export SSL_CERTS_PATH="/etc/ssl/certs/GTS_Root_R1.pem"
22-
echo -e "${YELLOW}❯❯❯ ${CYAN}Running ${RED}'scripts/frontend-build'${RESET}"
23-
bash ./scripts/frontend-build
24-
echo -e "${YELLOW}❯❯❯ ${CYAN}Completed ${RED}'frontend-build'${RESET}"
25-
# Build
22+
23+
# Build FrontEnd
24+
#echo -e "${YELLOW}❯❯❯ ${CYAN}Running ${RED}'scripts/frontend-build'${RESET}"
25+
#bash ./scripts/frontend-build
26+
#echo -e "${YELLOW}❯❯❯ ${CYAN}Completed ${RED}'frontend-build'${RESET}"
27+
28+
# Build Final Image
2629
echo -e "${BLUE}${CYAN}Building ${RED}LOCAL ${CYAN}Image [${DOCKER_IMAGE}] with tag: ${YELLOW}${BASE_TAG}${CYAN}...${RESET}"
2730
docker build \
28-
\
2931
--build-arg BUILD_VERSION="${BUILD_VERSION:-dev}" \
3032
--build-arg BUILD_COMMIT="${BUILD_COMMIT:-notset}" \
3133
--build-arg BUILD_DATE="${BUILD_DATE}" \

0 commit comments

Comments
 (0)