feat: update Drupal examples to include MODSECURITY CRS plugin URL and specify TCP/UDP protocols in Docker Compose

This commit is contained in:
Théophile Diot 2024-11-20 16:09:40 +01:00
parent 02ae9aa12e
commit 97f9da0c87
No known key found for this signature in database
GPG key ID: FA995104A0BA376A
8 changed files with 12 additions and 27 deletions

View file

@ -18,8 +18,8 @@ services:
- bunkerweb.REVERSE_PROXY_HOST=http://mydrupal
- bunkerweb.LIMIT_REQ_URL_1=/core/install.php
- bunkerweb.LIMIT_REQ_RATE_1=5r/s
- |
CUSTOM_CONF_MODSEC_CRS_drupal=SecAction "id:900130,phase:1,nolog,pass,t:none,setvar:tx.crs_exclusions_drupal=1"
# This is a CRS plugin specific to Drupal
- bunkerweb.MODSECURITY_CRS_PLUGIN_URLS=https://github.com/coreruleset/drupal-rule-exclusions-plugin/archive/refs/tags/v1.0.0.tar.gz
mydb:
image: mariadb:11

View file

@ -1,7 +0,0 @@
SecAction \
"id:900130,\
phase:1,\
nolog,\
pass,\
t:none,\
setvar:tx.crs_exclusions_drupal=1"

View file

@ -3,8 +3,9 @@ services:
image: bunkerity/bunkerweb:1.6.0-beta
container_name: bunkerweb
ports:
- "80:8080"
- "443:8443"
- "80:8080/tcp"
- "443:8443/tcp"
- "443:8443/udp" # for QUIC
environment:
API_WHITELIST_IP: "127.0.0.0/8 10.20.30.0/24"
restart: "unless-stopped"
@ -31,7 +32,7 @@ services:
USE_REVERSE_PROXY: "yes"
REVERSE_PROXY_URL: "/"
REVERSE_PROXY_HOST: "http://mydrupal"
CUSTOM_CONF_MODSEC_CRS_drupal: 'SecAction "id:900130,phase:1,nolog,pass,t:none,setvar:tx.crs_exclusions_drupal=1"'
MODSECURITY_CRS_PLUGIN_URLS: "https://github.com/coreruleset/drupal-rule-exclusions-plugin/archive/refs/tags/v1.0.0.tar.gz" # This is a CRS plugin specific to Drupal
# Once the installation is done, you can remove these lines
LIMIT_REQ_URL_1: "/core/install.php"
LIMIT_REQ_RATE_1: "5r/s"

View file

@ -6,6 +6,8 @@ metadata:
bunkerweb.io/AUTO_LETS_ENCRYPT: "yes"
bunkerweb.io/LIMIT_REQ_URL_1: "/core/install.php"
bunkerweb.io/LIMIT_REQ_RATE_1: "5r/s"
# This is a CRS plugin specific to Drupal
bunkerweb.io/www.example.com_MODSECURITY_CRS_PLUGIN_URLS: "https://github.com/coreruleset/drupal-rule-exclusions-plugin/archive/refs/tags/v1.0.0.tar.gz"
spec:
rules:
- host: www.example.com

View file

@ -22,5 +22,3 @@ chown -R $user:nginx /var/www/html
find /var/www/html -type f -exec chmod 0640 {} \;
find /var/www/html -type d -exec chmod 0750 {} \;
cd "$current_dir" || exit 1
cp -r ./bw-data/configs/* /etc/bunkerweb/configs
chown -R nginx:nginx /etc/bunkerweb/configs

View file

@ -1,13 +0,0 @@
#!/bin/bash
# docker-compose doesn't support assigning labels to configs
# so we need to create the configs with the CLI
# bunkerweb.CONFIG_TYPE accepted values are http, stream, server-http, server-stream, default-server-http, modsec and modsec-crs
# bunkerweb.CONFIG_SITE lets you choose on which web service the config should be applied (MULTISITE mode) and if it's not set, the config will be applied for all services
# more info at https://docs.bunkerweb.io
# remove configs if existing
docker config rm cfg_drupal_modsec_crs
# create configs
docker config create -l bunkerweb.CONFIG_TYPE=modsec-crs -l bunkerweb.CONFIG_SITE=www.example.com cfg_drupal_modsec_crs ./bw-data/configs/modsec-crs/drupal.conf

View file

@ -20,6 +20,8 @@ services:
- bunkerweb.REVERSE_PROXY_HOST=http://mydrupal
- bunkerweb.LIMIT_REQ_URL_1=/core/install.php
- bunkerweb.LIMIT_REQ_RATE_1=5r/s
# This is a CRS plugin specific to Drupal
- bunkerweb.MODSECURITY_CRS_PLUGIN_URLS=https://github.com/coreruleset/drupal-rule-exclusions-plugin/archive/refs/tags/v1.0.0.tar.gz
mydb:
image: mariadb:11

View file

@ -12,3 +12,5 @@ LIMIT_REQ_URL_1=/core/install.php
LIMIT_REQ_RATE_1=5r/s
LOCAL_PHP=/run/php/php-fpm.sock
LOCAL_PHP_PATH=/var/www/html
# This is a CRS plugin specific to Drupal
MODSECURITY_CRS_PLUGIN_URLS=https://github.com/coreruleset/drupal-rule-exclusions-plugin/archive/refs/tags/v1.0.0.tar.gz