Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ EOF
log "Templating config.json"
OVERRIDE_CONFIG="$NOMAD_ALLOC_DIR/oci-bundle-config.overrides.json"
mv "$OCI_BUNDLE_PATH/config.json" "$OVERRIDE_CONFIG"


# Template new config
jq "
.process.args = $(jq '.process.args' $OVERRIDE_CONFIG) |
.process.env = $(jq '.process.env' $OVERRIDE_CONFIG) + .process.env |
Expand All @@ -75,5 +78,15 @@ jq "
}]
" "$NOMAD_ALLOC_DIR/oci-bundle-config.base.json" > "$OCI_BUNDLE_PATH/config.json"

# Validate config
if [ "$(jq '.process.user.uid' "$OVERRIDE_CONFIG")" == "0" ]; then
log "Container is attempting to run as root user"
exit 1
fi
if [ "$(jq '.process.user.gid' "$OVERRIDE_CONFIG")" == "0" ]; then
log "Container is attempting to run as root group"
exit 1
fi

log "Finished setting up OCI bundle"