Skip to content
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

Using own SSL certificate with Caddy #660

Closed
Greeniezz opened this issue Jul 16, 2024 · 8 comments
Closed

Using own SSL certificate with Caddy #660

Greeniezz opened this issue Jul 16, 2024 · 8 comments
Assignees
Labels
documentation Improvements or additions to documentation question Further information is requested

Comments

@Greeniezz
Copy link

Greeniezz commented Jul 16, 2024

Firstly thank you guys for your work and everyone on the issue forum
Sorry for being so lame :(

I don't find where to tell caddy to use my own domain certificate.
Here my docker-compose.yml :

version: "3.9"

services:
backend:
container_name: backend
image: ghcr.io/intuitem/ciso-assistant-community/backend:latest
restart: always
environment:
- ALLOWED_HOSTS=backend,cisovm
- CISO_ASSISTANT_URL=https://cisovm:8443
- DJANGO_DEBUG=True
- AUTH_TOKEN_TTL=7200
volumes:
- ./db:/code/db

frontend:
container_name: frontend
environment:
- PUBLIC_BACKEND_API_URL=http://backend:8000/api
- PUBLIC_BACKEND_API_EXPOSED_URL=https://cisovm:8443/api
- PROTOCOL_HEADER=x-forwarded-proto
- HOST_HEADER=x-forwarded-host

image: ghcr.io/intuitem/ciso-assistant-community/frontend:latest
depends_on:
  - backend

caddy:
container_name: caddy
image: caddy:2.7.6
environment:
- CISO_ASSISTANT_URL=https://cisovm:443
depends_on:
- frontend
restart: unless-stopped
ports:
- 8443:8443
volumes:
- ./caddy_data:/data
command: |
sh -c 'echo $$CISO_ASSISTANT_URL "{
reverse_proxy /api/iam/sso/redirect/ backend:8000
reverse_proxy /api/accounts/saml/0/acs/ backend:8000
reverse_proxy /api/accounts/saml/0/acs/finish/ backend:8000
reverse_proxy /* frontend:3000
tls internal
}" > Caddyfile && caddy run'

Thank you very much for your help !

@ab-smith ab-smith added the question Further information is requested label Jul 16, 2024
@eric-intuitem
Copy link
Collaborator

I think you should put your certificate and key in the ./caddy_data directory, that will be visible as /data for caddy, and where the Caddyfile is created dynamically. And then, in the Caddyfile creation script, instead of "tls internal", you should use "tls <cert_file> <key_file>".

@ab-smith ab-smith added the documentation Improvements or additions to documentation label Dec 1, 2024
@rzivny
Copy link
Contributor

rzivny commented Jan 10, 2025

If this setting is in caddy_data, how will tls be set in docker-compose.yml?

@rzivny
Copy link
Contributor

rzivny commented Jan 10, 2025

Copy certifikate and key (format)*.pem to caddy_data and in Caddyfile change tls intrenal on tls "/data/certifikate.pem" "/data/key.pem" and change tls internal as tls "/data/certifikate.pem" "/data/key.pem" in docker-compose.yml. resrtart docker compose (Stop and next up -d).

@FabFromTheSnow
Copy link

Yep, we would need a full procedure, I can't figure out today. Not sure what to edit.

@FabFromTheSnow
Copy link

thanks @eric-intuitem @rzivny
I managed to make it works based on your comments :)

@yboujraf
Copy link

Dear @FabFromTheSnow
Would you like to share the steps ?
BR

@rzivny
Copy link
Contributor

rzivny commented Feb 18, 2025

1 STEP Copy certifikate and key (format)*.pem to caddy_data
2 STEP and in Caddyfile change tls internal on tls "/data/certifikate.pem" "/data/key.pem"
3 STEP and change tls internal as tls "/data/certifikate.pem" "/data/key.pem" in docker-compose.yml.
4 STEP restart docker compose (Stop and next up -d).

@ab-smith
Copy link
Contributor

Covered by the config builder introduced in #1470

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

6 participants