From patchwork Mon May 4 15:49:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marcin Karpezo X-Patchwork-Id: 21896 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 7289327BBE3; Mon, 4 May 2020 16:52:05 +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,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:470:142::17]) by mira.cbaines.net (Postfix) with ESMTP id A99B627BBE1 for ; Mon, 4 May 2020 16:52:04 +0100 (BST) Received: from localhost ([::1]:35294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jVdO0-0001hs-5Q for patchwork@mira.cbaines.net; Mon, 04 May 2020 11:52:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVdN0-0000Kj-QN for guix-patches@gnu.org; Mon, 04 May 2020 11:51:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50435) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jVdN0-0002bA-FV for guix-patches@gnu.org; Mon, 04 May 2020 11:51:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jVdN0-0005X4-DL for guix-patches@gnu.org; Mon, 04 May 2020 11:51:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#41080] [PATCH] doc: cookbook: add entry for Wireguard VPN connection on Guix System Resent-From: Marcin Karpezo Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 04 May 2020 15:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 41080 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 41080@debbugs.gnu.org Cc: Marcin Karpezo X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.158860743221216 (code B ref -1); Mon, 04 May 2020 15:51:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 May 2020 15:50:32 +0000 Received: from localhost ([127.0.0.1]:33748 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVdMW-0005W7-9G for submit@debbugs.gnu.org; Mon, 04 May 2020 11:50:32 -0400 Received: from lists.gnu.org ([209.51.188.17]:35524) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jVdMV-0005W0-4E for submit@debbugs.gnu.org; Mon, 04 May 2020 11:50:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVdMU-00080o-M5 for guix-patches@gnu.org; Mon, 04 May 2020 11:50:30 -0400 Received: from mail.freearts.agency ([51.68.137.137]:49980) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jVdMS-000233-Jd for guix-patches@gnu.org; Mon, 04 May 2020 11:50:30 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 0AABF41239; Mon, 4 May 2020 17:50:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wioo.waw.pl; s=dkim; t=1588607410; 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=rRVGBSqLC3rmbGKiYmdvYs/rhNuG+BajJOtVEi5Etr8=; b=NMJSWWDmYn3rSeT4h29B+6RL7XnnJsuaK7Inhv16Xs3+SHm2Uj26V9/yafvzouEtCt0K2E cuwwimELx0vpwLnInlVemNYI6ZJyFUKdr9y9DNPuu9EE42pZxkVQKcxBB7/m1PFLyhE2wN 10MJibIe2AF8W28AcaH3sAyUhFv5wtv8f7PCyMFdmX+IWW33NS7wZUD31H9ZmTI9/Q7krK wMrBOsptYBt9aibljckvK2SkBMs+YFQWPIcznoWPUOViB1pTneTuIAF7QKczM4A6zO6k1F qbR33G1LEYjnYhZhn4p15FIRpBbQJOBBK/yYTmS2oLWzo3zROiUBpgy1w070Vw== From: Marcin Karpezo Date: Mon, 4 May 2020 17:49:16 +0200 Message-Id: <20200504154915.3963-1-sirmacik@wioo.waw.pl> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 Received-SPF: pass client-ip=51.68.137.137; envelope-from=sirmacik@wioo.waw.pl; helo=mail.freearts.agency X-detected-operating-system: by eggs.gnu.org: First seen = 2020/05/04 11:50:16 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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/guix-cookbook.texi | 77 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/doc/guix-cookbook.texi b/doc/guix-cookbook.texi index f58d18d47c..598084ce65 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 @@ -1324,7 +1324,9 @@ reference. @menu * Customizing the Kernel:: Creating and using a custom Linux kernel on Guix System. * Customizing a Window Manager:: Handle customization of a Window manager on Guix System. +* Connect to Wireguard VPN:: Connecting to Wireguard VPN server on Guix System. * Setting up a bind mount:: Setting up a bind mount in the file-systems definition. + @end menu @node Customizing the Kernel @@ -1617,6 +1619,79 @@ Then you need to add the following code to a StumpWM configuration file (set-font (make-instance 'xft:font :family "DejaVu Sans Mono" :subfamily "Book" :size 11)) @end lisp +@node Connect to Wireguard VPN +@section Connect to Wireguard VPN +@anchor{#connect-to-wireguard-vpn} +To connect your Guix System with Wireguard VPN server you need to add +packages @code{wireguard-linux-compat} and @code{wireguard-tools} to +your system configuration file, 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-linux-compat" "wireguard-tools")) + %base-packages))) +@end lisp + +After @code{guix system reconfigure /etc/config.scm} you'll find that +standard @code{wg-quick up wg0} command will not work due to lack of +package providing @code{resolvconf} command. + +@example +~ % sudo wg-quick up wg0 +[#] ip link add wg0 type wireguard +[#] wg setconf wg0 /dev/fd/63 +[#] ip -4 address add 10.200.200.2/24 dev wg0 +[#] ip link set mtu 1420 up dev wg0 +[#] resolvconf -a wg0 -m 0 -x +/home/sirmacik/.guix-profile/bin/wg-quick: line 31: resolvconf: command not found +[#] ip link delete dev wg0 +@end example + +Thanks to Network Manager support for Wireguard we can still 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 (@uref{https://guix.gnu.org/manual/en/html_node/Networking-Services.html,see Networking Services}). + +To import your VPN configuration execute nmcli import command: + +@example +~ % 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 +~ % 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 +~ % 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 on GNOME blogs}. + @node Setting up a bind mount @section Setting up a bind mount