DEV Community

Diego Musagy Casas
Diego Musagy Casas

Posted on • Originally published at defiant-thrush-083.notion.site

Using ProtonVPN with OpenVPN on Arch Linux (for Japan servers 🇯🇵)

Today I was using my Arch Linux setup while listening to my favorite singer, Kanon Wakeshima, an amazing Japanese artist. But I realized that most of her discography is blocked for foreign countries, including some of my favorite albums.

screenshot

So, for the past couple of years, I’ve been using Spotify with a Japanese account to access her entire discography. The downside? I can’t log into it unless I’m “in Japan.” My workaround is to connect with a VPN, then disconnect so I don’t waste the free usage. In my case, I use ProtonVPN, since they offer free Japanese servers.

On Windows and Android, Proton makes it easy with their official apps. On Linux too — but only for simpler distros. In my case, I’m running Arch Linux with the BSPWM window manager and Gh0stzk’s dotfiles (for those interested). This makes things more complicated, especially since the ProtonVPN Linux app gave me tons of errors at first.

But there’s a better (and more advanced) way. Why? Because with Proton’s free plan you can’t pick a specific country — it randomly assigns you one of 5 countries, and you have a 20-minute cooldown if you want to reconnect. That sucks.

The alternative is to use OpenVPN with Proton’s VPN configuration files.


Step 1: Get ProtonVPN’s OpenVPN config

First, you’ll need a ProtonVPN configuration file, which you can download from the ProtonVPN downloads page. Scroll down to the OpenVPN configuration section (below the app downloads).

screenshot

Here, choose:

  • Platform (Linux in my case)
  • Protocol (default one)
  • Server type (free, of course 😅)
  • Country (Japan for me)

Always pick the server with the lowest percentage.

Now that you’ve got your configuration file, open it with your favorite text editor (I’m using VS Code):

screenshot


Step 2: Install systemd resolver script

Next, you need to check your systemd version. Most likely it’s higher than 229. If not, check the official guide.

If you’re on a supported version, install this AUR package:

# Script using Paru
paru -S openvpn-update-systemd-resolved
Enter fullscreen mode Exit fullscreen mode

At the end of the install you should see this message:

To complete the installation, please add this script to your OpenVPN
settings for each of the VPNs you wish it to manage the DNS for:
    script-security 2
    up /usr/bin/update-systemd-resolved
    up-restart
    down /usr/bin/update-systemd-resolved
    down-pre
Enter fullscreen mode Exit fullscreen mode

Step 3: Edit the config file

So, where do we add this script in the config file? Right before the tokens section.

screenshot

Replace the old script section with the one provided by the AUR:

# Scripts

script-security 2
up /usr/bin/update-systemd-resolved
up-restart
down /usr/bin/update-systemd-resolved
down-pre

# Tokens
Enter fullscreen mode Exit fullscreen mode

screenshot


Step 4: Move config to OpenVPN folder

Now, rename the file to something shorter (I called it jp.ovpn) and move it to /etc/openvpn/client/ as superuser.

# Copy *.ovpn file to OpenVPN client folder
sudo cp jp.ovpn /etc/openvpn/client/
Enter fullscreen mode Exit fullscreen mode

Next, make sure the resolver service is running:

# Check systemd-resolved status
sudo systemctl status systemd-resolved

# If inactive, start it
sudo systemctl start systemd-resolved
Enter fullscreen mode Exit fullscreen mode

Then, start OpenVPN with:

# Start OpenVPN
sudo openvpn /etc/openvpn/client/jp.ovpn
Enter fullscreen mode Exit fullscreen mode

Step 5: Login with ProtonVPN credentials

At this point, OpenVPN will prompt you for authentication. To get your credentials, log into your Proton account and scroll down the account page.

screenshot

Copy-paste your username and password into the terminal.

Note: If you get a cache error, reset your credentials using the blue button under the credentials.

screenshot

And that’s it! You’re now connected to the internet as if you were in Japan. 🎉

screenshot


Conclusion

Yep, that’s how far my fandom for a single singer takes me — just so I can listen to her music banned in my country. But hey, now I can finally enjoy my favorite album again.

screenshot

Top comments (0)