software:openssl:createca
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
software:openssl:createca [2025/10/19 03:10] – created rodolico | software:openssl:createca [2025/10/19 03:55] (current) – rodolico | ||
---|---|---|---|
Line 30: | Line 30: | ||
openssl genpkey -algorithm RSA --outform PEM --des3 --out DailyDataCA.key --pkeyopt rsa_keygen_bits: | openssl genpkey -algorithm RSA --outform PEM --des3 --out DailyDataCA.key --pkeyopt rsa_keygen_bits: | ||
# Create a CA certificate from it. You'll need to answer a bunch of questions here | # Create a CA certificate from it. You'll need to answer a bunch of questions here | ||
+ | # see " | ||
openssl req -x509 -new -key DailyDataCA.key -sha256 -days 3650 -out DailyDataCA.crt | openssl req -x509 -new -key DailyDataCA.key -sha256 -days 3650 -out DailyDataCA.crt | ||
</ | </ | ||
Line 60: | Line 61: | ||
**Note**: The old way of generating keys was to use the command <code bash> | **Note**: The old way of generating keys was to use the command <code bash> | ||
+ | |||
+ | ==== Create a configuration file ==== | ||
+ | |||
+ | By creating a configuration file, you can bypass a lot of redundant questions and answers when generating certificates. I name it openssl.cnf and place it in the directory with my CA files. The following is not correct at this time (stil working on the documentation). | ||
+ | |||
+ | <code conf openssl.cnf> | ||
+ | # this section is for requests | ||
+ | [ req ] | ||
+ | default_bits | ||
+ | default_md | ||
+ | prompt | ||
+ | distinguished_name | ||
+ | |||
+ | # section holds Distinguished Name fields so we don't have to enter them all the time | ||
+ | # Instead of abbreviations used below, may also use | ||
+ | # commonName, countryName, | ||
+ | [ req_distinguished_name ] | ||
+ | C = GB | ||
+ | ST = Test State or Province | ||
+ | L = Test Locality | ||
+ | O = Organization Name | ||
+ | OU = Organizational Unit Name | ||
+ | CN = Common Name | ||
+ | emailAddress | ||
+ | |||
+ | # used when generating certificate of authorities (ca) | ||
+ | [ v3_ca ] | ||
+ | subjectKeyIdentifier=hash | ||
+ | authorityKeyIdentifier=keyid: | ||
+ | basicConstraints = critical, CA:true | ||
+ | </ | ||
+ | |||
==== Create the CA Cert ==== | ==== Create the CA Cert ==== | ||
Line 72: | Line 105: | ||
| | ||
-days 3650 \ | -days 3650 \ | ||
+ | | ||
+ | | ||
-out DailyDataCA.pem | -out DailyDataCA.pem | ||
</ | </ | ||
- | This will read the key file (.key) and generate a certificate from it. | + | This will read the key file (.key) and generate a certificate from it. Parameters are: |
+ | * //req// - We are doing a certificate request | ||
+ | * //-x509// - we want an X509 certificate created. This is a self-signed certificate (instead of a certificate request). Required for generating a CA | ||
+ | * //-new// - Create a new certificate. This will require you to answer questions to generate a Distinguished Name (DN) if you did not create a config file with that information. | ||
+ | * //-key// - the name of the keyfile created earlier | ||
+ | * //-sha256// - The digest used to create the certificate. This is the default for RSA and only here for documentation | ||
+ | * //-days// - The number of days the certificate is valid. Before this time is up, a new CA must be generated, deployed to all workstations and new certs signed by the new key deployed to all services. Default is 30 days, but we set it to 10 years. | ||
+ | * //-config// - Name of the configuration file to use (if you created one). | ||
+ | * // | ||
+ | * //-out// - name of the output file. | ||
+ | ==== Modify openssl.cnf ==== | ||
- | Country Name (2 letter | + | <code conf> |
- | State or Province Name (full name) [Some-State]:Texas | + | [ ca ] |
- | Locality Name (eg, city) []:Dallas | + | default_ca = CA_default |
- | Organization Name (eg, company) [Internet Widgits Pty Ltd]:Daily Data | + | |
- | Organizational Unit Name (eg, section) []:Home Office | + | |
- | Common Name (e.g. server FQDN or YOUR name) []:Rod | + | |
- | Email Address []: | + | |
+ | [ CA_default ] | ||
+ | dir = ./ | ||
+ | database | ||
+ | new_certs_dir | ||
+ | certificate | ||
+ | private_key | ||
+ | default_md | ||
+ | preserve | ||
+ | policy | ||
+ | |||
+ | [ policy_any ] | ||
+ | countryName | ||
+ | stateOrProvinceName | ||
+ | organizationName | ||
+ | organizationalUnitName | ||
+ | commonName | ||
+ | emailAddress | ||
+ | </ |
software/openssl/createca.1760861448.txt.gz · Last modified: 2025/10/19 03:10 by rodolico