This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
136 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/sh | ||
|
||
mkdir -p certs | ||
|
||
# create CA certificate | ||
openssl req -config "$(dirname "$0")"/ssl.cnf -new -sha256 -nodes -extensions v3_ca -out ./certs/ca.csr -keyout ./certs/ca-key.pem | ||
openssl req -config "$(dirname "$0")"/ssl.cnf -key ./certs/ca-key.pem -x509 -new -days 7300 -sha256 -nodes -extensions v3_ca -out ./certs/ca.pem | ||
|
||
# Create certificate for DB | ||
openssl req -config "$(dirname "$0")"/ssl.cnf -new -nodes -newkey rsa:4096 -keyout ./certs/db-key.pem -out ./certs/db.csr -extensions server_cert | ||
openssl x509 -req -in ./certs/db.csr -days 1200 -CA ./certs/ca.pem -CAkey ./certs/ca-key.pem -set_serial 01 -out ./certs/db.pem -extensions server_cert -extfile "$(dirname "$0")"/ssl.cnf | ||
|
||
# Create certificate for minio | ||
openssl req -config "$(dirname "$0")"/ssl.cnf -new -nodes -newkey rsa:4096 -keyout ./certs/s3-key.pem -out ./certs/s3.csr -extensions server_cert | ||
openssl x509 -req -in ./certs/s3.csr -days 1200 -CA ./certs/ca.pem -CAkey ./certs/ca-key.pem -set_serial 01 -out ./certs/s3.pem -extensions server_cert -extfile "$(dirname "$0")"/ssl.cnf | ||
|
||
# Create client certificate | ||
openssl req -config "$(dirname "$0")"/ssl.cnf -new -nodes -newkey rsa:4096 -keyout ./certs/client-key.pem -out ./certs/client.csr -extensions client_cert | ||
openssl x509 -req -in ./certs/client.csr -days 1200 -CA ./certs/ca.pem -CAkey ./certs/ca-key.pem -set_serial 01 -out ./certs/client.pem -extensions client_cert -extfile "$(dirname "$0")"/ssl.cnf | ||
|
||
# Create download certificate | ||
openssl req -config "$(dirname "$0")"/ssl.cnf -new -nodes -newkey rsa:4096 -keyout ./certs/download-key.pem -out ./certs/download.csr -extensions download_cert | ||
openssl x509 -req -in ./certs/download.csr -days 1200 -CA ./certs/ca.pem -CAkey ./certs/ca-key.pem -set_serial 01 -out ./certs/download.pem -extensions download_cert -extfile "$(dirname "$0")"/ssl.cnf | ||
|
||
chmod 644 ./certs/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
[ ca ] | ||
# `man ca` | ||
default_ca = CA_default | ||
|
||
[ CA_default ] | ||
# Directory and file locations. | ||
dir = ./certs | ||
certs = $dir | ||
crl_dir = $dir | ||
new_certs_dir = $dir | ||
database = $dir/index.txt | ||
serial = $dir/serial | ||
RANDFILE = $dir/rand | ||
|
||
# The root key and root certificate. | ||
private_key = $dir/ca-key.pem | ||
certificate = $dir/ca.pem | ||
|
||
# SHA-1 is deprecated, so use SHA-2 instead. | ||
default_md = sha256 | ||
|
||
name_opt = ca_default | ||
cert_opt = ca_default | ||
default_days = 7300 | ||
preserve = no | ||
policy = policy_strict | ||
|
||
[ policy_strict ] | ||
# The root CA should only sign intermediate certificates that match. | ||
# See the POLICY FORMAT section of `man ca`. | ||
countryName = match | ||
stateOrProvinceName = match | ||
organizationName = match | ||
organizationalUnitName = optional | ||
commonName = supplied | ||
emailAddress = optional | ||
|
||
[ req ] | ||
# Options for the `req` tool (`man req`). | ||
default_bits = 4096 | ||
distinguished_name = req_distinguished_name | ||
string_mask = utf8only | ||
prompt = no | ||
|
||
# SHA-1 is deprecated, so use SHA-2 instead. | ||
default_md = sha256 | ||
|
||
# Extension to add when the -x509 option is used. | ||
x509_extensions = v3_ca | ||
|
||
[ req_distinguished_name ] | ||
countryName = SE | ||
stateOrProvinceName = Sweden | ||
localityName = Uppsala | ||
0.organizationName = NBIS | ||
organizationalUnitName = SysDev | ||
commonName = SysDev root CA | ||
|
||
[ v3_ca ] | ||
# Extensions for a typical CA (`man x509v3_config`). | ||
subjectKeyIdentifier = hash | ||
authorityKeyIdentifier = keyid:always,issuer | ||
basicConstraints = critical, CA:true | ||
keyUsage = critical, digitalSignature, cRLSign, keyCertSign | ||
#nsCertType = sslCA | ||
nsComment = "LocalEGA Root CA" | ||
|
||
[ server_client_cert ] | ||
# Extensions for server+client certificates (`man x509v3_config`). | ||
basicConstraints = CA:FALSE | ||
nsCertType = server,client | ||
nsComment = "LocalEGA Server+Client Certificate" | ||
subjectKeyIdentifier = hash | ||
authorityKeyIdentifier = keyid,issuer:always | ||
keyUsage = critical, digitalSignature, keyEncipherment | ||
extendedKeyUsage = critical, clientAuth, serverAuth | ||
|
||
[ client_cert ] | ||
# Extensions for client certificates (`man x509v3_config`). | ||
basicConstraints = critical,CA:FALSE | ||
subjectKeyIdentifier = hash | ||
authorityKeyIdentifier = keyid,issuer:always | ||
keyUsage = critical, digitalSignature, keyEncipherment | ||
extendedKeyUsage = clientAuth, serverAuth | ||
subjectAltName = DNS:localhost,DNS:client,IP:127.0.0.1 | ||
|
||
[ download_cert ] | ||
# Extensions for client certificates (`man x509v3_config`). | ||
basicConstraints = critical,CA:FALSE | ||
subjectKeyIdentifier = hash | ||
authorityKeyIdentifier = keyid,issuer:always | ||
keyUsage = critical, digitalSignature, keyEncipherment | ||
extendedKeyUsage = clientAuth, serverAuth | ||
subjectAltName = DNS:localhost,DNS:download,IP:127.0.0.1 | ||
|
||
[ server_cert ] | ||
# Extensions for server certificates (`man x509v3_config`). | ||
basicConstraints = critical,CA:FALSE | ||
subjectKeyIdentifier = hash | ||
authorityKeyIdentifier = keyid,issuer:always | ||
keyUsage = critical, digitalSignature, keyEncipherment | ||
extendedKeyUsage = clientAuth, serverAuth | ||
subjectAltName = DNS:localhost,DNS:db,DNS:s3,IP:127.0.0.1 | ||
|
||
[ crl_ext ] | ||
# Extension for CRLs (`man x509v3_config`). | ||
authorityKeyIdentifier=keyid:always |