Skip to content

Commit

Permalink
feat: Take secrets base directory from existing configuration
Browse files Browse the repository at this point in the history
Closes #4570

Signed-off-by: Bryon Nevis <[email protected]>
  • Loading branch information
bnevis-i committed Jul 12, 2023
1 parent 65b3fe8 commit c1c4c63
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmd/security-secretstore-setup/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ RUN make cmd/security-file-token-provider/security-file-token-provider \

FROM alpine:3.17

RUN apk add --update --no-cache ca-certificates dumb-init su-exec
RUN apk add --update --no-cache ca-certificates dumb-init su-exec yq

LABEL license='SPDX-License-Identifier: Apache-2.0' \
copyright='Copyright (c) 2019: Dell Technologies, Inc.; Copyright (C) 2023 Intel Corporation'
Expand Down
11 changes: 8 additions & 3 deletions cmd/security-secretstore-setup/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@

set -e

# env settings are populated from env files of docker-compose
# EDGEX_SECRETS_ROOT should default to /tmp/edgex/secrets
# unless changed in configuration.yaml or overridden by environment variable
EDGEX_SECRETS_ROOT=`yq -r .TokenFileProvider.OutputDir /res-file-token-provider/configuration.yaml`
if [ ! -z "${TOKENFILEPROVIDER_OUTPUTDIR}" ]; then
EDGEX_SECRETS_ROOT="${TOKENFILEPROVIDER_OUTPUTDIR}"
fi

# create token dir, and assign perms
mkdir -p /vault/config/assets
Expand All @@ -36,8 +41,8 @@ fi

# /tmp/edgex/secrets need to be shared with all other services that need secrets and
# thus change the ownership to EDGEX_USER:EDGEX_GROUP
echo "$(date) Changing ownership of secrets to ${EDGEX_USER}:${EDGEX_GROUP}"
chown -Rh ${EDGEX_USER}:${EDGEX_GROUP} /tmp/edgex/secrets
echo "$(date) Changing ownership of ${EDGEX_SECRETS_ROOT} to ${EDGEX_USER}:${EDGEX_GROUP}"
chown -Rh ${EDGEX_USER}:${EDGEX_GROUP} "${EDGEX_SECRETS_ROOT}"

# Signal tokens ready port for other services waiting on
exec su-exec ${EDGEX_USER} /edgex-init/security-bootstrapper --configDir=/edgex-init/res listenTcp \
Expand Down

0 comments on commit c1c4c63

Please sign in to comment.