Using MozillaVPN without the GUI (part 1)
This is the first article of a two-parts series that explains how to use MozillaVPN, a virtual private network (VPN), without the official GUI but using NetworkManager as management user interface instead. This article is a quick tutorial providing four quick steps to get started.
MozillaVPN is a virtual private network (VPN) service that offers security and privacy while browsing the internet. While it can be used through the Mozilla VPN interface, some users may prefer to use it in a different way. This is where MozWire comes in.
MozWire is an open-source command-line utility that allows users to easily manage their MozillaVPN connections. It can be used to import MozillaVPN configurations into other VPN clients, such as NetworkManager, which is a popular choice for Linux systems.
In this article, we will guide you through how to extract MozillaVPN connections with MozWire and then import them into NetworkManager, allowing for greater flexibility and control in managing your MozillaVPN connections.
Step 1 : Prepare your system
First install requirements for wireguard
$ sudo apt install resolvconf wireguard-tools
First, grant access to the /etc/wireguard directory to the wireguard group, and add your current user to this group.
$ sudo addgroup wireguard
$ sudo chmod -R ug+rw /etc/wireguard/
$ sudo chown -R root:wireguard /etc/wireguard/
$ sudo adduser $(whoami) wireguard
Step 2 : Extracting MozillaVPN connections with MozWire
To use MozWire, first download and build it by running the following commands:
$ git clone https://github.com/NilsIrl/MozWire.git
$ cd MozWire
$ sudo apt install cargo
$ cargo build -r
Next, you need to extract the configuration for all MozillaVPN connections into the /tmp/wireguard directory. To do this, you will need to run the following commands (as root):
$ mkdir -p mozconfig
$ export MOZ_TOKEN="$(unset MOZ_TOKEN && ./target/release/mozwire --print-token)"
$ ./target/release/mozwire relay save -o mozconfig -n 0
Public key not in device list, uploading it.
Wrote configuration to /tmp/wireguard/au3-wireguard.conf.
Wrote configuration to /tmp/wireguard/au4-wireguard.conf.
Wrote configuration to /tmp/wireguard/au10-wireguard.conf.
[...]
Wrote configuration to /tmp/wireguard/us-sea-wg-208.conf.
Wrote configuration to /tmp/wireguard/us-sea-wg-301.conf.
Wrote configuration to /tmp/wireguard/us-sea-wg-302.conf.
Step 3 : Importing wireguard configuration files into NetworkManager
Once you have extracted wireguard configuration files for MozillaVPN, you can import them all at once into NetworkManager with the Wireguard importer script for NetworkManager.
Download the script and import wireguard configuration files , download it, and save it as wgimport.sh on your system. Then run it with the following command:
# bash wgimport.sh MozillaVPN mozconfig
Step 4 : Done and ready !
FIXME: explain that the next step is about
References
- MozWire - An unofficial configuration manager giving Linux, macOS users (among others), access to MozillaVPN.
- MozillaVPN - A Virtual Private Network from the makers of Firefox.
- Wireguard importer script for NetworkManager - A script to automatically import wireguard configuration files to NetworkManager.