summaryrefslogtreecommitdiffstats
path: root/ssl/connect.sh
diff options
context:
space:
mode:
authorPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2018-05-29 13:35:11 +0200
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2018-08-01 09:48:32 +0200
commita4becf29f32de7467793867c3be1d5ab5876477e (patch)
tree1e32d3e71188b36e712c8a8ac35c774da70537e1 /ssl/connect.sh
parenta150bc08ad326699717e09903e42d462e5e9c935 (diff)
Use SSL for encrypting the connection
Netty's OpenSSL bindings are used Closes ONAP-179 Change-Id: I8249fbaaed1dd869b733db04a27cebf53962c80c Issue-ID: DCAEGEN2-601 Signed-off-by: Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
Diffstat (limited to 'ssl/connect.sh')
-rwxr-xr-xssl/connect.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/ssl/connect.sh b/ssl/connect.sh
new file mode 100755
index 00000000..16524c3e
--- /dev/null
+++ b/ssl/connect.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+set -eou pipefail
+
+if [[ $# < 2 ]]; then
+ echo "Please provide a key file prefix and a target host:port"
+ exit 1
+fi
+
+key_prefix=$1
+host_and_port=$2
+
+cert_file="$key_prefix.crt"
+key_file="$key_prefix.key"
+
+if [[ ! -r "$cert_file" ]]; then
+ echo "$cert_file is not readable"
+ exit 2
+fi
+
+if [[ ! -r "$key_file" ]]; then
+ echo "$key_file is not readable"
+ exit 2
+fi
+
+openssl s_client -connect $host_and_port -cert "$cert_file" -key "$key_file" -CAfile onap.crt
+