Add security hardening and PostgreSQL 18 upgrade support
Add ALLOWED_HOSTS configuration to restrict trusted hosts in TrustedHostMiddleware. Enhance SSRF protection to block all private, loopback, link-local, multicast, reserved, and unspecified IP addresses using ipaddress module and DNS resolution checks. Add encrypt_value/decrypt_value aliases for encryption functions. Upgrade PostgreSQL from 16 to 18.4 in Docker Compose with updated data directory path (/var/lib/postgresql). Add security_opt no
This commit is contained in:
+20
-8
@@ -2,20 +2,22 @@ name: nexadash
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
image: postgres:18.4-alpine
|
||||
container_name: nexadash-postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: ${POSTGRES_USER:-nexadash}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-change-this-strong-password}
|
||||
POSTGRES_DB: ${POSTGRES_DB:-nexadash}
|
||||
POSTGRES_USER: ${POSTGRES_USER:?Set POSTGRES_USER in .env}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
|
||||
POSTGRES_DB: ${POSTGRES_DB:?Set POSTGRES_DB in .env}
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- postgres_data:/var/lib/postgresql
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-nexadash} -d ${POSTGRES_DB:-nexadash}"]
|
||||
test: ["CMD-SHELL", "pg_isready -U \"$${POSTGRES_USER}\" -d \"$${POSTGRES_DB}\""]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
networks:
|
||||
- nexadash
|
||||
|
||||
@@ -23,14 +25,18 @@ services:
|
||||
image: redis:7-alpine
|
||||
container_name: nexadash-redis
|
||||
restart: unless-stopped
|
||||
command: redis-server --requirepass ${REDIS_PASSWORD:-change-this-redis-password}
|
||||
command: ["sh", "-c", "redis-server --requirepass \"$${REDIS_PASSWORD}\""]
|
||||
environment:
|
||||
REDIS_PASSWORD: ${REDIS_PASSWORD:?Set REDIS_PASSWORD in .env}
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
healthcheck:
|
||||
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD:-change-this-redis-password}", "ping"]
|
||||
test: ["CMD-SHELL", "REDISCLI_AUTH=\"$${REDIS_PASSWORD}\" redis-cli ping"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
networks:
|
||||
- nexadash
|
||||
|
||||
@@ -61,6 +67,8 @@ services:
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
networks:
|
||||
- nexadash
|
||||
|
||||
@@ -84,6 +92,8 @@ services:
|
||||
CELERY_RESULT_BACKEND: ${CELERY_RESULT_BACKEND}
|
||||
volumes:
|
||||
- plugin_data:/app/plugins
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
networks:
|
||||
- nexadash
|
||||
|
||||
@@ -107,6 +117,8 @@ services:
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
networks:
|
||||
- nexadash
|
||||
|
||||
|
||||
Reference in New Issue
Block a user