Repository navigation
ref(certificates): Build the Sentry CA trust store at install time #4545
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: master
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| echo "${_group}Setting up the CA trust store for Sentry ..." | ||
|
|
||
| # Sentry containers mount this directory read-only at /etc/ssl/certs. It holds | ||
| # the image's own CA certificates plus every certificates/*.crt, so changes to | ||
| # custom CAs take effect on the next ./install.sh. | ||
| trust_store="certificates/.generated/sentry/etc/ssl/certs" | ||
| rm -rf "$trust_store" | ||
| mkdir -p "$trust_store" | ||
|
|
||
| container=$($CONTAINER_ENGINE create sentry-self-hosted-local) | ||
| $CONTAINER_ENGINE cp "$container:/etc/ssl/certs/." "$trust_store/" | ||
| $CONTAINER_ENGINE rm "$container" >/dev/null | ||
|
|
||
| for cert in certificates/*.crt; do | ||
| [[ -f "$cert" ]] || continue | ||
| name=$(basename "$cert" .crt) | ||
| cp "$cert" "$trust_store/$name.pem" | ||
| cat "$cert" >>"$trust_store/ca-certificates.crt" | ||
| echo >>"$trust_store/ca-certificates.crt" | ||
| # Hash link for libraries that look certificates up by directory. | ||
| if command -v openssl &>/dev/null; then | ||
|
Collaborator
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. Not all hosts has |
||
| hash=$(openssl x509 -hash -noout -in "$cert") | ||
| n=0 | ||
| while [[ -e "$trust_store/$hash.$n" || -L "$trust_store/$hash.$n" ]]; do n=$((n + 1)); done | ||
| ln -s "$name.pem" "$trust_store/$hash.$n" | ||
| fi | ||
| echo "Added $cert" | ||
| done | ||
|
|
||
| echo "${_endgroup}" | ||
This file was deleted.
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.
Instead of doing this for
sentry, we can do this for all the services we have (vroom, relay, etc), therefore we can remove https://github.com/getsentry/self-hosted/blob/master/install/setup-custom-ca-certificate.sh as well.