- Create environment for CA:
choose a location - I'm using /ldap/sslCA for convenience, but you should
think about security (e.g. avoid using an nfs export?)
mkdir /ldap/sslCA
cd /ldap/sslCA
mkdir certs private
chmod 700 private
echo '01' > serial /* must be in hex */
touch index.txt
- Build an OpenSSL Config File:
# config for general operation of the CA:
[ ca ]
default_ca = shellgritca
[ shellgritca ]
dir = /ldap/sslCA
certificate = $dir/cacert.pem
database = $dir/index.txt
new_certs_dir = $dir/certs
private_key = $dir/private/cakey.pem
serial = $dir/serial
default_crl_days = 7
default_days = 365
default_md = md5
policy = shellgritca_policy
x509_extensions = certificate_extensions
[ shellgritca_policy ]
commonName = supplied
stateOrProvinceName = supplied
countryName = supplied
emailAddress = optional
organizationName = supplied
organizationalUnitName = optional
[ certificate_extensions ]
basicConstraints = CA:false
# additional configuration required to generate the CA's self-signed root certificate:
[ req ]
default_bits = 2048
default_keyfile = /ldap/sslCA/private/cakey.pem
default_md = md5
prompt = no
distinguished_name = root_ca_disinguished_name
x509_extensions = root_ca_extensions
[ root_ca_disinguished_name ]
commonName = Shellgrit CA
stateOrProvinceName = South Australia
countryName = AU
emailAddress = ca@shellgrit.com
organizationName = Shellgrit Root Certification Authority
[ root_ca_extensions ]
basicConstraints = CA:true
- Tell OpenSSL where to find the config file:
# export OPENSSL_CONF=/ldap/sslCA/openssl.conf
- Create a new pair of keys and a self-signed root certificate:
# cd /ldap/sslCA
# openssl req -x509 -days 3660 -newkey rsa -out cacert.pem -outform PEM
Generating a 2048 bit RSA private key
..............................................+++
...........+++
writing new private key to '/ldap/sslCA/private/cakey.pem'
Enter PEM pass phrase:shellgritCAkey
Verifying - Enter PEM pass phrase:shellgritCAkey
-----
- The pass phrase will be used to encrypt the private key, and will need to
be supplied whenever the private key needs to be used (eg for signing a
certificate).
- It's possible to create your root private key without password protection,
but it makes sense to use all the security measures you can, since the
security of every certificate (and CRL) you publish depends on it.
Have a look at what we created: