-
Notifications
You must be signed in to change notification settings - Fork 1
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
fix(caddy): TLS certificates trust on all platforms #34
Open
lucasmirloup
wants to merge
1
commit into
main
Choose a base branch
from
fix/caddy-tls-certificates-trust
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
FROM --platform=$TARGETPLATFORM caddy:2-alpine | ||
FROM caddy:2-alpine | ||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
ADD --chmod=500 https://caddyserver.com/api/download?os=${TARGETOS}&arch=${TARGETARCH}&p=github.com/lucaslorentz/caddy-docker-proxy/v2&p=github.com/dunglas/mercure/caddy&p=github.com/dunglas/vulcain/caddy /usr/bin/caddy | ||
|
||
COPY Caddyfile /etc/caddy/Caddyfile | ||
|
||
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "wget", "-qO-", "http://localhost:2019/config" ] | ||
HEALTHCHECK --interval=5s --timeout=5s --start-period=5s --retries=3 CMD [ "wget", "-qO-", "http://127.0.0.1:2019/config" ] | ||
|
||
CMD ["caddy", "docker-proxy", "--caddyfile-path=/etc/caddy/Caddyfile"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker compose --ansi never up -d --build 2>& 1> /dev/null | ||
docker compose cp proxy:/usr/bin/caddy /tmp/caddy | ||
docker compose up -d 2>/dev/null | ||
|
||
XDG_DATA_HOME=/var/lib/docker/volumes/dev_caddy_data/_data | ||
docker compose exec proxy wget -q -O- --post-data='"0.0.0.0:2019"' --header='Content-Type:application/json' 'http://127.0.0.1:2019/config/admin/listen' | ||
|
||
sudo XDG_DATA_HOME=${XDG_DATA_HOME} \ | ||
/tmp/caddy start 2&> /dev/null; \ | ||
/tmp/caddy untrust; \ | ||
/tmp/caddy trust; \ | ||
/tmp/caddy stop 2&> /dev/null; \ | ||
docker compose cp proxy:/usr/bin/caddy /tmp/caddy 2>/dev/null | ||
|
||
rm /tmp/caddy | ||
/tmp/caddy trust | ||
|
||
# ArchLinux and derivatives, see https://wiki.archlinux.org/title/Transport_Layer_Security#Add_a_certificate_to_a_trust_store | ||
if command -v trust &> /dev/null; then | ||
sudo trust anchor /usr/local/share/ca-certificates/*.crt | ||
sudo update-ca-trust | ||
fi | ||
|
||
rm -f /tmp/caddy | ||
|
||
# Copy the certificate to a stable location (to simplify mounting on all Docker platforms) | ||
sudo docker compose cp proxy:/data/caddy/pki/authorities/local/root.crt /etc/ssl/certs/Caddy.crt 2>/dev/null | ||
Comment on lines
+19
to
+20
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. nitpick (non-blocking): You should not write in a system directory without checking there is not already a file called |
||
|
||
echo "Certificats Caddy installés avec succès !" | ||
echo "Vous pouvez désormais monter le fichier /etc/ssl/certs/Caddy.crt sur vos projets Docker." |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Why removing the
untrust
before trusting a new one. It's was here to cleanup intermediary certificates ?