Skip to content

Commit

Permalink
[deb/rpm] Create keystore after installation (#76465)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
jbudz and kibanamachine committed Dec 2, 2020
1 parent f0c4960 commit dd9434a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 3 deletions.
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');
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 @@ -44,9 +44,11 @@ case $1 in
IS_UPGRADE=true
fi

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

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


PACKAGE=rpm
setup
;;

Expand All @@ -86,3 +89,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 @@ -94,6 +94,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');

0 comments on commit dd9434a

Please sign in to comment.