From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id MPf0LulxJV9wKwAA0tVLHw (envelope-from ) for ; Sat, 01 Aug 2020 13:45:13 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id AA7MKulxJV+WbQAA1q6Kng (envelope-from ) for ; Sat, 01 Aug 2020 13:45:13 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 25C55940776 for ; Sat, 1 Aug 2020 13:45:12 +0000 (UTC) Received: from localhost ([::1]:33554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k1rp0-0007YL-7n for larch@yhetil.org; Sat, 01 Aug 2020 09:45:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43908) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k1ros-0007Y2-AW for bug-guix@gnu.org; Sat, 01 Aug 2020 09:45:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:56657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k1ros-0007Jg-1Y for bug-guix@gnu.org; Sat, 01 Aug 2020 09:45:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1k1ror-0001ol-Ou for bug-guix@gnu.org; Sat, 01 Aug 2020 09:45:01 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#39542: Adding openvpn client configurations to guix system Resent-From: david larsson Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 01 Aug 2020 13:45:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39542 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: Damien Cassou Received: via spool by 39542-submit@debbugs.gnu.org id=B39542.15962894796944 (code B ref 39542); Sat, 01 Aug 2020 13:45:01 +0000 Received: (at 39542) by debbugs.gnu.org; 1 Aug 2020 13:44:39 +0000 Received: from localhost ([127.0.0.1]:39970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k1roV-0001nw-3Y for submit@debbugs.gnu.org; Sat, 01 Aug 2020 09:44:39 -0400 Received: from server0.selfhosted.xyz ([217.64.149.7]:40500) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k1roS-0001ni-NH for 39542@debbugs.gnu.org; Sat, 01 Aug 2020 09:44:37 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=selfhosted.xyz; s=dkim; t=1596289469; bh=qbK6fC3fDf6dXXARio19bP4bmIKHjAJvNkMQFTAsqfQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=MXZFV4i664BUmdRSdBG7zunhKEyzdQ0a9gZO/MMMt9TejhhSwmbeDApTeoucHRKwf jHqLqZuJdze4m+/Wf8Vqi8zBANXtQ8Gx2EX/bqR0WYBKLeUvWE8wLPaw6pvqG+pVV6 dckZusJmqr8aqU4Z4uR+/U+ZGVI/p5wXlxJU/ipEkdZkzqJwbFUIYMrxyad4D4L/eM g4j3OlKTcQPxhn14OZkOCws5DFH9zMKQYvdupTqOpcZY90v8Rm25fmQy1cDiXXQ5TM kkB9rEWDYKwB/9UA9yglXzxLAYvN8m2rsV7PrAMSoq6Ql4+bItwF2TU/rExpEfj0LY WjRxL9vzTtmwA== X-Fuglu-Suspect: 897c0c9b2ebe4f51a54c45329881ac56 X-Fuglu-Spamstatus: NO Received: from [127.0.0.1] (localhost [127.0.0.1]) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sat, 01 Aug 2020 13:44:24 +0000 From: david larsson In-Reply-To: <877e0u306c.fsf@cassou.me> References: <87blq63hyj.fsf@cassou.me> <1BD29F0F-1268-4526-828D-C2AC25CFE2E5@lepiller.eu> <877e0u306c.fsf@cassou.me> Message-ID: X-Sender: david.larsson@selfhosted.xyz X-Spam-Score: -1.8 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.8 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: bug-Guix , 39542@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=selfhosted.xyz header.s=dkim header.b=MXZFV4i6; dmarc=fail reason="SPF not aligned (relaxed)" header.from=selfhosted.xyz (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: A8TuWsUomT3d On 2020-02-10 15:57, Damien Cassou wrote: > Julien Lepiller writes: >> We already have an openvpn-client-service-type and an >> openvpn-server-service-type. It's not linked to network manager >> though, I have no idea what it expects there. What do you need >> exactly? > > It seems to me that gnu/services/vpn.scm defines > openvpn-server-service-type that triggers the generation of a shepherd > service. > > At the office we use 3 different VPNs that we activate on demand (test, > acceptance and production). If we follow the vpn.scm way, it seems that > this would require 3 shepherd services but I guess it's not possible to > instantiate the openvpn-client-service-type more than once. This seems > to be a dead end to me. Hi Damien, I think I have a solution for you, where you can start 3 different vpn's with herd start vpn1-client, herd start vpn2-client etc. Below is an ovpn-service.scm module, modeled after vpn.scm. which you can include with (use-modules (ovpn-service)) in your config.scm, by saving it in the same dir as config.scm. This is tested and works. Now, I think you can modify all occurences of the word "ovpn", to, say vpn1, vpn2, and vpn3, and save 3 different files, and then use (use-modules (vpn1-service) (vpn2-service) (vpn3-service)) etc. in the config.scm. An example configuration in the config.scm OS-services section would be: (ovpn-client-service #:config (let ([ base-dir "/home/myuser/src/my-guixsd-config/etc_openvpn/"] ) (ovpn-client-configuration ;; client (dev 'tun) ;; remote-random (proto 'udp) ;; mute-replay-warnings ;; replay-window 256 ;; remote-cert-tls server lines is generated somehow ;; remote-cert-tls server ;; cipher aes-256-cbc ;; ncp-ciphers AES-256-GCM:AES-256-CBC:AES-128-GCM ;; pull ;; nobind (bind? #f) ;; reneg-sec 432000 ;; resolv-retry infinite (resolv-retry? #t) ;; compress lzo (comp-lzo? #t) ;; verb 3 (verbosity 3) ;; persist-key (persist-key? #t) ;; persist-tun (persist-tun? #t) ;; auth-user-pass /etc/openvpn/credentials (auth-user-pass (string-append base-dir "credentials")) ;; ca /etc/openvpn/ovpn-ca.crt (ca (string-append base-dir "ovpn-ca.crt")) ;; tls-auth /etc/openvpn/ovpn-tls.key 1 (tls-auth (string-append base-dir "ovpn-tls.key")) ;; log /tmp/openvpn.log ;; script-security 2 ;; resolv-conf scripts not needed for guix ;; up /etc/openvpn/update-resolv-conf ;; down /etc/openvpn/update-resolv-conf (fast-io? #t) (remote (list ;; Resolves to multiple vpn servers in location (ovpn-remote-configuration (name "whatever.ovpn.com") (port 1196)) (ovpn-remote-configuration (name "whatever.ovpn.com") (port 1197)) (ovpn-remote-configuration (name "whatever.ovpn.com") (port 1196)) (ovpn-remote-configuration (name "whatever.ovpn.com") (port 1197)) ))))) Please let me know if this works for you! Best regards, David Larsson