Piotr Jaszczyk | a4becf2 | 2018-05-29 13:35:11 +0200 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | set -eou pipefail |
| 3 | |
| 4 | if [[ $# < 2 ]]; then |
| 5 | echo "Please provide a key file prefix and a target host:port" |
| 6 | exit 1 |
| 7 | fi |
| 8 | |
| 9 | key_prefix=$1 |
| 10 | host_and_port=$2 |
| 11 | |
| 12 | cert_file="$key_prefix.crt" |
| 13 | key_file="$key_prefix.key" |
| 14 | |
| 15 | if [[ ! -r "$cert_file" ]]; then |
| 16 | echo "$cert_file is not readable" |
| 17 | exit 2 |
| 18 | fi |
| 19 | |
| 20 | if [[ ! -r "$key_file" ]]; then |
| 21 | echo "$key_file is not readable" |
| 22 | exit 2 |
| 23 | fi |
| 24 | |
| 25 | openssl s_client -connect $host_and_port -cert "$cert_file" -key "$key_file" -CAfile onap.crt |
| 26 | |