all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: help-guix <help-guix@gnu.org>
Subject: [kb] Using an OpenVPN config with nmcli
Date: Mon, 16 Mar 2020 21:55:42 -0400	[thread overview]
Message-ID: <87d09b68yp.fsf@gmail.com> (raw)

Over the weekend, I spent a bit of time figuring how to use OpenVPN with
NetworkManager, especially its command line interface, 'nmcli'.

If you are using the Guix System, the first thing to do is to add the
openvpn plugin to your network-manager-service-type configuration, like
this:

--8<---------------cut here---------------start------------->8---
(services
 ...
 (modify-services %my-desktop-services
   (network-manager-service-type config =>
                             (network-manager-configuration
                              (inherit config)
                              (vpn-plugins
                               (list network-manager-openvpn)))))
--8<---------------cut here---------------end--------------->8---

Then you'll want to reconfigure your machine, *and* reboot (restarting
the networking service and dbus-session were not enough, for some reason
I couldn't figure out).

My base file looked like this:

--8<---------------cut here---------------start------------->8---
client
dev tun
proto udp
remote some-server.net 5912
resolv-retry infinite
nobind
persist-key
persist-tun
auth-user-pass
comp-lzo
verb 3
remote-cert-tls server

<ca>
-----BEGIN CERTIFICATE-----
some-long-cert-string...
-----END CERTIFICATE-----
</ca>

<cert>
-----BEGIN CERTIFICATE-----
some-long-cert-string
-----END CERTIFICATE-----
</cert>

<key>
-----BEGIN PRIVATE KEY-----
some-long-private-key-string
-----END PRIVATE KEY-----
</key>--
8<---------------cut here---------------end--------------->8---

To import this with nmcli, it's easy:

$ sudo nmcli connection import type openvpn file your-openvpn-config-file.ovpn

And if, like me, this configuration requires inputing a username and
password for authenticating, and you don't want to be bothered to, you
can embed those secrets in the connection configuration with:

$ sudo nmcli connection modify $your-connection vpn.user-name $your-username
$ sudo nmcli connection modify $your-connection vpn.secrets password=$your-password
$ sudo nmcli connection modify $your-connection $your-username +vpn.data password-flags=0

The password-flags=0 disables some integration with the GNOME keyring,
which I don't use.

This has the benefit of automatically adding the VPN DNS server to your
/etc/resolv.conf, compared with connecting directly with openvpn (or our
Guix openvpn service).

HTH!

Maxim

             reply	other threads:[~2020-03-17  1:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17  1:55 Maxim Cournoyer [this message]
2020-03-17 14:47 ` [kb] Using an OpenVPN config with nmcli Joshua Branson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d09b68yp.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=help-guix@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.