mirror of
https://github.com/trailofbits/algo.git
synced 2025-06-06 15:13:56 +02:00
client configuration templates #43
This commit is contained in:
parent
fcf29534ba
commit
062426e0ec
5 changed files with 58 additions and 8 deletions
10
config.cfg
10
config.cfg
|
@ -55,5 +55,15 @@ strongswan_enabled_plugins:
|
||||||
- stroke
|
- stroke
|
||||||
- x509
|
- x509
|
||||||
|
|
||||||
|
ipsec_config:
|
||||||
|
dpdaction: 'clear'
|
||||||
|
dpddelay: '35s'
|
||||||
|
rekey: 'no'
|
||||||
|
keyexchange: 'ikev2'
|
||||||
|
ike: 'aes128gcm16-sha2_256-prfsha256-ecp256!'
|
||||||
|
esp: 'aes128gcm16-sha2_256-ecp256!'
|
||||||
|
compress: 'yes'
|
||||||
|
fragmentation: 'yes'
|
||||||
|
|
||||||
# IP address for the proxy and the local dns resolver
|
# IP address for the proxy and the local dns resolver
|
||||||
local_service_ip: 172.16.0.1
|
local_service_ip: 172.16.0.1
|
||||||
|
|
|
@ -174,6 +174,16 @@
|
||||||
- "{{ PayloadContent.results }}"
|
- "{{ PayloadContent.results }}"
|
||||||
no_log: True
|
no_log: True
|
||||||
|
|
||||||
|
- name: Build the client ipsec config file
|
||||||
|
template: src=client_ipsec.conf.j2 dest=/{{ easyrsa_dir }}/easyrsa3//pki/private/ipsec_{{ item }}.conf mode=0600
|
||||||
|
with_items:
|
||||||
|
- "{{ users }}"
|
||||||
|
|
||||||
|
- name: Build the client ipsec secret file
|
||||||
|
template: src=client_ipsec.secrets.j2 dest=/{{ easyrsa_dir }}/easyrsa3//pki/private/ipsec_{{ item }}.secrets mode=0600
|
||||||
|
with_items:
|
||||||
|
- "{{ users }}"
|
||||||
|
|
||||||
- name: Fetch users P12
|
- name: Fetch users P12
|
||||||
fetch: src=/{{ easyrsa_dir }}/easyrsa3//pki/private/{{ item }}.p12 dest=configs/{{ IP_subject_alt_name }}_{{ item }}.p12 flat=yes
|
fetch: src=/{{ easyrsa_dir }}/easyrsa3//pki/private/{{ item }}.p12 dest=configs/{{ IP_subject_alt_name }}_{{ item }}.p12 flat=yes
|
||||||
with_items: "{{ users }}"
|
with_items: "{{ users }}"
|
||||||
|
@ -182,6 +192,22 @@
|
||||||
fetch: src=/{{ easyrsa_dir }}/easyrsa3//pki/private/{{ item }}.mobileconfig dest=configs/{{ IP_subject_alt_name }}_{{ item }}.mobileconfig flat=yes
|
fetch: src=/{{ easyrsa_dir }}/easyrsa3//pki/private/{{ item }}.mobileconfig dest=configs/{{ IP_subject_alt_name }}_{{ item }}.mobileconfig flat=yes
|
||||||
with_items: "{{ users }}"
|
with_items: "{{ users }}"
|
||||||
|
|
||||||
|
- name: Fetch users certificates
|
||||||
|
fetch: src=/{{ easyrsa_dir }}/easyrsa3//pki/issued/{{ item }}.crt dest=configs/{{ IP_subject_alt_name }}_{{ item }}.crt flat=yes
|
||||||
|
with_items: "{{ users }}"
|
||||||
|
|
||||||
|
- name: Fetch users keys
|
||||||
|
fetch: src=/{{ easyrsa_dir }}/easyrsa3//pki/private/{{ item }}.key dest=configs/{{ IP_subject_alt_name }}_{{ item }}.key flat=yes
|
||||||
|
with_items: "{{ users }}"
|
||||||
|
|
||||||
|
- name: Fetch users ipsec configs
|
||||||
|
fetch: src=/{{ easyrsa_dir }}/easyrsa3//pki/private/ipsec_{{ item }}.conf dest=configs/{{ IP_subject_alt_name }}_{{ item }}_ipsec.conf flat=yes
|
||||||
|
with_items: "{{ users }}"
|
||||||
|
|
||||||
|
- name: Fetch users ipsec secrets
|
||||||
|
fetch: src=/{{ easyrsa_dir }}/easyrsa3//pki/private/ipsec_{{ item }}.secrets dest=configs/{{ IP_subject_alt_name }}_{{ item }}_ipsec.secrets flat=yes
|
||||||
|
with_items: "{{ users }}"
|
||||||
|
|
||||||
- name: Restrict permissions
|
- name: Restrict permissions
|
||||||
file: path="{{ item }}" state=directory mode=0700 owner=strongswan group=root
|
file: path="{{ item }}" state=directory mode=0700 owner=strongswan group=root
|
||||||
with_items:
|
with_items:
|
||||||
|
|
17
roles/vpn/templates/client_ipsec.conf.j2
Normal file
17
roles/vpn/templates/client_ipsec.conf.j2
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
conn ikev2-{{ IP_subject_alt_name }}
|
||||||
|
{% for key, value in ipsec_config.iteritems() %}
|
||||||
|
{{ key }}={{ value }}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
right={{ IP_subject_alt_name }}
|
||||||
|
rightid={{ IP_subject_alt_name }}
|
||||||
|
rightsubnet=0.0.0.0/0
|
||||||
|
rightauth=pubkey
|
||||||
|
|
||||||
|
leftsourceip=%config
|
||||||
|
leftauth=pubkey
|
||||||
|
leftcert={{ IP_subject_alt_name }}_{{ item }}.crt
|
||||||
|
leftfirewall=yes
|
||||||
|
left=%defaultroute
|
||||||
|
|
||||||
|
auto=add
|
2
roles/vpn/templates/client_ipsec.secrets.j2
Normal file
2
roles/vpn/templates/client_ipsec.secrets.j2
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
{{ IP_subject_alt_name }} : ECDSA {{ IP_subject_alt_name }}_{{ item }}.key
|
||||||
|
|
|
@ -3,14 +3,9 @@ config setup
|
||||||
charondebug="ike 2, knl 2, cfg 2, net 2, esp 2, dmn 2, mgr 2"
|
charondebug="ike 2, knl 2, cfg 2, net 2, esp 2, dmn 2, mgr 2"
|
||||||
|
|
||||||
conn %default
|
conn %default
|
||||||
dpdaction=clear
|
{% for key, value in ipsec_config.iteritems() %}
|
||||||
dpddelay=35s
|
{{ key }}={{ value }}
|
||||||
rekey=no
|
{% endfor %}
|
||||||
keyexchange=ikev2
|
|
||||||
ike=aes128gcm16-sha2_256-prfsha256-ecp256!
|
|
||||||
esp=aes128gcm16-sha2_256-ecp256!
|
|
||||||
compress=yes
|
|
||||||
fragmentation=yes
|
|
||||||
|
|
||||||
left=%any
|
left=%any
|
||||||
leftauth=pubkey
|
leftauth=pubkey
|
||||||
|
|
Loading…
Add table
Reference in a new issue