Editing
Creating a CA and certificates
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Create the CA Key and Certificate === openssl req -x509 -newkey rsa:2048 -nodes -days 9999 -subj /O=WilliamsNet/C=US/CN=<CA name>/ -keyout <CA file>.key -out <CA file>.crt === Create the Certificate Signing Request === openssl req -newkey rsa:2048 -nodes -subj /O=WilliamsNet/C=US/CN=<cert CN>/ -keyout <cert file>.key -out <cert file>.csr === Create the Certificate === If just a simple certificated is needed, this can be done in one step: openssl x509 -req -in <cert file>.csr -CA <CA cert> -CAkey <CA key> -CAcreateserial -out <cert file>.crt -days 9999 -sha256 === Create a Certificate with SAN === If a certificate with SAN entries is needed, a configuration file is needed to specify the SAN items required. The CN itself (specified when creating the certificate request) should be included as one of the SAN entries, as some newer applications actually ignore the CN: authorityKeyIdentifier=keyid,issuer basicConstraints=CA:FALSE keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment subjectAltName = @alt_names [alt_names] DNS.1 = 10.0.0.61 DNS.2 = compute1.williams.localnet DNS.3 = compute1 Create the certificate: openssl x509 -req -in <cert file>.csr -CA <CA cert> -CAkey <CA key> -CAcreateserial -out <cert file>.crt -days 9999 -sha256 \ -extfile <cert file>.cnf === Convert Key to PKCS8 Format === Some applications (OpenSearch included) require all keys to be in PKCS8 format: openssl pkcs8 -inform PEM -outform PEM -in <cert file>.key -topk8 -nocrypt -v1 PBE-SHA1-3DES -out <cert files>-pkcs8.key === Create PKCS12 Keystore === openssl pkcs12 -export -in <cert file> -inkey <key file> \ -out <cert name>.p12 -name [<cert.name>] \ -CAfile <CAcert> -caname root === Validating that a key/crt is correct === openssl pkey -pubout -outform pem -in privateKey.key | sha256sum openssl x509 -pubkey -noout -outform pem -in certificate.crt | sha256sum openssl req -pubkey -noout -outform pem -in CSR.csr | sha256sum === Helper Scripts === Helper scripts are in the repository (and in /work/bin): cert-create-ca <CA name> <CA file> cert-create <CN> <CAcert> <CAkey> <cert file> cert-create-san <hostname> <CAcert> <CAkey> <cert file> cert-import-keystore <cert file> <key file> <CAcert> <base name>
Summary:
Please note that all contributions to WilliamsNet Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
WilliamsNet Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Navigation
Commons
Architecture
How-To
Systems
Hardware
SysAdmin
Kubernetes
OpenSearch
Special
Pages to create
All pages
Recent changes
Random page
Help about MediaWiki
Formatting Help
Tools
What links here
Related changes
Special pages
Page information