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

fix mkdir command that enables clobbering tmp identity in container #801

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ fi
# if identity env var is defined then do not look for mounted identities
if [[ -n "${ZITI_IDENTITY_JSON:-}" ]]; then
IDENTITIES_DIR="/tmp/openziti"
mkdir -m0700 "${IDENTITIES_DIR}"
# shellcheck disable=SC2174
mkdir -pm0700 "${IDENTITIES_DIR}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this fixing? Is the /tmp directory actually missing sometimes? If so, how does that happen? We should prevent that if possible because /tmp is an important directory.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that /tmp/openziti already exists if a container is resumed, so mkdir always fails in that case with an error like "file exists."

The fix is to tolerate the existing directory because the goal of this hunk is to clobber /tmp/openizti/${ZITI_IDENTITY_BASENAME}.json with the value of $ZITI_IDENTITY_JSON.

if [[ -z "${ZITI_IDENTITY_BASENAME:-}" ]]; then
ZITI_IDENTITY_BASENAME="ziti_id"
fi
Expand Down
Loading