2017-09-19 04:07:39 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
|
|
# or more contributor license agreements. Licensed under the Elastic License;
|
|
|
|
# you may not use this file except in compliance with the Elastic License.
|
|
|
|
|
2017-12-12 11:05:51 -05:00
|
|
|
install_xpack() {
|
|
|
|
install_and_check_plugin x pack x-pack-core-*.jar x-pack-graph-*.jar x-pack-ml-*.jar \
|
|
|
|
x-pack-monitoring-*.jar x-pack-security-*.jar x-pack-watcher-*.jar
|
|
|
|
}
|
|
|
|
|
|
|
|
# Checks that X-Pack files are correctly installed
|
2017-09-19 04:07:39 -04:00
|
|
|
verify_xpack_installation() {
|
|
|
|
local user="$ESPLUGIN_COMMAND_USER"
|
|
|
|
local group="$ESPLUGIN_COMMAND_USER"
|
|
|
|
|
|
|
|
assert_file "$ESHOME/bin/x-pack" d $user $group 755
|
|
|
|
assert_file "$ESHOME/bin/x-pack/certgen" f $user $group 755
|
|
|
|
assert_file "$ESHOME/bin/x-pack/croneval" f $user $group 755
|
|
|
|
assert_file "$ESHOME/bin/x-pack/extension" f $user $group 755
|
|
|
|
assert_file "$ESHOME/bin/x-pack/migrate" f $user $group 755
|
2018-01-20 17:43:00 -05:00
|
|
|
assert_file "$ESHOME/bin/x-pack/saml-metadata" f $user $group 755
|
2017-09-19 04:07:39 -04:00
|
|
|
assert_file "$ESHOME/bin/x-pack/setup-passwords" f $user $group 755
|
|
|
|
assert_file "$ESHOME/bin/x-pack/syskeygen" f $user $group 755
|
|
|
|
assert_file "$ESHOME/bin/x-pack/users" f $user $group 755
|
|
|
|
assert_file "$ESHOME/bin/x-pack/x-pack-env" f $user $group 755
|
2018-01-20 17:43:00 -05:00
|
|
|
assert_number_of_files "$ESHOME/bin/x-pack/" 20
|
2017-09-19 04:07:39 -04:00
|
|
|
|
|
|
|
assert_file "$ESCONFIG/x-pack" d $user elasticsearch 750
|
|
|
|
assert_file "$ESCONFIG/x-pack/users" f $user elasticsearch 660
|
|
|
|
assert_file "$ESCONFIG/x-pack/users_roles" f $user elasticsearch 660
|
|
|
|
assert_file "$ESCONFIG/x-pack/roles.yml" f $user elasticsearch 660
|
|
|
|
assert_file "$ESCONFIG/x-pack/role_mapping.yml" f $user elasticsearch 660
|
|
|
|
assert_file "$ESCONFIG/x-pack/log4j2.properties" f $user elasticsearch 660
|
|
|
|
assert_number_of_files "$ESCONFIG/x-pack" 5
|
|
|
|
|
|
|
|
assert_file "$ESCONFIG/elasticsearch.keystore" f $user elasticsearch 660
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_number_of_files() {
|
|
|
|
local directory=$1
|
|
|
|
local expected=$2
|
|
|
|
|
|
|
|
local count=$(ls "$directory" | wc -l)
|
|
|
|
[ "$count" -eq "$expected" ] || {
|
|
|
|
echo "Expected $expected files in $directory but found: $count"
|
|
|
|
false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
wait_for_xpack() {
|
2017-09-21 04:12:07 -04:00
|
|
|
local host=${1:-localhost}
|
2017-10-11 05:34:33 -04:00
|
|
|
local port=${2:-9200}
|
2017-09-19 04:07:39 -04:00
|
|
|
for i in {1..30}; do
|
2017-09-21 04:12:07 -04:00
|
|
|
echo "GET / HTTP/1.0" > /dev/tcp/$host/$port && break || sleep 1;
|
2017-09-19 04:07:39 -04:00
|
|
|
done
|
2017-12-12 11:05:51 -05:00
|
|
|
}
|