dotfiles/bin/get_certs.sh
Petar Kapriš 9d963b922a Add /bin
2025-12-16 21:42:18 +01:00

11 lines
314 B
Bash
Executable file

#!/bin/sh
get_cert() {
SERVER=${1:-my.server.com}
PORT=${2:-993}
CERT_FOLDER=${3:-~/.cert}
openssl s_client -connect ${SERVER}:${PORT} -showcerts 2>&1 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'| sed -ne '1,/-END CERTIFICATE-/p' > ${CERT_FOLDER}/${SERVER}.pem
}
get_cert mail.cock.li