-
Notifications
You must be signed in to change notification settings - Fork 686
feat: hardening of containers #3328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 6 commits
d14c852
ed488e0
70fa831
755f670
f62169e
6a00153
a417e7a
02deadf
7f9b08f
794acfd
52a78b2
4498432
a0b19e4
93efc43
b1d5fcb
76d6b52
83dc567
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ if [ ! -n "$DJANGO_SETTINGS_MODULE" ]; then | |
| fi | ||
| if [ ! -n "$DJANGO_SECRET_KEY" ]; then | ||
| if [ ! -f db/django_secret_key ]; then | ||
| cat /proc/sys/kernel/random/uuid >db/django_secret_key | ||
| install -m 600 <(cat /proc/sys/kernel/random/uuid) db/django_secret_key | ||
|
||
| echo "generating initial Django secret key" | ||
| fi | ||
| export DJANGO_SECRET_KEY=$(<db/django_secret_key) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,6 +32,10 @@ services: | |
| - CISO_ASSISTANT_URL=https://{{ fqdn }}:{{ port }} | ||
| - DJANGO_DEBUG={{ enable_debug }} | ||
| - AUTH_TOKEN_TTL=7200 | ||
| - HOME=/tmp | ||
| - XDG_CACHE_HOME=/tmp/.cache | ||
| - XDG_CONFIG_HOME=/tmp/.config | ||
| - XDG_DATA_HOME=/tmp/.local/share | ||
|
Comment on lines
+35
to
+38
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Backend is missing The environment variables were added, but the runtime hardening block that every other compose file applies to backend is absent here. Compare with Proposed fix — add the missing hardening block to backend - XDG_DATA_HOME=/tmp/.local/share
- POSTGRES_NAME={{ postgres.name }}
...
+ read_only: true
+ cap_drop:
+ - ALL
+ security_opt:
+ - no-new-privileges:true
+ tmpfs:
+ - /tmp:rw,noexec,nosuid,nodev
volumes:
- ./db:/code/db
+ user: "1001:1001"
healthcheck:🤖 Prompt for AI Agents |
||
| - POSTGRES_NAME={{ postgres.name }} | ||
| - POSTGRES_USER={{ postgres.user }} | ||
| {% if postgres.password is defined %} | ||
|
|
@@ -75,6 +79,10 @@ services: | |
| - CISO_ASSISTANT_URL=https://{{ fqdn }}:{{ port }} | ||
| - DJANGO_DEBUG=False | ||
| - AUTH_TOKEN_TTL=7200 | ||
| - HOME=/tmp | ||
| - XDG_CACHE_HOME=/tmp/.cache | ||
| - XDG_CONFIG_HOME=/tmp/.config | ||
| - XDG_DATA_HOME=/tmp/.local/share | ||
| - POSTGRES_NAME={{ postgres.name }} | ||
| - POSTGRES_USER={{ postgres.user }} | ||
| {% if postgres.password is defined %} | ||
|
|
@@ -89,8 +97,16 @@ services: | |
| - EMAIL_HOST_PASSWORD={{ email.password }} | ||
| - DEFAULT_FROM_EMAIL={{ email.from_email }} | ||
| {% endif %} | ||
| read_only: true | ||
| cap_drop: | ||
| - ALL | ||
| security_opt: | ||
| - no-new-privileges:true | ||
| tmpfs: | ||
| - /tmp:rw,noexec,nosuid,nodev | ||
| volumes: | ||
| - ./db:/code/db | ||
| user: "1001:1001" | ||
| entrypoint: | ||
| - /bin/sh | ||
| - -c | ||
|
|
@@ -104,11 +120,16 @@ services: | |
| - PUBLIC_BACKEND_API_EXPOSED_URL=https://{{ fqdn }}:{{ port }}/api | ||
| - PROTOCOL_HEADER=x-forwarded-proto | ||
| - HOST_HEADER=x-forwarded-host | ||
| - HOME=/tmp | ||
| - XDG_CACHE_HOME=/tmp/.cache | ||
| - XDG_CONFIG_HOME=/tmp/.config | ||
| - XDG_DATA_HOME=/tmp/.local/share | ||
| image: ghcr.io/intuitem/ciso-assistant-community/frontend:latest | ||
| pull_policy: always | ||
| depends_on: | ||
| backend: | ||
| condition: service_healthy | ||
| user: "1001:1001" | ||
| labels: | ||
| - "traefik.enable=true" | ||
| - "traefik.http.routers.frontend.rule=Host(`{{ fqdn }}`) && PathPrefix(`/`)" | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.