|
| 1 | +# Creates Intermediate CA cert+key with specified parameters. |
| 2 | +# This intermediate CA can be put into Vault Cert endpoint and is used to verify the client cert given to Kleidi. |
| 3 | +# create folder intermediate, serial.txt and index.txt |
| 4 | +# openssl req -config openssl-intermediate.conf -newkey rsa:4096 -sha256 -nodes -out intermediate/intermediate.csr -outform PEM |
| 5 | +# openssl ca -config openssl-ca.conf -policy signing_policy -extensions v3_intermediate_ca -out intermediate/intermediate-cacert.pem -infiles intermediate/intermediate.csr |
| 6 | + |
| 7 | +HOME = . |
| 8 | +RANDFILE = $ENV::HOME/.rnd |
| 9 | +#################################################################### |
| 10 | +[ ca ] |
| 11 | +default_ca = CA_default # The default ca section |
| 12 | + |
| 13 | +[ CA_default ] |
| 14 | + |
| 15 | +default_days = 365 # How long to certify for |
| 16 | +default_crl_days = 30 # How long before next CRL |
| 17 | +default_md = sha256 # Use public key default MD |
| 18 | +preserve = no # Keep passed DN ordering |
| 19 | + |
| 20 | +x509_extensions = ca_extensions # The extensions to add to the cert |
| 21 | + |
| 22 | +email_in_dn = no # Don't concat the email in the DN |
| 23 | +copy_extensions = copy # Required to copy SANs from CSR to cert |
| 24 | + |
| 25 | +base_dir = . |
| 26 | +certificate = $base_dir/intermediate/intermediate-cacert.pem # The CA certifcate |
| 27 | +private_key = $base_dir/intermediate/intermediate-cakey.pem # The CA private key |
| 28 | +new_certs_dir = $base_dir/intermediate # Location for new certs after signing |
| 29 | +database = $base_dir/intermediate/index.txt # Database index file |
| 30 | +serial = $base_dir/intermediate/serial.txt # The current serial number |
| 31 | + |
| 32 | +unique_subject = no # Set to 'no' to allow creation of several certificates with same subject. |
| 33 | +#################################################################### |
| 34 | +[ req ] |
| 35 | +default_bits = 4096 |
| 36 | +default_keyfile = intermediate-cakey.pem |
| 37 | +distinguished_name = ca_distinguished_name |
| 38 | +x509_extensions = ca_extensions |
| 39 | +string_mask = utf8only |
| 40 | +#################################################################### |
| 41 | +[ ca_distinguished_name ] |
| 42 | +countryName = Country Name (2 letter code) |
| 43 | +countryName_default = AA |
| 44 | + |
| 45 | +stateOrProvinceName = State or Province Name (full name) |
| 46 | +stateOrProvinceName_default = AAAAA |
| 47 | + |
| 48 | +localityName = Locality Name (eg, city) |
| 49 | +localityName_default = AAAAA |
| 50 | + |
| 51 | +organizationName = Organization Name (eg, company) |
| 52 | +organizationName_default = Some Company Ltd. |
| 53 | + |
| 54 | +organizationalUnitName = Organizational Unit (eg, division) |
| 55 | +organizationalUnitName_default = Some-Org |
| 56 | + |
| 57 | +commonName = Common Name (e.g. server FQDN or YOUR name) |
| 58 | +commonName_default = Kleidi-IntermediateCA |
| 59 | + |
| 60 | +#################################################################### |
| 61 | +[ ca_extensions ] |
| 62 | +subjectKeyIdentifier = hash |
| 63 | +authorityKeyIdentifier = keyid:always,issuer |
| 64 | +basicConstraints = critical, CA:true, pathlen:0 |
| 65 | +subjectAltName = @alternate_names |
| 66 | +keyUsage = critical, digitalSignature, cRLSign, keyCertSign |
| 67 | +#################################################################### |
| 68 | +[ server_req_extensions ] |
| 69 | +subjectKeyIdentifier = hash |
| 70 | +basicConstraints = CA:TRUE |
| 71 | +keyUsage = digitalSignature, keyEncipherment |
| 72 | +extendedKeyUsage = serverAuth, clientAuth |
| 73 | +subjectAltName = @alternate_names |
| 74 | +nsComment = "OpenSSL Generated Certificate - Intermediate CA" |
| 75 | +#################################################################### |
| 76 | +[ signing_policy ] |
| 77 | +countryName = optional |
| 78 | +stateOrProvinceName = optional |
| 79 | +localityName = optional |
| 80 | +organizationName = optional |
| 81 | +organizationalUnitName = optional |
| 82 | +commonName = supplied |
| 83 | +emailAddress = optional |
| 84 | +#################################################################### |
| 85 | +[ signing_req ] |
| 86 | +subjectKeyIdentifier = hash |
| 87 | +authorityKeyIdentifier = keyid,issuer |
| 88 | +basicConstraints = CA:FALSE |
| 89 | +keyUsage = digitalSignature, keyEncipherment |
| 90 | +#################################################################### |
| 91 | +[ alternate_names ] |
| 92 | +# adjust to your needs |
| 93 | +DNS.1 = intermediate.example.com |
| 94 | +# DNS.2 = www.example.com |
| 95 | +# DNS.3 = mail.example.com |
| 96 | +# DNS.4 = ftp.example.com |
| 97 | +# IPv4 localhost |
| 98 | +IP.1 = 127.0.0.1 |
| 99 | +# IPv6 localhost |
| 100 | +IP.2 = ::1 |
0 commit comments