Creating a self CA for SSL connections when testing#3
Open
Creating a self CA for SSL connections when testing#3
Conversation
m0wer
requested changes
Oct 14, 2019
|
|
||
| - name: Create self-signed root certificate (CA), if testing. | ||
| command: > | ||
| openssl req -x509 -new -nodes -subj '/CN=lili' -days 30 |
Member
There was a problem hiding this comment.
¿Why lili? ¿Couldn't it be anarres instad?
Comment on lines
+89
to
+96
| -newkey rsa:4096 -sha256 -keyout /etc/letsencrypt/live/CA/rootCA.key | ||
| -out /etc/letsencrypt/live/CA/rootCA.pem | ||
| args: | ||
| creates: /etc/letsencrypt/live/CA/rootCA.pem | ||
| ignore_errors: yes | ||
| when: | ||
| - testing is defined | ||
| - letsencrypt_cert.stat.exists == False |
Member
There was a problem hiding this comment.
With the condition letsencrypt_cert.stat.exists == False we're only checking that the cert for {{ domain }} exists so if the CA was already created this command is going to overwrite it. Even if it doesn't the condition must be related to the file it creates. You could use
args:
creates: /path/to/filein the command task so it's only executed if the rootCA.key doesn't already exist.
| openssl req -x509 -nodes -subj '/CN={{ domain }}' -days 30 | ||
| -newkey rsa:4096 -sha256 -keyout /etc/letsencrypt/live/{{ domain }}/privkey.pem | ||
| -out /etc/letsencrypt/live/{{ domain }}/cert.pem | ||
| openssl req -new -nodes -subj '/CN=lili' -days 30 \ |
Member
There was a problem hiding this comment.
Same here with the CN, maybe using the {{ domain }} is a better idea.
| template: | ||
| src: san_template.ext.j2 | ||
| dest: "/etc/letsencrypt/live/{{ domain }}/{{ domain }}.ext" | ||
| ignore_errors: yes |
Comment on lines
+1
to
+7
| authorityKeyIdentifier=keyid,issuer | ||
| basicConstraints=CA:FALSE | ||
| keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment | ||
| subjectAltName = @alt_names | ||
|
|
||
| [alt_names] | ||
| DNS.1 = {{ domain }} |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Creating a self CA for signing certificates when testing. Otherwise, chrome dont accept connections to localhost, because certificate is not valid.
Using this doc and this one
To establish SSL connection, add the rootCA.pem to your system certificates, located on the host machine on
/etc/letsencrypt/live/CA/rootCA.pem.