aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Bynens <mathias@qiwi.be>2014-09-01 21:59:15 +0200
committerMathias Bynens <mathias@qiwi.be>2014-09-01 21:59:15 +0200
commitf89753ed06f3e8d291070693115f5a51ec36e0bc (patch)
tree4b000548e7661b08c1b3b72f666092a9f5b8268c
parent90037c09e07e6d73a3f389925b63c65a00a4d635 (diff)
downloaddotfiles-f89753ed06f3e8d291070693115f5a51ec36e0bc.tar.gz
dotfiles-f89753ed06f3e8d291070693115f5a51ec36e0bc.tar.bz2
dotfiles-f89753ed06f3e8d291070693115f5a51ec36e0bc.zip
.functions: Improve `getcertnames`
-rw-r--r--.functions22
1 files changed, 11 insertions, 11 deletions
diff --git a/.functions b/.functions
index 006ffb1..cd29e11 100644
--- a/.functions
+++ b/.functions
@@ -180,17 +180,17 @@ function getcertnames() {
if [[ "${tmp}" = *"-----BEGIN CERTIFICATE-----"* ]]; then
local certText=$(echo "${tmp}" \
- | openssl x509 -text -certopt "no_header, no_serial, no_version, \
- no_signame, no_validity, no_issuer, no_pubkey, no_sigdump, no_aux");
- echo "Common Name:";
- echo ""; # newline
- echo "${certText}" | grep "Subject:" | sed -e "s/^.*CN=//";
- echo ""; # newline
- echo "Subject Alternative Name(s):";
- echo ""; # newline
- echo "${certText}" | grep -A 1 "Subject Alternative Name:" \
- | sed -e "2s/DNS://g" -e "s/ //g" | tr "," "\n" | tail -n +2;
- return 0;
+ | openssl x509 -text -certopt "no_aux, no_header, no_issuer, no_pubkey, \
+ no_serial, no_sigdump, no_signame, no_validity, no_version");
+ echo "Common Name:";
+ echo ""; # newline
+ echo "${certText}" | grep "Subject:" | sed -e "s/^.*CN=//" | sed -e "s/\/emailAddress=.*//";
+ echo ""; # newline
+ echo "Subject Alternative Name(s):";
+ echo ""; # newline
+ echo "${certText}" | grep -A 1 "Subject Alternative Name:" \
+ | sed -e "2s/DNS://g" -e "s/ //g" | tr "," "\n" | tail -n +2;
+ return 0;
else
echo "ERROR: Certificate not found.";
return 1;