From patchwork Tue May 26 22:07:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marcin Karpezo X-Patchwork-Id: 22390 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4996D27BBE3; Tue, 26 May 2020 23:08:09 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id DF56827BBE1 for ; Tue, 26 May 2020 23:08:08 +0100 (BST) Received: from localhost ([::1]:37580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jdhk0-0001GR-C5 for patchwork@mira.cbaines.net; Tue, 26 May 2020 18:08:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jdhju-0001GK-Db for guix-patches@gnu.org; Tue, 26 May 2020 18:08:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35652) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jdhju-0005K2-4m for guix-patches@gnu.org; Tue, 26 May 2020 18:08:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jdhjt-0006pq-V3 for guix-patches@gnu.org; Tue, 26 May 2020 18:08:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41080] [PATCH v2] Add wireguard connection instructions to cookbook References: <20200504154915.3963-1-sirmacik@wioo.waw.pl> In-Reply-To: <20200504154915.3963-1-sirmacik@wioo.waw.pl> Resent-From: Marcin Karpezo Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 26 May 2020 22:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 41080 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41080@debbugs.gnu.org Cc: Marcin Karpezo Received: via spool by 41080-submit@debbugs.gnu.org id=B41080.159053085526215 (code B ref 41080); Tue, 26 May 2020 22:08:01 +0000 Received: (at 41080) by debbugs.gnu.org; 26 May 2020 22:07:35 +0000 Received: from localhost ([127.0.0.1]:47166 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdhjS-0006oj-Oj for submit@debbugs.gnu.org; Tue, 26 May 2020 18:07:35 -0400 Received: from mail.freearts.agency ([51.68.137.137]:53812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jdhjP-0006oQ-5g for 41080@debbugs.gnu.org; Tue, 26 May 2020 18:07:33 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0115040FB7; Wed, 27 May 2020 00:07:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wioo.waw.pl; s=dkim; t=1590530844; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=3522wXVr6/tiqDlfsZgNpgKeIYM0X0rW/TOv8IxV/OE=; b=QDFzHx6mK47xE0SkucEl7xp0A/4rr/rg9mMfx/7ac12dLrFIvOuJV5T8oU7BNIdHZVBgkM PY+JoCdGsHhbdLAK06xqcIqcPPUWMZ9qFNc9oeyhx0NbGAiClUAzFHpM2RP9Ig9nehiPz/ GZ12yZiI+t9tKvwiFBzqH0jfCVPWezP7WGU81DbTak+OvBaDRvtlXPq1TNUVU9CE9UJCNP LpfHcYqHyyQ9PWhQFYShfgSqail3u5SJfeNn6qMdj5+7PE5DFqMDK7lrrz3STtLdfFB7jn qDzi5cblGIjT5fde9M9Qh3iL4LAOUrKdZ3X/ab8mN6N9QI4X26YHMDcOytKPIQ== From: Marcin Karpezo Date: Wed, 27 May 2020 00:07:17 +0200 Message-Id: <20200526220717.30682-1-sirmacik@wioo.waw.pl> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * doc: cookbook: add entry for Wireguard VPN connection on Guix System --- doc/guix-cookbook.texi | 68 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index 8651bc4429..0e0727310a 100644 --- a/doc/guix-cookbook.texi +++ b/doc/guix-cookbook.texi @@ -327,7 +327,7 @@ package definitions. @item Inheritance makes it easy to customize a package by inheriting from it and modifying only what is needed. - + @item Batch processing: the whole package collection can be parsed, filtered and processed. Building a headless server with all graphical interfaces stripped @@ -1323,6 +1323,7 @@ reference. @menu * Customizing the Kernel:: Creating and using a custom Linux kernel on Guix System. +* Connect to Wireguard VPN:: Connecting your Guix System to Wireguard VPN. * Customizing a Window Manager:: Handle customization of a Window manager on Guix System. * Setting up a bind mount:: Setting up a bind mount in the file-systems definition. @end menu @@ -1567,6 +1568,71 @@ likely that you'll need to modify the initrd on a machine using a custom kernel, since certain modules which are expected to be built may not be available for inclusion into the initrd. +@node Connect to Wireguard VPN +@section Connect to Wireguard VPN + +To connect your Guix system with Wireguard VPN server you need to add +@code{wireguard-tools} package to your system configuration file and +additional kernel line, e.g. @file{/etc/config.scm}. + +An example configuration file will look like this: + +@lisp +(use-modules (gnu)) +(use-package-modules vpn) + +(operating-system +;; … +(packages + (append (map specification->package + '("wireguard-tools")) + %base-packages)) + (kernel-loadable-modules (list wireguard-linux-compat)) + ;; … +@end lisp + +After @code{guix system reconfigure /etc/config.scm} you can either +place your config file in @file{/etc/wireguard} and run +@code{wg-quick up wg0} command or use NetworkManager for wireguard +management. + +Thanks to Network Manager support for Wireguard we can connect to our +VPN using @code{nmcli} command. Up to this point this guide assumes that +you're using Network Manager service provided by +@code{%desktop-services}. Ortherwise you need to adjust your services +list to load @code{network-manager-service-type} and reconfigure your +Guix system. + +To import your VPN configuration execute nmcli import command: + +@example shell +~ % sudo nmcli connection import type wireguard file wg0.conf +Connection 'wg0' (edbee261-aa5a-42db-b032-6c7757c60fde) successfully added +@end example + +Next connect to Wireguard server + +@example shell +~ % nmcli connection up wg0 +Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6) +@end example + +By default NM will connect automatically on system boot. To change that +behaviour you need to edit your config: + +@example shell +~ % sudo nmcli connection edit wg0 +nmcli> print connection.autoconnect +connection.autoconnect: yes +nmcli> set connection.autoconnect no +nmcli> save +Connection 'prv' (edbee261-aa5a-42db-b032-6c7757c60fde) successfully updated. +@end example + +For more specific information about NetworkManager and wireguard +@uref{https://blogs.gnome.org/thaller/2019/03/15/wireguard-in-networkmanager/,see +this post by thaller}. + @node Customizing a Window Manager @section Customizing a Window Manager @cindex wm