From bef5e59857540cb38f3cbdfaf2b7d6268e44dd2b Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Fri, 1 Dec 2023 18:02:10 -0700 Subject: [PATCH] Moved vpn services to vpn-services variable so they can be modified --- machines/vpn.scm | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/machines/vpn.scm b/machines/vpn.scm index d9b700b..1450fbf 100644 --- a/machines/vpn.scm +++ b/machines/vpn.scm @@ -6,29 +6,34 @@ #:use-module (gnu services vpn) #:use-module (system base-system) - #:export (vpn.metznet.ca)) + #:export (vpn.metznet.ca vpn-services)) + +(define-public vpn-services + (append (list (service openvpn-server-service-type + (openvpn-server-configuration (tls-auth + "/etc/openvpn/ta.key") + (server + "10.0.80.0 255.255.255.0"))) + + (simple-service 'vpn-server-etc etc-service-type + (let ((pki-dir (getenv "VPN_PKI_DIR"))) + (if pki-dir + `(("openvpn/dh2048.pem" ,(local-file (string-append + pki-dir + "/dh2048.pem")))) + `()))) + (service certbot-service-type + (certbot-configuration (email "admin@metznet.ca") + (certificates (list (certificate-configuration + (domains ' + ("vpn.metznet.ca")))))))) + (modify-services %metznet-server-services + (delete openvpn-client-service-type)))) (define-public vpn.metznet.ca (operating-system (inherit %metznet-base-server-system) (host-name "vpn.metznet.ca") (services - (append (list (service openvpn-server-service-type - (openvpn-server-configuration (tls-auth - "/etc/openvpn/ta.key") - (server - "10.0.80.0 255.255.255.0"))) - - (simple-service 'vpn-server-etc etc-service-type - (let ((pki-dir (getenv "VPN_PKI_DIR"))) - (if pki-dir - `(("openvpn/dh2048.pem" ,(local-file (string-append pki-dir "/dh2048.pem")))) - `()))) - (service certbot-service-type - (certbot-configuration (email "admin@metznet.ca") - (certificates (list (certificate-configuration - (domains ' - ("vpn.metznet.ca")))))))) - (modify-services %metznet-server-services - (delete openvpn-client-service-type)))))) + vpn-services)))