forked from saltstack-formulas/openvpn-formula
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpillar.example
233 lines (232 loc) · 7.81 KB
/
pillar.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# For DevOps/SRE
openvpn:
server_ip: {{ ovpn_server_ip }}
routes:
# DNS Servers
- 1.1.1.1
- 8.8.8.8/255.255.255.255
# Cloudflare networks
- 173.245.48.0/20
- 103.21.244.0/22
- 103.22.200.0/22
- 103.31.4.0/22
- 141.101.64.0/18
- 108.162.192.0/18
- 190.93.240.0/20
- 188.114.96.0/20
- 197.234.240.0/22
- 198.41.128.0/17
- 162.158.0.0/15
- 104.16.0.0/13
- 104.24.0.0/14
- 172.64.0.0/13
- 131.0.72.0/22
domains_for_routes:
- 2ip.ua
- example.net
- my-firewalled-resource.cc
lookup:
dh_files: ['2048']
manage_user: false
manage_group: false
external_repo_enabled: true
server:
{%- set server = "server-udp443-default-gw" %}
{%- set subnet = "10.8.1.0 255.255.255.0" %}
{%- set proto = "udp4" %}
{%- set port = "443" %}
{{ server }}:
description: "For connection via {{ port }}/{{ proto }} port WITH DEFAULT GATEWAY, use the following values of the 'remote' and 'proto' options"
dev: tun
topology: subnet
port: {{ port }}
proto: {{ proto }}
ca: /opt/EasyRSA/pki/ca.crt
cert: /opt/EasyRSA/pki/issued/server.crt
key: /opt/EasyRSA/pki/private/server.key
crl_verify: crl.pem
dh: dh2048.pem
tls_crypt: /opt/EasyRSA/ta.key
ciphers:
- AES-256-GCM
auths:
- SHA384
server: '{{ subnet }}'
status: /var/log/openvpn/openvpn-status-{{ server }}.log
log: /var/log/openvpn/openvpn-{{ server }}.log
log_append: /var/log/openvpn/openvpn-{{ server }}.log
push:
- "redirect-gateway def1 bypass-dhcp"
keepalive: '10 120'
verb: 3
mute: 20
duplicate_cn: True
explicit_exit_notify: {% if proto == 'udp4' %}1{% else %}0{% endif %}
##
## Uncomment the following tree lines to authenticate with the Linux user's password
#username_as_common_name: True
#client_config_dir: perclient
#plugins:
# - /usr/lib/x86_64-linux-gnu/openvpn/plugins/openvpn-plugin-auth-pam.so login
##
{%- set server = "server-tcp443-default-gw" %}
{%- set subnet = "10.8.2.0 255.255.255.0" %}
{%- set proto = "tcp4" %}
{%- set port = "443" %}
{{ server }}:
description: "For connection via {{ port }}/{{ proto }} port WITH DEFAULT GATEWAY, use the following values of the 'remote' and 'proto' options"
dev: tun
topology: subnet
port: {{ port }}
proto: {{ proto }}
ca: /opt/EasyRSA/pki/ca.crt
cert: /opt/EasyRSA/pki/issued/server.crt
key: /opt/EasyRSA/pki/private/server.key
crl_verify: crl.pem
dh: dh2048.pem
tls_crypt: /opt/EasyRSA/ta.key
ciphers:
- AES-256-GCM
auths:
- SHA384
server: '{{ subnet }}'
status: /var/log/openvpn/openvpn-status-{{ server }}.log
log: /var/log/openvpn/openvpn-{{ server }}.log
log_append: /var/log/openvpn/openvpn-{{ server }}.log
push:
- "redirect-gateway def1 bypass-dhcp"
keepalive: '10 120'
verb: 3
mute: 20
duplicate_cn: True
explicit_exit_notify: {% if proto == 'udp4' %}1{% else %}0{% endif %}
##
## Uncomment the following tree lines to authenticate with the Linux user's password
#username_as_common_name: True
#client_config_dir: perclient
#plugins:
# - /usr/lib/x86_64-linux-gnu/openvpn/plugins/openvpn-plugin-auth-pam.so login
##
{%- set server = "server-udp1194-no-default-gw" %}
{%- set subnet = "10.8.3.0 255.255.255.0" %}
{%- set proto = "udp4" %}
{%- set port = "1194" %}
{{ server }}:
description: "For connection via {{ port }}/{{ proto }} port WITH NO DEFAULT GATEWAY, use the following values of the 'remote' and 'proto' options"
dev: tun
topology: subnet
port: {{ port }}
proto: {{ proto }}
ca: /opt/EasyRSA/pki/ca.crt
cert: /opt/EasyRSA/pki/issued/server.crt
key: /opt/EasyRSA/pki/private/server.key
crl_verify: crl.pem
dh: dh2048.pem
tls_crypt: /opt/EasyRSA/ta.key
ciphers:
- AES-256-GCM
auths:
- SHA384
server: '{{ subnet }}'
status: /var/log/openvpn/openvpn-status-{{ server }}.log
log: /var/log/openvpn/openvpn-{{ server }}.log
log_append: /var/log/openvpn/openvpn-{{ server }}.log
push:
- "dhcp-option DNS 10.8.3.1"
- "block-outside-dns"
keepalive: '10 120'
verb: 3
mute: 20
duplicate_cn: True
explicit_exit_notify: {% if proto == 'udp4' %}1{% else %}0{% endif %}
##
## Uncomment the following tree lines to authenticate with the Linux user's password
#username_as_common_name: True
#client_config_dir: perclient
#plugins:
# - /usr/lib/x86_64-linux-gnu/openvpn/plugins/openvpn-plugin-auth-pam.so login
##
{%- set server = "server-tcp1194-no-default-gw" %}
{%- set subnet = "10.8.4.0 255.255.255.0" %}
{%- set proto = "tcp4" %}
{%- set port = "1194" %}
{{ server }}:
description: "For connection via {{ port }}/{{ proto }} port WITH NO DEFAULT GATEWAY, use the following values of the 'remote' and 'proto' options"
dev: tun
topology: subnet
port: {{ port }}
proto: {{ proto }}
ca: /opt/EasyRSA/pki/ca.crt
cert: /opt/EasyRSA/pki/issued/server.crt
key: /opt/EasyRSA/pki/private/server.key
crl_verify: crl.pem
dh: dh2048.pem
tls_crypt: /opt/EasyRSA/ta.key
ciphers:
- AES-256-GCM
auths:
- SHA384
server: '{{ subnet }}'
status: /var/log/openvpn/openvpn-status-{{ server }}.log
log: /var/log/openvpn/openvpn-{{ server }}.log
log_append: /var/log/openvpn/openvpn-{{ server }}.log
push:
- "dhcp-option DNS 10.8.4.1"
- "block-outside-dns"
keepalive: '10 120'
verb: 3
mute: 20
duplicate_cn: True
explicit_exit_notify: {% if proto == 'udp4' %}1{% else %}0{% endif %}
##
## Uncomment the following tree lines to authenticate with the Linux user's password
#username_as_common_name: True
#client_config_dir: perclient
#client_config: # the same as 'config' in 'server_clients' section, but needs to be set to every server in pillar, so might be not so convenient
# User1: |
# push "redirect-gateway def1 bypass-dhcp"
#plugins:
# - /usr/lib/x86_64-linux-gnu/openvpn/plugins/openvpn-plugin-auth-pam.so login
##
use_latest: false
easyrsa:
tgz_link: https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.8/EasyRSA-3.0.8.tgz
vars: |
set_var EASYRSA_REQ_COUNTRY "UA"
set_var EASYRSA_REQ_PROVINCE "Kyiv"
set_var EASYRSA_REQ_CITY "Kyiv"
set_var EASYRSA_REQ_ORG "Organization"
set_var EASYRSA_REQ_EMAIL "[email protected]"
set_var EASYRSA_REQ_OU "IT Dept."
set_var EASYRSA_CA_EXPIRE "7300"
set_var EASYRSA_CERT_EXPIRE "7300"
set_var EASYRSA_CRL_DAYS "3650"
clients_base_config:
default_server: server-udp1194-no-default-gw
dev: tun
remote: ovpn.example.org
resolv_retry: infinite
user: nobody
group: nogroup
remote_cert_tls: server
cipher: AES-256-GCM
auth: SHA384
verb: 3
key_direction: 1
##
## uncomment the next line for password authentication
#auth_user_pass: true
##
server_clients:
- name: User1
# 'config' here is stored as /etc/openvpn/server/perclient/<client.name>
# and can be used to configure custom routes/rules per login if 'username_as_common_name' is 'True', or per <client.name> if 'False'
# in servers section client_config_dir needs to be set to 'perclient'
#config: |
# push "redirect-gateway def1 bypass-dhcp"
- name: User2
delete: true
- name: User3
## If authorization by password is enabled, it is enough to create one user for everyone
## for example
- default