We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4f9504a commit 56a05e5Copy full SHA for 56a05e5
CLI_get_ssl_cert.sh
@@ -0,0 +1,26 @@
1
+#!/bin/bash
2
+
3
+SERVERNAME=$(echo $1 | cut -d ":" -f1)
4
+THE_PORT=$(echo $1 | sed 's/.*://')
5
6
+### TEST DEPENDENCIES ###
7
+#-- OPENSSL --#
8
+command -v openssl >/dev/null 2>&1 || if [[ $? -ne 0 ]] ; then
9
+ echo -e "Error : openssl is missing, please install openssl package."
10
+ exit
11
+fi
12
13
+#-- PARAMS CHECK --#
14
+if [[ $SERVERNAME = "" ]]; then
15
+ echo -e "Error, SERVER parameter is missing !"
16
+ echo -e "Usage : get_ssl_cert.sh SERVER:PORT"
17
18
19
20
+if ! [[ $THE_PORT =~ [0-9] ]]; then
21
+ echo -e "Error, PORT parameter is missing !"
22
23
24
25
26
+echo -n | openssl s_client -servername $SERVERNAME -connect $SERVERNAME:$THE_PORT | openssl x509 > $SERVERNAME.cert
0 commit comments