forked from ao1024/search-guard-ssl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmoketest.sh
executable file
·62 lines (49 loc) · 2.42 KB
/
smoketest.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
killall -9 java
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $DIR
ES_VERSION=6.4.0
NETTY_NATIVE_VERSION=2.0.7.Final
NETTY_NATIVE_CLASSIFIER=non-fedora-linux-x86_64
rm -rf elasticsearch-$ES_VERSION
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-$ES_VERSION.tar.gz
tar -xzf elasticsearch-$ES_VERSION.tar.gz
rm -rf elasticsearch-$ES_VERSION.tar.gz
#wget -O netty-tcnative-$NETTY_NATIVE_VERSION-$NETTY_NATIVE_CLASSIFIER.jar https://search.maven.org/remotecontent?filepath=io/netty/netty-tcnative/$NETTY_NATIVE_VERSION/netty-tcnative-$NETTY_NATIVE_VERSION-$NETTY_NATIVE_CLASSIFIER.jar
mvn clean package -DskipTests
PLUGIN_FILE=($DIR/target/releases/search-guard-ssl*)
URL=file://$PLUGIN_FILE
echo $URL
elasticsearch-$ES_VERSION/bin/elasticsearch-plugin install -b $URL
RET=$?
if [ $RET -eq 0 ]; then
echo Installation ok
else
echo Installation failed
exit -1
fi
echo "searchguard.ssl.transport.enabled: true" > elasticsearch-$ES_VERSION/config/elasticsearch.yml
echo "searchguard.ssl.transport.keystore_filepath: node-0-keystore.jks" >> elasticsearch-$ES_VERSION/config/elasticsearch.yml
echo "searchguard.ssl.transport.truststore_filepath: truststore.jks" >> elasticsearch-$ES_VERSION/config/elasticsearch.yml
echo "searchguard.ssl.transport.enforce_hostname_verification: false" >> elasticsearch-$ES_VERSION/config/elasticsearch.yml
echo "searchguard.ssl.http.enabled: true" >> elasticsearch-$ES_VERSION/config/elasticsearch.yml
echo "searchguard.ssl.http.keystore_filepath: node-0-keystore.jks" >> elasticsearch-$ES_VERSION/config/elasticsearch.yml
echo "searchguard.ssl.http.truststore_filepath: truststore.jks" >> elasticsearch-$ES_VERSION/config/elasticsearch.yml
echo "xpack.security.enabled: false" >> elasticsearch-$ES_VERSION/config/elasticsearch.yml
cp src/test/resources/*.jks elasticsearch-$ES_VERSION/config/
#cp netty-tcnative-$NETTY_NATIVE_VERSION-$NETTY_NATIVE_CLASSIFIER.jar elasticsearch-$ES_VERSION/plugins/search-guard-ssl/
rm -f netty-tcnative-$NETTY_NATIVE_VERSION-$NETTY_NATIVE_CLASSIFIER.jar
elasticsearch-$ES_VERSION/bin/elasticsearch &
while ! nc -z 127.0.0.1 9200; do
sleep 0.1 # wait for 1/10 of the second before check again
done
RES="$(curl -Ss --insecure -XGET 'https://127.0.0.1:9200/_searchguard/sslinfo' -H'Content-Type: application/json' | grep ssl_openssl_available)"
if [ -z "$RES" ]; then
echo "failed"
exit -1
else
echo "$RES"
echo ok
fi
killall java