-
Notifications
You must be signed in to change notification settings - Fork 0
Creating a self CA for SSL connections when testing #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
m0wer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing job! Thanks :-)
|
|
||
| - name: Create self-signed root certificate (CA), if testing. | ||
| command: > | ||
| openssl req -x509 -new -nodes -subj '/CN=lili' -days 30 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¿Why lili? ¿Couldn't it be anarres instad?
| -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¿Why?
| authorityKeyIdentifier=keyid,issuer | ||
| basicConstraints=CA:FALSE | ||
| keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment | ||
| subjectAltName = @alt_names | ||
|
|
||
| [alt_names] | ||
| DNS.1 = {{ domain }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
¿Can you explain this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ping @acien101.
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.