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

[deb/rpm] Create keystore after installation #76465

Merged
merged 15 commits into from
Nov 17, 2020
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/cli/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@

require('../apm')(process.env.ELASTIC_APM_SERVICE_NAME || 'kibana-proxy');
require('../setup_node_env');
require('../setup_node_env/root');
tylersmalley marked this conversation as resolved.
Show resolved Hide resolved
require('./cli');
1 change: 1 addition & 0 deletions src/cli/dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@

require('../apm')();
require('../setup_node_env/dist');
require('../setup_node_env/root');
require('./cli');
2 changes: 1 addition & 1 deletion src/cli_keystore/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
* under the License.
*/

require('../setup_node_env');
require('../setup_node_env/no_transpilation');
require('./cli_keystore');
15 changes: 14 additions & 1 deletion src/dev/build/tasks/os_packages/package_scripts/post_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ case $1 in
IS_UPGRADE=true
fi

PACKAGE=deb
setup
;;
abort-deconfigure|abort-upgrade|abort-remove)
PACKAGE=deb
;;

# Red Hat
Expand All @@ -62,7 +64,8 @@ case $1 in
if [ "$1" = "2" ]; then
IS_UPGRADE=true
fi


PACKAGE=rpm
setup
;;

Expand All @@ -85,3 +88,13 @@ if [ "$IS_UPGRADE" = "true" ]; then
echo " OK"
fi
fi

# the equivalent code for rpm is in posttrans
if [ "$PACKAGE" = "deb" ]; then
if [ ! -f "${KBN_PATH_CONF}"/kibana.keystore ]; then
/usr/share/kibana/bin/kibana-keystore create
chown root:<%= group %> "${KBN_PATH_CONF}"/kibana.keystore
chmod 660 "${KBN_PATH_CONF}"/kibana.keystore
md5sum "${KBN_PATH_CONF}"/kibana.keystore > "${KBN_PATH_CONF}"/.kibana.keystore.initial_md5sum
fi
fi
8 changes: 8 additions & 0 deletions src/dev/build/tasks/os_packages/package_scripts/post_trans.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export KBN_PATH_CONF=${KBN_PATH_CONF:-<%= configDir %>}

if [ ! -f "${KBN_PATH_CONF}"/kibana.keystore ]; then
/usr/share/kibana/bin/kibana-keystore create
chown root:<%= group %> "${KBN_PATH_CONF}"/kibana.keystore
chmod 660 "${KBN_PATH_CONF}"/kibana.keystore
md5sum "${KBN_PATH_CONF}"/kibana.keystore > "${KBN_PATH_CONF}"/.kibana.keystore.initial_md5sum
fi
2 changes: 2 additions & 0 deletions src/dev/build/tasks/os_packages/run_fpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export async function runFpm(
resolve(__dirname, 'package_scripts/pre_remove.sh'),
'--after-remove',
resolve(__dirname, 'package_scripts/post_remove.sh'),
'--rpm-posttrans',
resolve(__dirname, 'package_scripts/post_trans.sh'),

// tell fpm about the config file so that it is called out in the package definition
'--config-files',
Expand Down
1 change: 0 additions & 1 deletion src/setup_node_env/no_transpilation.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ require('./harden');

require('symbol-observable');
require('source-map-support/register');
require('./root');
require('./node_version_validator');