Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #51 from palantirnet/self-signed-san
Browse files Browse the repository at this point in the history
Generate better self-signed certs
  • Loading branch information
becw authored Jul 27, 2018
2 parents bae27be + b6a5b0b commit 49b266d
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions conf/vagrant/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ Vagrant.configure(2) do |config|
ansible.extra_vars = {
"project" => project,
"hostname" => hostname,
"extra_hostnames" => extra_hostnames,
"solr_enabled" => ansible_solr_enabled,
"https_enabled" => ansible_https_enabled,
"project_web_root" => ansible_project_web_root,
Expand Down
8 changes: 7 additions & 1 deletion conf/vagrant/provisioning/roles/https/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@
when: https_enabled == True
tags: https

- name: Add config for self-signed certs
become: True
template: src=san.cnf dest=/etc/apache2/ssl/san.cnf
when: https_enabled == True
tags: https

- name: Generate self-signed certificate
become: True
command: openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt -subj "/C=US/ST=Illinois/L=Evanston/O=Palantir.net, Inc./OU=DevOps/CN={{ hostname }}"
command: openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt -subj "/C=US/ST=Illinois/L=Evanston/O=Palantir.net, Inc./OU=DevOps/CN={{ hostname }}" -config /etc/apache2/ssl/san.cnf
when: https_enabled == True
tags: https

Expand Down
19 changes: 19 additions & 0 deletions conf/vagrant/provisioning/roles/https/templates/san.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
x509_extensions = v3_req

[req_distinguished_name]
commonName = {{ hostname }}
organizationName = Palantir.net, Inc.
localityName = Evanston
countryName = US

[v3_req]
# The extentions to add to a self-signed cert
subjectKeyIdentifier = hash
basicConstraints = critical,CA:false
subjectAltName = DNS:{{ hostname }},DNS:www.{{ hostname }}{% for host in extra_hostnames %}
,DNS:{{ host }}
{% endfor %}
keyUsage = critical,digitalSignature,keyEncipherment

0 comments on commit 49b266d

Please sign in to comment.