Skip to content

Instantly share code, notes, and snippets.

@fmartins-andre
Created December 13, 2021 11:53
Show Gist options
  • Save fmartins-andre/343dbacca4e4b242a12e9fcccd5e85e5 to your computer and use it in GitHub Desktop.
Save fmartins-andre/343dbacca4e4b242a12e9fcccd5e85e5 to your computer and use it in GitHub Desktop.
Import an openvpn file to Gnome NetworkManager

Import OpenVPN file to NetworkManager

tags: linux, gnome, networkManager, pkcs12, p12

reference: askubuntu

This article intends to be reference when importing a openvpn file to NetworkManager on linux

  • Save the files in a folder;
  • Import the .ovpn file with the following command:
       sudo nmcli connection import type openvpn file your-file.ovpn
  • If this command results in an error indicating that it don't support a PKCS#12 file (.p12), you'll need to run the following commands in order to be able to import the openvpn file:
       openssl pkcs12 -in [input.p12] -cacerts -nokeys -out ca.crt
    and add the following lines to your .ovpn file:
       ca ca.crt
    
    after that, run again the first command (sudo nmcli connection...) to import the openvpn configuration to NetworkManager.

It should be working after these steps.

@fmartins-andre
Copy link
Author

fmartins-andre commented Jun 16, 2024

Notes:

  • use "viscosity" bundle to avoid the openssl part, as it usually comes with certs inline;
  • importing the file with this nmcli command may solve problems with gnome's networkmanager-openvpn plugin (Refs: openvpn forum)
  • when setting username and password in networkmanager vpn config, mark "store password for all users" to ensure that'll be saved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment