Explain how to generate a CA
This commit is contained in:
parent
cb7dc99f5b
commit
eaacbca6dc
2 changed files with 139 additions and 3 deletions
47
README.md
47
README.md
|
@ -8,4 +8,51 @@ The Public Certificate of the CA and its Private Key are ansible variables. Make
|
|||
|
||||
## Generate a CA
|
||||
|
||||
### Generate a key
|
||||
|
||||
```
|
||||
openssl genrsa -out ca.key -aes256 4096
|
||||
```
|
||||
|
||||
It will ask a passphrase. Put the passphrase in a vault as `ca_passphrase`.
|
||||
|
||||
Then, put the content of `ca.key` in the vaul:
|
||||
|
||||
```
|
||||
ca_key: |
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
Proc-Type: 4,ENCRYPTED
|
||||
DEK-Info: AES-256-CBC,EABBE7D2AC7D31F05392F733E9F9B031
|
||||
|
||||
vbKyyhou4oJIZEXL1U4ESbUJ/r5Im9lZNatJwZISOnD3E//+Vf3QaIb+sQ2xNym9
|
||||
...
|
||||
iKkhjgSIm7tWWR5lxd/dpeoEM/+tvcZ0KJqFsbPv9jmZPl4/PfBf7O185K7KCY9L
|
||||
-----END RSA PRIVATE KEY-----
|
||||
```
|
||||
|
||||
### Generate the certificate
|
||||
|
||||
```
|
||||
openssl req -new -x509 -days 3650 -key ca.key -out ca.pem
|
||||
```
|
||||
|
||||
You can replace `3650` by the validity periode you want for your certificate.
|
||||
|
||||
You will be ask questions for the content of the certificate, answer adequately.
|
||||
|
||||
Then, put the content of `ca.pem` in the variables as `ca_cert`:
|
||||
|
||||
```
|
||||
ca_cert: |
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIF7TCCA9WgAwIBAgIURKS2ggzKV0XKM6IdSqPjDvsr9AowDQYJKoZIhvcNAQEL
|
||||
...
|
||||
YRj4p9wG46WoMCvnNxdgL2/MQfp+Y8rinDEk1BG1Zb8g
|
||||
-----END CERTIFICATE-----
|
||||
```
|
||||
|
||||
Then, don't forget to remode the file `ca.key`.
|
||||
|
||||
|
||||
|
||||
## How does it works ?
|
||||
|
|
|
@ -1,4 +1,93 @@
|
|||
---
|
||||
ca_public:
|
||||
# This variable HAS to be storred in a vault.
|
||||
ca_private:
|
||||
ca_cert: |
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIF7TCCA9WgAwIBAgIURKS2ggzKV0XKM6IdSqPjDvsr9AowDQYJKoZIhvcNAQEL
|
||||
BQAwgYUxCzAJBgNVBAYTAkVYMRAwDgYDVQQIDAdleGFtcGxlMRAwDgYDVQQHDAdl
|
||||
eGFtcGxlMRowGAYDVQQKDBFBbnNpYmxlIEhhY2t5IFBLSTEaMBgGA1UECwwRQW5z
|
||||
aWJsZSBIYWNreSBQS0kxGjAYBgNVBAMMEWFuc2lsYmUtaGFja3ktcGtpMB4XDTIx
|
||||
MDkwODE1NDQ0MVoXDTMxMDkwNjE1NDQ0MVowgYUxCzAJBgNVBAYTAkVYMRAwDgYD
|
||||
VQQIDAdleGFtcGxlMRAwDgYDVQQHDAdleGFtcGxlMRowGAYDVQQKDBFBbnNpYmxl
|
||||
IEhhY2t5IFBLSTEaMBgGA1UECwwRQW5zaWJsZSBIYWNreSBQS0kxGjAYBgNVBAMM
|
||||
EWFuc2lsYmUtaGFja3ktcGtpMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKC
|
||||
AgEA2htZI/32cf2VJlzAkzEEBlaEul7l+pl5rM/i+sYr/1i0m6L1g0qQjAwnxw5g
|
||||
6PeiIxd8i9Ea12DyhmXfKVZBqZy8t6kqw97qbXe1duUuadwkb5OWGZvb/z5UbkuY
|
||||
Q+EeqTfFdTkhNzB4Z6AfGW4C856tdEUYE1SfzLIQC77kXwJ4DJ4PrDaf5PeX8gMr
|
||||
do2JL12Ns+SV75cJ/IiOaSwDPQLkvqwYqgCN7m3eYXFMs7vZLvvttBN3sQjnpCCF
|
||||
IW62mW1CjnBwfbktjDRuLFve2h3rSvYFbd2KPsjpvhhB6xer1MJSBzHgxU+tIXXb
|
||||
bOCsU/0hH5L9zLH4O5ncmfLeYovzDuAvYfxAQ+Mq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2fi
|
||||
+q7vv/7miOJemb14ILp0kWvlOOFOnYnIn9F8lTVQosq1fzmxMcLsLiA5QV4ucvgk
|
||||
UJnwkzvSx1cIg9o50RL81YyqAG5zFT3SoZIaHxrNM45FJVUBCRocgV+B48L2sRlE
|
||||
YRj4p9wG46WoMCvnNxdgL2/MQfp+Y8rinDEk1BG1Zb8g
|
||||
-----END CERTIFICATE-----
|
||||
# This variables HAVE to be storred in a vault.
|
||||
ca_key: |
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
Proc-Type: 4,ENCRYPTED
|
||||
DEK-Info: AES-256-CBC,EABBE7D2AC7D31F05392F733E9F9B031
|
||||
|
||||
vbKyyhou4oJIZEXL1U4ESbUJ/r5Im9lZNatJwZISOnD3E//+Vf3QaIb+sQ2xNym9
|
||||
zbAPtLW5KCrmda8rf93NVRMC4sOr4+NVIxL3YUc49N3ziu82qETXxOUU1doXk+1k
|
||||
U+h+LPU0jcVeqExcY5RZVHibC63T+3i50DmPH//WeaiXPrvzuJ5aNjGP6Ku7Odlo
|
||||
SLWZOG1kLYL6y4iM6A2s15IA+8J/itSDACW4yp1cnLD96nkxU0L/vKQ+PEV9cuMi
|
||||
1UeLbUfAKMhQNJyaIOAB7OwJ+tDQQFsUIbqv0FKWlNYCanjqvRHjzyEj1jgTyBwH
|
||||
t9KWHljJk5459ko9wbcdRwXisoTNuUMboEFqeJSPJAPpv0HN+kE4rlgaKXOKemtv
|
||||
mQBuxm78BiUzdn9oWDBoRmSs6NP1YtZbAbdJ5HWdQtNy+zIMt3UT4gsVHBYijilJ
|
||||
+YDeNMXsE9w735Hg4zx6AtDjfMlGAZrnUj7TWBDhRI81wtfZAgkPzFNo6dweQGwJ
|
||||
dfSfU6kRyqhtO8jip/BzE0pxuqSZM7UwxZC4TwALTES2QHLvQj3r2yXwft5BoRry
|
||||
Np5DtiMUqUafCuzlZJ1Uql7fgqWlfe0sL9FNnDo+6gBgIMu1oY+rfr5O7Q5ssFko
|
||||
01qTZjZt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3ICj
|
||||
vP9eImtmYbeUF8pTpAehLbAsk9p9PjqGiKVq3AIVzVJ1rKMmYddr+qHHp0dNsdNJ
|
||||
Vg4cLUISh7ZCRhr3JEs3Ldmt7pPcHjlE6fTjXDLojnc3CQdiNOkGgrXciIb0pkji
|
||||
5b4UMiAqfdrC5E1/QFBiuEp4VhX20kdVQmEMyfyvhfJX3tMfjKCTanehgYAsl7Fm
|
||||
17hyZ3DLPFhNtcZWLuBOsKr3fQxpBevbHDxn2rzN5vKAq7QbKN0mEvA5xgq0PU8W
|
||||
UipW5ZkKnc8LWkkzhc4aAU6qtvVddqwZgSxAcdmum+0YM71Fw8+PWmrMaTe8myrz
|
||||
v1JPtjVvj4mFeHNDmid6m3COqOpUpKLJTqTvR3d/7jpIEW3lTTOCzwtSP1csENXO
|
||||
s5nq8xvZBmmXXV8CyolEKqTe3dqOeddLLZTTicXi15eZX3ZxlhY8HQmx3Ybffn7y
|
||||
iKkhjgSIm7tWWR5lxd/dpeoEM/+tvcZ0KJqFsbPv9jmZPl4/PfBf7O185K7KCY9L
|
||||
-----END RSA PRIVATE KEY-----
|
||||
ca_passphrase: seCuREpaSsphRasE
|
||||
|
|
Loading…
Reference in a new issue