-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathREADME.md.gotmpl
101 lines (74 loc) · 2.52 KB
/
README.md.gotmpl
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
{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}
{{ template "chart.badgesSection" . }}
{{ template "chart.description" . }}
{{ template "chart.homepageLine" . }}
{{ template "chart.maintainersSection" . }}
{{ template "chart.sourcesSection" . }}
{{ template "chart.requirementsSection" . }}
## Deploy openvpn with users
Cert manager creates a tls secrets and store in kubernetes secretes.
`clientConfigRBAC` sets RBAC policy, it allow to download openvpn config/secrets by users.
```yaml
# helm values
certManager:
createCerts: true
clientConfigRBAC: true
clients:
openvpn:
hostName: vpn.example.com
config: |
server 172.30.1.0 255.255.255.0
topology p2p
data-ciphers AES-256-GCM:AES-128-GCM
data-ciphers-fallback AES-256-CBC
defaultroutes: |
push "dhcp-option DNS 172.30.1.1"
push "route 1.1.1.1"
push "route 8.8.8.8"
```
## Deploy openvpn with users and OTP
As previous example, we will create a tls certs and user configs.
Additionally, we will use OTP (one time password) to login on openvpn.
To create OTP key: `docker run --rm -ti --entrypoint=google-authenticator ghcr.io/sergelogvinov/openvpn:2.5.8-2 -tdfW -r 3 -R 60`
```yaml
# helm values
certManager:
createCerts: true
clientConfigRBAC: true
clients:
openvpn:
hostName: vpn.example.com
# google-authenticator -tdfW -r 3 -R 60
otp: PMTYASQTPLU6OKR2
config: |
server 172.30.1.0 255.255.255.0
topology p2p
data-ciphers AES-256-GCM:AES-128-GCM
data-ciphers-fallback AES-256-CBC
defaultroutes: |
push "dhcp-option DNS 172.30.1.1"
push "route 1.1.1.1"
push "route 8.8.8.8"
```
Useful `Makefile` to download user certificates:
```Makefile
ifeq (vpn,$(firstword $(MAKECMDGOALS)))
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
USER := $(subst .,-,$(subst @,-,$(lastword $(MAKECMDGOALS))))
$(eval $(RUN_ARGS):;@:)
endif
.PHONY: vpn
vpn: vpn-$(USER) ## create certificate for vpn
vpn-clean:
rm -f ca.crt ca.key client.crt client.key client.ovpn
vpn-%: ## create certificate for vpn
kubectl --namespace vpn get secret openvpn-client-$(USER) -o jsonpath="{.data.tls\.crt}" | base64 --decode > client.crt
kubectl --namespace vpn get secret openvpn-client-$(USER) -o jsonpath="{.data.tls\.key}" | base64 --decode > client.key
kubectl --namespace vpn get configmap openvpn -o jsonpath="{.data.client\.conf}" > client.ovpn
```
{{ template "chart.valuesSection" . }}