Ldfa Posté(e) le 30 décembre 2019 Partager Posté(e) le 30 décembre 2019 #!/bin/sh # Generates a self-signed certificate. # Edit openssl.cnf before running this. umask 077 OPENSSL=${OPENSSL-openssl} # Define SSL directory SSLDIR=${SSLDIR-/opt} # Define SSL config file OPENSSLCONFIG=${OPENSSLCONFIG-/opt/openssl.cnf} # Define crt/key directories CERTDIR=$SSLDIR/certs KEYDIR=$SSLDIR/private # Define crt/key file CERTFILE=$CERTDIR/mynewssl.pem KEYFILE=$KEYDIR/mynewssl.key # Define validity duration for the cert DAYS=365 # Check that directories exist or create themt if [ ! -d $CERTDIR ]; then mkdir -p $CERTDIR fi if [ ! -d $KEYDIR ]; then mkdir -p $KEYDIR fi # Check that the files do not exist or move them if [ -f $CERTFILE ]; then mv $CERTFILE $CERTFILE.old fi if [ -f $KEYFILE ]; then mv $KEYFILE $KEYFILE.old fi # Generate crt/key files $OPENSSL req -new -x509 -nodes -config $OPENSSLCONFIG -out $CERTFILE -keyout $KEYFILE -days $DAYS || exit 2 chmod 0600 $KEYFILE echo $OPENSSL x509 -subject -fingerprint -noout -in $CERTFILE || exit 2 Afficher l’article complet Lien vers le commentaire Partager sur d’autres sites More sharing options...
Messages recommandés
Archivé
Ce sujet est désormais archivé et ne peut plus recevoir de nouvelles réponses.