#!/bin/bash echo | openssl s_client -servername $1 -connect $1:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > $2.crt
you can use it as follow:
$ getcert.sh google.com google_certificate
to generate google_certificate.crt
#!/bin/bash echo | openssl s_client -servername $1 -connect $1:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > $2.crt
you can use it as follow:
$ getcert.sh google.com google_certificate
to generate google_certificate.crt