informatica:linux:certificados
This is an old revision of the document!
Table of Contents
Listar certificado y ver fecha y issuer
URL=google.com;PORT=443;OLDIFS=$IFS; IFS=':' certificates=$(echo | openssl s_client -showcerts -servername $URL -connect $URL:$PORT 2>/dev/null | sed -n '/-----BEGIN/,/-----END/ {/-----BEGIN/ s/^/:/; p}'); for certificate in ${certificates#:}; do echo;echo $certificate | openssl x509 -noout -subject -issuer -dates ;echo; done; IFS=$OLDIFS
El resultado es este, certificado, SUBCA y CA
subject=CN = *.google.com issuer=C = US, O = Google Trust Services, CN = WR2 notBefore=Aug 12 06:33:49 2024 GMT notAfter=Nov 4 06:33:48 2024 GMT subject=C = US, O = Google Trust Services, CN = WR2 issuer=C = US, O = Google Trust Services LLC, CN = GTS Root R1 notBefore=Dec 13 09:00:00 2023 GMT notAfter=Feb 20 14:00:00 2029 GMT subject=C = US, O = Google Trust Services LLC, CN = GTS Root R1 issuer=C = BE, O = GlobalSign nv-sa, OU = Root CA, CN = GlobalSign Root CA notBefore=Jun 19 00:00:42 2020 GMT notAfter=Jan 28 00:00:42 2028 GMT
Grabar certificado, subCA y CA
El mismo comando pero guarda el certificado, la subCA y la CA en ficheros que se llaman como el CN del subject de cada certificado, subCA y CA
URL=www.google.com;PORT=443;OLDIFS=$IFS; IFS=':' certificates=$(echo | openssl s_client -showcerts -servername $URL -connect $URL:$PORT 2>/dev/null | sed -n '/-----BEGIN/,/-----END/ {/-----BEGIN/ s/^/:/; p}'); for certificate in ${certificates#:}; do echo;echo $certificate | openssl x509 -noout -subject -issuer -dates ;fichero=`echo $certificate | openssl x509 -noout -subject|awk {'print $NF'}`; echo $certificate > ${fichero}.crt; done; IFS=$OLDIFS
Firefox
Para importar un certificado en firefox:
https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/198841
Crear o generar Certificado autofirmado Creamos Petición:
openssl req -new -nodes -keyout www.lobo99.com.key -out www.lobo99.com.csr -subj "/C=ES/ST=Catalonia/L=Mataro/O=lobo99/CN=www.lobo99.com"
Firmamos el certificado:
openssl x509 -req -days 3650 -in www.lobo99.com.csr -signkey www.lobo99.com.key -out www.lobo99.com.crt
informatica/linux/certificados.1726753015.txt.gz · Last modified: 2024/09/19 13:36 by jose