Bladeren bron

Merge pull request #88 from jlund/openvpn-expiration

Updated the OpenVPN role so certificate expiration is handled correctly
Luke Cyca 11 jaren geleden
bovenliggende
commit
aaa8a53633
4 gewijzigde bestanden met toevoegingen van 6 en 4 verwijderingen
  1. 2
    2
      roles/vpn/tasks/openvpn.yml
  2. 1
    1
      roles/vpn/templates/openssl-server-certificate.cnf.j2
  3. 2
    1
      vars/defaults.yml
  4. 1
    0
      vars/user.yml

+ 2
- 2
roles/vpn/tasks/openvpn.yml Bestand weergeven

@@ -32,7 +32,7 @@
32 32
         mode=600
33 33
 
34 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 36
            creates={{ openvpn_ca }}.crt
37 37
 
38 38
 - name: Generate the OpenSSL configuration that will be used for the Server certificate's req and ca commands
@@ -70,7 +70,7 @@
70 70
   with_items: openvpn_clients
71 71
 
72 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 74
            chdir={{ openvpn_path }}
75 75
            creates={{ item }}.crt
76 76
   with_items: openvpn_clients

+ 1
- 1
roles/vpn/templates/openssl-server-certificate.cnf.j2 Bestand weergeven

@@ -17,7 +17,7 @@ RANDFILE = $dir/.rand
17 17
 
18 18
 x509_extensions = server
19 19
 
20
-default_days = 3650
20
+default_days = {{ openvpn_days_valid }}
21 21
 default_crl_days= 30
22 22
 default_md = sha256
23 23
 preserve = no

+ 2
- 1
vars/defaults.yml Bestand weergeven

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

+ 1
- 0
vars/user.yml Bestand weergeven

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

Laden…
Annuleren
Opslaan