diff --git a/misc/dev/configs/server-http/hello.conf b/misc/dev/configs/server-http/hello.conf new file mode 100755 index 000000000..4a6b715d1 --- /dev/null +++ b/misc/dev/configs/server-http/hello.conf @@ -0,0 +1,6 @@ +location /hello { + default_type 'text/plain'; + content_by_lua_block { + ngx.say('Hello World!') + } +} diff --git a/misc/dev/docker-compose.autoconf.misc.yml b/misc/dev/docker-compose.autoconf.misc.yml new file mode 100644 index 000000000..9884a8adf --- /dev/null +++ b/misc/dev/docker-compose.autoconf.misc.yml @@ -0,0 +1,131 @@ +x-env: &env + DATABASE_URI: "mariadb+pymysql://bunkerweb:secret@bw-db:3306/db" + DOCKER_HOST: "tcp://bw-docker:2375" + AUTOCONF_MODE: "yes" + LOG_LEVEL: "debug" + +services: + bunkerweb: + build: + context: ../.. + dockerfile: ./src/bw/Dockerfile + ports: + - 80:8080 + - 443:8443 + labels: + - "bunkerweb.INSTANCE=yes" + environment: + - SERVER_NAME= + - MULTISITE=yes + - API_WHITELIST_IP=127.0.0.0/24 10.20.30.0/24 + - AUTOCONF_MODE=yes + - USE_BUNKERNET=no + - USE_BLACKLIST=no + - USE_WHITELIST=no + - SEND_ANONYMOUS_REPORT=no + - LOG_LEVEL=info + - SERVE_FILES=no + - DISABLE_DEFAULT_SERVER=yes + - USE_CLIENT_CACHE=yes + - USE_GZIP=yes + - EXTERNAL_PLUGIN_URLS=https://github.com/bunkerity/bunkerweb-plugins/archive/refs/heads/dev.zip + - CUSTOM_CONF_MODSEC_CRS_reqbody-rule=SecRuleRemoveById 200002 + networks: + bw-universe: + aliases: + - bunkerweb + bw-services: + aliases: + - bunkerweb + + bw-autoconf: + build: + context: ../.. + dockerfile: ./src/autoconf/Dockerfile + depends_on: + - bunkerweb + - bw-docker + environment: + <<: *env + networks: + bw-universe: + aliases: + - bw-autoconf + bw-docker: + aliases: + - bw-autoconf + + bw-scheduler: + build: + context: ../.. + dockerfile: ./src/scheduler/Dockerfile + depends_on: + - bunkerweb + - bw-docker + volumes: + - bw-data:/data + - ./configs/server-http/hello.conf:/data/configs/server-http/hello.conf:ro + environment: + <<: *env + networks: + bw-universe: + aliases: + - bw-scheduler + bw-docker: + aliases: + - bw-scheduler + + bw-docker: + image: tecnativa/docker-socket-proxy:nightly + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + environment: + - CONTAINERS=1 + - LOG_LEVEL=warning + networks: + bw-docker: + aliases: + - bw-docker + + bw-db: + image: mariadb:11 + environment: + - MYSQL_RANDOM_ROOT_PASSWORD=yes + - MYSQL_DATABASE=db + - MYSQL_USER=bunkerweb + - MYSQL_PASSWORD=secret + volumes: + - bw-db:/var/lib/mysql + networks: + bw-docker: + aliases: + - bw-db + + app1: + image: nginxdemos/nginx-hello + networks: + bw-services: + aliases: + - app1 + labels: + - "bunkerweb.SERVER_NAME=app1.example.com" + - "bunkerweb.USE_REVERSE_PROXY=yes" + - "bunkerweb.REVERSE_PROXY_URL=/" + - "bunkerweb.REVERSE_PROXY_HOST=http://app1:8080" + - bunkerweb.CUSTOM_CONF_MODSEC_CRS_ip-host=SecRuleRemoveById 920350 + +volumes: + bw-data: + bw-db: + +networks: + bw-universe: + name: bw-universe + ipam: + driver: default + config: + - subnet: 10.20.30.0/24 + bw-services: + name: bw-services + bw-docker: + name: bw-docker diff --git a/misc/dev/docker-compose.autoconf.ui.misc.yml b/misc/dev/docker-compose.autoconf.ui.misc.yml new file mode 100644 index 000000000..1c00a2f88 --- /dev/null +++ b/misc/dev/docker-compose.autoconf.ui.misc.yml @@ -0,0 +1,166 @@ +x-env: &env + DATABASE_URI: "mariadb+pymysql://bunkerweb:secret@bw-db:3306/db" + DOCKER_HOST: "tcp://bw-docker:2375" + AUTOCONF_MODE: "yes" + LOG_LEVEL: "debug" + +services: + bunkerweb: + build: + context: ../.. + dockerfile: ./src/bw/Dockerfile + ports: + - 80:8080 + - 443:8443 + labels: + - "bunkerweb.INSTANCE=yes" + environment: + - SERVER_NAME= + - MULTISITE=yes + - API_WHITELIST_IP=127.0.0.0/24 10.20.30.0/24 + - AUTOCONF_MODE=yes + - USE_BUNKERNET=no + - USE_BLACKLIST=no + - USE_WHITELIST=no + - SEND_ANONYMOUS_REPORT=no + - LOG_LEVEL=info + - SERVE_FILES=no + - DISABLE_DEFAULT_SERVER=yes + - USE_CLIENT_CACHE=yes + - USE_GZIP=yes + - EXTERNAL_PLUGIN_URLS=https://github.com/bunkerity/bunkerweb-plugins/archive/refs/heads/dev.zip + - CUSTOM_CONF_MODSEC_CRS_reqbody-rule=SecRuleRemoveById 200002 + networks: + bw-universe: + aliases: + - bunkerweb + bw-services: + aliases: + - bunkerweb + + bw-autoconf: + build: + context: ../.. + dockerfile: ./src/autoconf/Dockerfile + depends_on: + - bunkerweb + - bw-docker + environment: + <<: *env + networks: + bw-universe: + aliases: + - bw-autoconf + bw-docker: + aliases: + - bw-autoconf + + bw-scheduler: + build: + context: ../.. + dockerfile: ./src/scheduler/Dockerfile + depends_on: + - bunkerweb + - bw-docker + volumes: + - bw-data:/data + - ./configs/server-http/hello.conf:/data/configs/server-http/hello.conf:ro + environment: + <<: *env + networks: + bw-universe: + aliases: + - bw-scheduler + bw-docker: + aliases: + - bw-scheduler + + bw-docker: + image: tecnativa/docker-socket-proxy:nightly + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + environment: + - CONTAINERS=1 + - LOG_LEVEL=warning + networks: + bw-docker: + aliases: + - bw-docker + + bw-ui: + build: + context: ../.. + dockerfile: ./src/ui/Dockerfile + command: python -m flask --app main:app run --host=0.0.0.0 --port=7000 + depends_on: + - bw-docker + volumes: + - ../../src/ui/src:/usr/share/bunkerweb/ui/src:ro + - ../../src/ui/static:/usr/share/bunkerweb/ui/static:ro + - ../../src/ui/templates:/usr/share/bunkerweb/ui/templates:ro + - ../../src/ui/main.py:/usr/share/bunkerweb/ui/main.py:ro + - ../../src/ui/utils.py:/usr/share/bunkerweb/ui/utils.py:ro + environment: + <<: *env + ADMIN_USERNAME: "admin" + ADMIN_PASSWORD: "P@ssw0rd" + FLASK_APP: "main.py" + FLASK_DEBUG: "1" + FLASK_ENV: "development" + networks: + bw-universe: + aliases: + - bw-ui + bw-docker: + aliases: + - bw-ui + labels: + - "bunkerweb.SERVER_NAME=www.example.com" + - "bunkerweb.USE_UI=yes" + - "bunkerweb.USE_REVERSE_PROXY=yes" + - "bunkerweb.REVERSE_PROXY_URL=/admin" + - "bunkerweb.REVERSE_PROXY_HOST=http://bw-ui:7000" + - "bunkerweb.INTERCEPTED_ERROR_CODES=400 404 405 413 429 500 501 502 503 504" + - bunkerweb.CUSTOM_CONF_MODSEC_CRS_ip-host=SecRuleRemoveById 920350 + + bw-db: + image: mariadb:11 + environment: + - MYSQL_RANDOM_ROOT_PASSWORD=yes + - MYSQL_DATABASE=db + - MYSQL_USER=bunkerweb + - MYSQL_PASSWORD=secret + volumes: + - bw-db:/var/lib/mysql + networks: + bw-docker: + aliases: + - bw-db + + app1: + image: nginxdemos/nginx-hello + networks: + bw-services: + aliases: + - app1 + labels: + - "bunkerweb.SERVER_NAME=app1.example.com" + - "bunkerweb.USE_REVERSE_PROXY=yes" + - "bunkerweb.REVERSE_PROXY_URL=/" + - "bunkerweb.REVERSE_PROXY_HOST=http://app1:8080" + +volumes: + bw-data: + bw-db: + +networks: + bw-universe: + name: bw-universe + ipam: + driver: default + config: + - subnet: 10.20.30.0/24 + bw-services: + name: bw-services + bw-docker: + name: bw-docker diff --git a/misc/dev/docker-compose.misc.yml b/misc/dev/docker-compose.misc.yml new file mode 100644 index 000000000..98bba8db8 --- /dev/null +++ b/misc/dev/docker-compose.misc.yml @@ -0,0 +1,89 @@ +services: + bunkerweb: + build: + context: ../.. + dockerfile: ./src/bw/Dockerfile + ports: + - 80:8080 + - 443:8443 + labels: + - "bunkerweb.INSTANCE=yes" + environment: + - SERVER_NAME=app1.example.com + - API_WHITELIST_IP=127.0.0.0/24 10.20.30.0/24 + - USE_BUNKERNET=no + - USE_BLACKLIST=no + - USE_WHITELIST=no + - SEND_ANONYMOUS_REPORT=no + - LOG_LEVEL=info + - SERVE_FILES=no + - DISABLE_DEFAULT_SERVER=yes + - USE_CLIENT_CACHE=yes + - USE_GZIP=yes + - USE_REVERSE_PROXY=yes + - REVERSE_PROXY_URL=/ + - REVERSE_PROXY_HOST=http://app1:8080 + - EXTERNAL_PLUGIN_URLS=https://github.com/bunkerity/bunkerweb-plugins/archive/refs/heads/dev.zip + - CUSTOM_CONF_MODSEC_CRS_reqbody-suppress=SecRuleRemoveById 200002 + networks: + bw-universe: + aliases: + - bunkerweb + bw-services: + aliases: + - bunkerweb + + bw-scheduler: + build: + context: ../.. + dockerfile: ./src/scheduler/Dockerfile + depends_on: + - bunkerweb + - bw-docker + volumes: + - bw-data:/data + - ./configs/server-http/hello.conf:/data/configs/server-http/hello.conf:ro + environment: + - DOCKER_HOST=tcp://bw-docker:2375 + - LOG_LEVEL=debug + networks: + bw-universe: + aliases: + - bw-scheduler + bw-docker: + aliases: + - bw-scheduler + + bw-docker: + image: tecnativa/docker-socket-proxy:nightly + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + environment: + - CONTAINERS=1 + - LOG_LEVEL=warning + networks: + bw-docker: + aliases: + - bw-docker + + app1: + image: nginxdemos/nginx-hello + networks: + bw-services: + aliases: + - app1 + +volumes: + bw-data: + +networks: + bw-universe: + name: bw-universe + ipam: + driver: default + config: + - subnet: 10.20.30.0/24 + bw-services: + name: bw-services + bw-docker: + name: bw-docker diff --git a/misc/dev/docker-compose.ui.misc.yml b/misc/dev/docker-compose.ui.misc.yml new file mode 100644 index 000000000..aef1e7d4d --- /dev/null +++ b/misc/dev/docker-compose.ui.misc.yml @@ -0,0 +1,143 @@ +x-env: &env + DATABASE_URI: "mariadb+pymysql://bunkerweb:secret@bw-db:3306/db" + DOCKER_HOST: "tcp://bw-docker:2375" + LOG_LEVEL: "debug" + +services: + bunkerweb: + build: + context: ../.. + dockerfile: ./src/bw/Dockerfile + ports: + - 80:8080 + - 443:8443 + labels: + - "bunkerweb.INSTANCE=yes" + environment: + - SERVER_NAME=www.example.com app1.example.com + - MULTISITE=yes + - API_WHITELIST_IP=127.0.0.0/24 10.20.30.0/24 + - USE_BUNKERNET=no + - USE_BLACKLIST=no + - USE_WHITELIST=no + - SEND_ANONYMOUS_REPORT=no + - LOG_LEVEL=info + - SERVE_FILES=no + - DISABLE_DEFAULT_SERVER=yes + - USE_CLIENT_CACHE=yes + - USE_GZIP=yes + - EXTERNAL_PLUGIN_URLS=https://github.com/bunkerity/bunkerweb-plugins/archive/refs/heads/dev.zip + - CUSTOM_CONF_MODSEC_CRS_reqbody-suppress=SecRuleRemoveById 200002 + - www.example.com_USE_UI=yes + - www.example.com_USE_REVERSE_PROXY=yes + - www.example.com_REVERSE_PROXY_URL=/admin + - www.example.com_REVERSE_PROXY_HOST=http://bw-ui:7000 + - www.example.com_INTERCEPTED_ERROR_CODES=400 404 405 413 429 500 501 502 503 504 + - www.example.com_CUSTOM_CONF_MODSEC_CRS_ip-host=SecRuleRemoveById 920350 + - app1.example.com_USE_REVERSE_PROXY=yes + - app1.example.com_REVERSE_PROXY_URL=/ + - app1.example.com_REVERSE_PROXY_HOST=http://app1:8080 + networks: + bw-universe: + aliases: + - bunkerweb + bw-services: + aliases: + - bunkerweb + + bw-scheduler: + build: + context: ../.. + dockerfile: ./src/scheduler/Dockerfile + depends_on: + - bunkerweb + - bw-docker + volumes: + - bw-data:/data + - ./configs/server-http/hello.conf:/data/configs/server-http/hello.conf:ro + environment: + <<: *env + networks: + bw-universe: + aliases: + - bw-scheduler + bw-docker: + aliases: + - bw-scheduler + + bw-docker: + image: tecnativa/docker-socket-proxy:nightly + volumes: + - /var/run/docker.sock:/var/run/docker.sock:ro + environment: + - CONTAINERS=1 + - LOG_LEVEL=warning + networks: + bw-docker: + aliases: + - bw-docker + + bw-ui: + build: + context: ../.. + dockerfile: ./src/ui/Dockerfile + command: python -m flask --app main:app run --host=0.0.0.0 --port=7000 + depends_on: + - bw-docker + volumes: + - ../../src/ui/src:/usr/share/bunkerweb/ui/src:ro + - ../../src/ui/static:/usr/share/bunkerweb/ui/static:ro + - ../../src/ui/templates:/usr/share/bunkerweb/ui/templates:ro + - ../../src/ui/main.py:/usr/share/bunkerweb/ui/main.py:ro + - ../../src/ui/utils.py:/usr/share/bunkerweb/ui/utils.py:ro + environment: + <<: *env + ADMIN_USERNAME: "admin" + ADMIN_PASSWORD: "P@ssw0rd" + FLASK_APP: "main.py" + FLASK_DEBUG: "1" + FLASK_ENV: "development" + networks: + bw-universe: + aliases: + - bw-ui + bw-docker: + aliases: + - bw-ui + + bw-db: + image: mariadb:11 + environment: + - MYSQL_RANDOM_ROOT_PASSWORD=yes + - MYSQL_DATABASE=db + - MYSQL_USER=bunkerweb + - MYSQL_PASSWORD=secret + volumes: + - bw-db:/var/lib/mysql + networks: + bw-docker: + aliases: + - bw-db + + app1: + image: nginxdemos/nginx-hello + networks: + bw-services: + aliases: + - app1 + +volumes: + bw-data: + bw-db: + +networks: + bw-universe: + name: bw-universe + ipam: + driver: default + config: + - subnet: 10.20.30.0/24 + bw-services: + name: bw-services + bw-docker: + name: bw-docker diff --git a/misc/dev/docker-compose.docker.ui.yml b/misc/dev/docker-compose.ui.yml similarity index 100% rename from misc/dev/docker-compose.docker.ui.yml rename to misc/dev/docker-compose.ui.yml diff --git a/misc/dev/docker-compose.docker.wizard.yml b/misc/dev/docker-compose.wizard.yml similarity index 100% rename from misc/dev/docker-compose.docker.wizard.yml rename to misc/dev/docker-compose.wizard.yml diff --git a/misc/dev/docker-compose.docker.yml b/misc/dev/docker-compose.yml similarity index 100% rename from misc/dev/docker-compose.docker.yml rename to misc/dev/docker-compose.yml diff --git a/misc/dev/ui.env b/misc/dev/ui.env new file mode 100644 index 000000000..c7ca9f56e --- /dev/null +++ b/misc/dev/ui.env @@ -0,0 +1,2 @@ +ADMIN_USERNAME=admin +ADMIN_PASSWORD=P@ssw0rd diff --git a/misc/dev/variables.env b/misc/dev/variables.env new file mode 100644 index 000000000..a2ef9fbb2 --- /dev/null +++ b/misc/dev/variables.env @@ -0,0 +1,9 @@ +SERVER_NAME=www.example.com +HTTP_PORT=80 +HTTPS_PORT=443 +DNS_RESOLVERS=9.9.9.9 8.8.8.8 8.8.4.4 +API_LISTEN_IP=127.0.0.1 +USE_BUNKERNET=no +USE_BLACKLIST=no +SEND_ANONYMOUS_REPORT=no +LOG_LEVEL=debug diff --git a/misc/dev/variables.misc.env b/misc/dev/variables.misc.env new file mode 100644 index 000000000..321492724 --- /dev/null +++ b/misc/dev/variables.misc.env @@ -0,0 +1,11 @@ +# For the custom configuration, use the file at misc/dev/configs/server-http/hello.conf +SERVER_NAME=www.example.com +HTTP_PORT=80 +HTTPS_PORT=443 +DNS_RESOLVERS=9.9.9.9 8.8.8.8 8.8.4.4 +API_LISTEN_IP=127.0.0.1 +USE_BUNKERNET=no +USE_BLACKLIST=no +SEND_ANONYMOUS_REPORT=no +LOG_LEVEL=debug +EXTERNAL_PLUGIN_URLS=https://github.com/bunkerity/bunkerweb-plugins/archive/refs/heads/dev.zip diff --git a/misc/dev/variables.ui copy.env b/misc/dev/variables.ui copy.env new file mode 100644 index 000000000..5f25cedb1 --- /dev/null +++ b/misc/dev/variables.ui copy.env @@ -0,0 +1,21 @@ +# For the custom configuration, use the file at misc/dev/configs/server-http/hello.conf +SERVER_NAME=www.example.com +MULTISITE=yes +HTTP_PORT=80 +HTTPS_PORT=443 +DNS_RESOLVERS=9.9.9.9 8.8.8.8 8.8.4.4 +API_LISTEN_IP=127.0.0.1 +USE_BUNKERNET=no +USE_BLACKLIST=no +SEND_ANONYMOUS_REPORT=no +LOG_LEVEL=debug +SERVE_FILES=no +DISABLE_DEFAULT_SERVER=yes +USE_CLIENT_CACHE=yes +USE_GZIP=yes +www.example.com_USE_UI=yes +www.example.com_USE_REVERSE_PROXY=yes +www.example.com_REVERSE_PROXY_URL=/admin +www.example.com_REVERSE_PROXY_HOST=http://bw-ui:7000 +www.example.com_INTERCEPTED_ERROR_CODES=400 404 405 413 429 500 501 502 503 504 +EXTERNAL_PLUGIN_URLS=https://github.com/bunkerity/bunkerweb-plugins/archive/refs/heads/dev.zip diff --git a/misc/dev/variables.ui.env b/misc/dev/variables.ui.env new file mode 100644 index 000000000..528ed4494 --- /dev/null +++ b/misc/dev/variables.ui.env @@ -0,0 +1,19 @@ +SERVER_NAME=www.example.com +MULTISITE=yes +HTTP_PORT=80 +HTTPS_PORT=443 +DNS_RESOLVERS=9.9.9.9 8.8.8.8 8.8.4.4 +API_LISTEN_IP=127.0.0.1 +USE_BUNKERNET=no +USE_BLACKLIST=no +SEND_ANONYMOUS_REPORT=no +LOG_LEVEL=debug +SERVE_FILES=no +DISABLE_DEFAULT_SERVER=yes +USE_CLIENT_CACHE=yes +USE_GZIP=yes +www.example.com_USE_UI=yes +www.example.com_USE_REVERSE_PROXY=yes +www.example.com_REVERSE_PROXY_URL=/admin +www.example.com_REVERSE_PROXY_HOST=http://bw-ui:7000 +www.example.com_INTERCEPTED_ERROR_CODES=400 404 405 413 429 500 501 502 503 504 diff --git a/misc/dev/variables.wizard.env b/misc/dev/variables.wizard.env new file mode 100644 index 000000000..13c828b89 --- /dev/null +++ b/misc/dev/variables.wizard.env @@ -0,0 +1,14 @@ +SERVER_NAME= +MULTISITE=yes +HTTP_PORT=80 +HTTPS_PORT=443 +DNS_RESOLVERS=9.9.9.9 8.8.8.8 8.8.4.4 +API_LISTEN_IP=127.0.0.1 +USE_BUNKERNET=no +USE_BLACKLIST=no +SEND_ANONYMOUS_REPORT=no +LOG_LEVEL=debug +SERVE_FILES=no +USE_CLIENT_CACHE=yes +USE_GZIP=yes +UI_HOST=http://127.0.0.1:7000