mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [Removing experimental for the FIPS mode config (#200734)](https://github.com/elastic/kibana/pull/200734) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Kurt","email":"kc13greiner@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-11-19T20:23:20Z","message":"Removing experimental for the FIPS mode config (#200734)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/200718\r\n\r\nRemove the `experimental` from the fipsMode config path\r\n\r\n## Release note\r\n\r\nKibana's FIPS mode is no longer considered experimental\r\n\r\n## FIPS Pipeline for this branch\r\n\r\nhttps://buildkite.com/elastic/kibana-fips/builds/281","sha":"8e7799ae7aed6504b234c1779e6d3654fbcc9a32","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["v9.0.0","release_note:feature","backport:version","v8.17.0"],"number":200734,"url":"https://github.com/elastic/kibana/pull/200734","mergeCommit":{"message":"Removing experimental for the FIPS mode config (#200734)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/200718\r\n\r\nRemove the `experimental` from the fipsMode config path\r\n\r\n## Release note\r\n\r\nKibana's FIPS mode is no longer considered experimental\r\n\r\n## FIPS Pipeline for this branch\r\n\r\nhttps://buildkite.com/elastic/kibana-fips/builds/281","sha":"8e7799ae7aed6504b234c1779e6d3654fbcc9a32"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200734","number":200734,"mergeCommit":{"message":"Removing experimental for the FIPS mode config (#200734)\n\n## Summary\r\n\r\nCloses https://github.com/elastic/kibana/issues/200718\r\n\r\nRemove the `experimental` from the fipsMode config path\r\n\r\n## Release note\r\n\r\nKibana's FIPS mode is no longer considered experimental\r\n\r\n## FIPS Pipeline for this branch\r\n\r\nhttps://buildkite.com/elastic/kibana-fips/builds/281","sha":"8e7799ae7aed6504b234c1779e6d3654fbcc9a32"}},{"branch":"8.x","label":"v8.17.0","labelRegex":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT-->
48 lines
1.8 KiB
Bash
Executable file
48 lines
1.8 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
ENV_PATH="${KBN_DIR}/.devcontainer/.env"
|
|
KBN_CONFIG_FILE="${KBN_DIR}/config/kibana.dev.yml"
|
|
|
|
setup_fips() {
|
|
if [ ! -f "$KBN_CONFIG_FILE" ]; then
|
|
touch "$KBN_CONFIG_FILE"
|
|
fi
|
|
|
|
if [ -n "$FIPS" ] && [ "$FIPS" = "1" ]; then
|
|
sed -i '/xpack.security.fipsMode.enabled:/ {s/.*/xpack.security.fipsMode.enabled: true/; t}; $a\xpack.security.fipsMode.enabled: true' "$KBN_CONFIG_FILE"
|
|
|
|
# Patch node_modules so we can start Kibana in dev mode
|
|
sed -i 's/hashType = hashType || '\''md5'\'';/hashType = hashType || '\''sha1'\'';/g' "${KBN_DIR}/node_modules/file-loader/node_modules/loader-utils/lib/getHashDigest.js"
|
|
sed -i 's/const hash = createHash("md4");/const hash = createHash("sha1");/g' "${KBN_DIR}/node_modules/webpack/lib/ModuleFilenameHelpers.js"
|
|
sed -i 's/contentHash: createHash("md4")/contentHash: createHash("sha1")/g' "${KBN_DIR}/node_modules/webpack/lib/SourceMapDevToolPlugin.js"
|
|
|
|
export OPENSSL_MODULES="$OPENSSL_PATH/lib/ossl-modules"
|
|
export NODE_OPTIONS="--enable-fips --openssl-config=$KBN_DIR/.devcontainer/config/nodejs.cnf"
|
|
echo "FIPS mode enabled"
|
|
echo "If manually bootstrapping in FIPS mode use: NODE_OPTIONS='' yarn kbn bootstrap"
|
|
else
|
|
sed -i '/xpack.security.fipsMode.enabled:/ {s/.*/xpack.security.fipsMode.enabled: false/; t}; $a\xpack.security.fipsMode.enabled: false' "$KBN_CONFIG_FILE"
|
|
fi
|
|
}
|
|
|
|
setup_shell() {
|
|
if [ -n "$SHELL" ] && [ -x "$SHELL" ]; then
|
|
current_shell=$(ps -p $$ -o comm=)
|
|
desired_shell=$(basename "$SHELL")
|
|
|
|
if [ "$current_shell" != "$desired_shell" ]; then
|
|
sudo chsh -s "$SHELL" vscode
|
|
exec "$SHELL"
|
|
fi
|
|
else
|
|
echo "Shell is not set or not executable, using bash"
|
|
fi
|
|
}
|
|
|
|
if [ -f "$ENV_PATH" ]; then
|
|
source "$ENV_PATH"
|
|
setup_fips
|
|
setup_shell
|
|
else
|
|
echo ".env file not found, using default values"
|
|
fi
|