openvpn: uses secret ip as remote

This commit is contained in:
Tigor Hutasuhut 2024-06-14 16:43:42 +07:00
parent b1156f42fb
commit 9ec97fbda5
2 changed files with 10 additions and 7 deletions

View file

@ -1,4 +1,6 @@
openvpn: openvpn:
server:
ip: ENC[AES256_GCM,data:hv/lHgWGsx1LBR3wcg7O,iv:JtkecUzT50YGgDQMNlXQC9C1h53sm46EYfhdzT+0K9s=,tag:sdCiPlus1DJRPoET2e4HIQ==,type:str]
key: key:
phone: ENC[AES256_GCM,data:JobVqgDl1Lk8jsIPeJgfA3tuMY1IHkTL2+rWY8CQkyJ9Q+dLIS8hMrmlqhtfiEkaWs3NFqwFuyUhK8uuOa0stBzQ/lZiQ7OKjOH8Y3d4fs6sF/FCuaVOuwfAXNy2gVEG2HgKBzFkBT/ciFxF3guy2EVNaLZCm01PaA8XMr8piXDs6lqt/YoEUNr2l+LfOsphrxLCYpGxRJxJkUWjoNGm/ZtbxI/HFO94l9JAlSoCfETqgEgWOOP3OgGKFSjr6pVty5Nw6iKHnhzFYdXyPFy67MPK9NvLWM3sAZnKrmF+B6lUFGAyZwKDwenKbjM/e5VOZrEGjj7O7EgMG7tYkbPngCPvRhQ4URIibKhKlmuP/On2WuJsNhNW7mtGMAKps0Q3B9GVAWeEGAhJUo5Y3FHGtSs0dRglAo6DCB0bgSTpa87LmY0JskW+PXCTQzJgVd6EnqL+ewMXM+1ID9upedivBZpTPbN41KAz9pCa/EziSsz7vEijq1i40RS/TTvjAC2SJkiv0tCmM7/jAoPDd/N4l7doqhk8jvokGw2PBmYkxnhPo0B2Ofhx+td/Pe/Q1fDHt42POTQ1EEuptD+utvPZUdLaOGg2ybiEYn8lsB9oEK4tVZoPaxOqHPlckSOcnTjwLmQ8M2Nf5e+iW74w+dfJrXuSz15XMSGthWmYHNPZGYo24+437HcVpEs2txcysK003PTy62X56jB5Wrv3l8rqqufVeMZDgLqo3Lw3btniFs6b3lJp1+dvYwGFXBhMeOuoannOi0bQvtIwxqTYgovHv+7/HPD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MYbPELeGapwW79WvHzP8A== aRvTzGL4Q2e+BnrFcyX8QiiZFgEUGEbk6MYbPELeGapwW79WvHzP8A==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
lastmodified: "2024-06-14T06:31:34Z" lastmodified: "2024-06-14T09:39:43Z"
mac: ENC[AES256_GCM,data:dbnrwOcg8HrzIvG42rUAX9/p3/SfRlHA6ReMKFtVXESIvIrwfagbFPO8I5CspMyy/sqNhxPj2Pe05oBP6193SbfTTrKFVO+7X7085G2Yl/8EJD89a9hQN94SfzAqGs4NQHUI/YlO+piVLeVklhRhu+rwFnOmQ72nwVo+GKR/Rw0=,iv:A0oX4yu70ufZogYnTmewa5/w7W55BEsl4h1ppbd/Qwk=,tag:aVuwzS4I8nRVNIcXiFQOJA==,type:str] mac: ENC[AES256_GCM,data:OnbOkWUCl8Oa+XXHJ8sQVZ+8rQ/XFmMXQlzgJA/wXJgKAdU/FPF6XnfdYdXTH7MTu/nRhctnnRaTbPWaGaWYSejdPOQcu60z53lbALuRAWZXHAa0/tGC6pFV//3TwLd5FduOq9NnPeO0lM4yWF67z1wTDpygnrqoHDkY53OpGvU=,iv:Oj7UIFBg4/We07GD+mIJNb6K/QiGSvOXdNeyf2ezxck=,tag:rvG1y6xR1XaK5e5M9X/jrg==,type:str]
pgp: [] pgp: []
unencrypted_suffix: _unencrypted unencrypted_suffix: _unencrypted
version: 3.8.1 version: 3.8.1

View file

@ -39,6 +39,7 @@ in
}; };
in in
{ {
"openvpn/server/ip" = opts;
"openvpn/key/phone" = opts; "openvpn/key/phone" = opts;
"openvpn/key/laptop" = opts; "openvpn/key/laptop" = opts;
}; };
@ -46,9 +47,9 @@ in
# This section creates .ovpn files for the clients in /etc/openvpn folder. These should be shared with the clients. # This section creates .ovpn files for the clients in /etc/openvpn folder. These should be shared with the clients.
templates = templates =
let let
template = { placeholder, port, ifConfig }: '' template = { secretPlaceholder, port, ifConfig }: ''
dev tun dev tun
remote "${domain}" remote "${config.sops.placeholder."openvpn/server/ip"}"
port ${toString port} port ${toString port}
ifconfig ${ifConfig} ifconfig ${ifConfig}
redirect-gateway def1 redirect-gateway def1
@ -65,14 +66,14 @@ in
secret [inline] secret [inline]
<secret> <secret>
${placeholder} ${secretPlaceholder}
</secret> </secret>
''; '';
in in
{ {
"openvpn/key/phone" = { "openvpn/key/phone" = {
content = template { content = template {
placeholder = config.sops.placeholder."openvpn/key/phone"; secretPlaceholder = config.sops.placeholder."openvpn/key/phone";
port = portPhone; port = portPhone;
ifConfig = "10.8.1.1 10.8.1.2"; ifConfig = "10.8.1.1 10.8.1.2";
}; };
@ -81,7 +82,7 @@ in
}; };
"openvpn/key/laptop" = { "openvpn/key/laptop" = {
content = template { content = template {
placeholder = config.sops.placeholder."openvpn/key/laptop"; secretPlaceholder = config.sops.placeholder."openvpn/key/laptop";
port = portLaptop; port = portLaptop;
ifConfig = "10.8.2.1 10.8.2.2"; ifConfig = "10.8.2.1 10.8.2.2";
}; };