how to create a SSL certificate with a kickstart on the installation.

One solution is use this script for generate a self-sign certificate and adapt the values to you necessities.

%post
cd /etc/ssl/certs

#!/bin/bash
domain=server.redhat.com   <--Specify you hostname and domain
commonname=$domain

#Change to your company details    <--- Change according with you company information.
country=US
state=Texas
locality=Brownsville
organization=example
organizationalunit=data
email=administrator@example.com

#Optional
password=password

if [ -z "$domain" ]
then
    echo "Argument not present."
    echo "Useage $0 [common name]"

    exit 99
fi

echo "Generating key request for $domain"

#Generate a key
openssl genrsa -des3 -passout pass:$password -out $domain.key 2048 -noout

#Remove passphrase from the key. Comment the line out to keep the passphrase
echo "Removing passphrase from key"
openssl rsa -in $domain.key -passin pass:$password -out $domain.key

#Create the request
echo "Creating CSR"
openssl req -new -key $domain.key -out $domain.csr -passin pass:$password \
    -subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$organizationalunit/CN=$commonname/emailAddress=$email"\
    -days 1825
%end

Comments

Popular posts from this blog

How to clean all the foreman task and locked task

How to restrict users to send only mail to the local domain in Zimbra

Hardening Script