Browse Source

Merge pull request #88 from jlund/openvpn-expiration

Updated the OpenVPN role so certificate expiration is handled correctly
Luke Cyca 11 years ago
parent
commit
aaa8a53633

+ 2
- 2
roles/vpn/tasks/openvpn.yml View File

32
         mode=600
32
         mode=600
33
 
33
 
34
 - name: Generate CA certificate
34
 - name: Generate CA certificate
35
-  command: openssl req -nodes -batch -new -x509 -key {{ openvpn_ca }}.key -out {{ openvpn_ca }}.crt -subj "{{ openssl_request_subject }}/CN=ca-certificate"
35
+  command: openssl req -nodes -batch -new -x509 -key {{ openvpn_ca }}.key -out {{ openvpn_ca }}.crt -days {{ openvpn_days_valid }} -subj "{{ openssl_request_subject }}/CN=ca-certificate"
36
            creates={{ openvpn_ca }}.crt
36
            creates={{ openvpn_ca }}.crt
37
 
37
 
38
 - name: Generate the OpenSSL configuration that will be used for the Server certificate's req and ca commands
38
 - name: Generate the OpenSSL configuration that will be used for the Server certificate's req and ca commands
70
   with_items: openvpn_clients
70
   with_items: openvpn_clients
71
 
71
 
72
 - name: Generate certificates for the clients
72
 - name: Generate certificates for the clients
73
-  command: openssl x509 -CA {{ openvpn_ca }}.crt -CAkey {{ openvpn_ca }}.key -CAcreateserial -req -in {{ item }}.csr -out {{ item }}.crt
73
+  command: openssl x509 -CA {{ openvpn_ca }}.crt -CAkey {{ openvpn_ca }}.key -CAcreateserial -req -days {{ openvpn_days_valid }} -in {{ item }}.csr -out {{ item }}.crt
74
            chdir={{ openvpn_path }}
74
            chdir={{ openvpn_path }}
75
            creates={{ item }}.crt
75
            creates={{ item }}.crt
76
   with_items: openvpn_clients
76
   with_items: openvpn_clients

+ 1
- 1
roles/vpn/templates/openssl-server-certificate.cnf.j2 View File

17
 
17
 
18
 x509_extensions = server
18
 x509_extensions = server
19
 
19
 
20
-default_days = 3650
20
+default_days = {{ openvpn_days_valid }}
21
 default_crl_days= 30
21
 default_crl_days= 30
22
 default_md = sha256
22
 default_md = sha256
23
 preserve = no
23
 preserve = no

+ 2
- 1
vars/defaults.yml View File

61
 tarsnap_version: 1.0.35
61
 tarsnap_version: 1.0.35
62
 
62
 
63
 # # vpn
63
 # # vpn
64
-openvpn_key_country:  "US"
64
+openvpn_days_valid: "1825"
65
+openvpn_key_country: "US"
65
 openvpn_key_province: "California"
66
 openvpn_key_province: "California"
66
 openvpn_key_city: "Beverly Hills"
67
 openvpn_key_city: "Beverly Hills"
67
 openvpn_key_org: "ACME CORPORATION"
68
 openvpn_key_org: "ACME CORPORATION"

+ 1
- 0
vars/user.yml View File

61
 # tarsnap_version: 1.0.35
61
 # tarsnap_version: 1.0.35
62
 
62
 
63
 # # vpn
63
 # # vpn
64
+# openvpn_days_valid: "1825"
64
 # openvpn_key_country:  "US"
65
 # openvpn_key_country:  "US"
65
 # openvpn_key_province: "California"
66
 # openvpn_key_province: "California"
66
 # openvpn_key_city: "Beverly Hills"
67
 # openvpn_key_city: "Beverly Hills"

Loading…
Cancel
Save