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
22 changes: 22 additions & 0 deletions build/ps-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,28 @@ if [[ $originalArgOne == mongo* ]]; then
fi
fi

keyFilePath=""
if _mongod_hack_have_arg --keyFile "${mongodHackedArgs[@]}"; then
keyFilePath="$(_mongod_hack_get_arg_val --keyFile "${mongodHackedArgs[@]}")"
elif _parse_config "${mongodHackedArgs[@]}"; then
keyFilePath="$(jq -r '.security.keyFile // empty' "$jsonConfigFile")"
fi

if [ -n "$keyFilePath" ] && [ -f "$keyFilePath" ]; then
keyFileTmp="${TMPDIR:-/tmp}/mongodb-keyfile"
if [ "$keyFilePath" != "$keyFileTmp" ]; then
if ! cp -f "$keyFilePath" "$keyFileTmp"; then
echo >&2 "error: failed to copy keyFile from $keyFilePath to $keyFileTmp"
exit 1
fi
fi
if ! chmod 0400 "$keyFileTmp"; then
echo >&2 "error: failed to chmod keyFile $keyFileTmp"
exit 1
fi
_mongod_hack_ensure_arg_val --keyFile "$keyFileTmp" "${mongodHackedArgs[@]}"
fi

if [ "$MONGODB_VERSION" != 'v4.0' ]; then
_mongod_hack_rename_arg '--sslAllowInvalidCertificates' '--tlsAllowInvalidCertificates' "${mongodHackedArgs[@]}"
_mongod_hack_rename_arg '--sslAllowInvalidHostnames' '--tlsAllowInvalidHostnames' "${mongodHackedArgs[@]}"
Expand Down
Loading