How to encode Pre-Shared Key (PSK) of and L2TP IPSEC connection managed by Network-Manager
If I create a VPN L2TP IPSEC connection using Network-Manager GUI, I introduce the PSK, but this one looks different on /etc/NetworkManager/system-connection/myvpn.nmconnection
I am thinking the PSK gets encoded somehow, since it begins with 0s it's probably binary base64 encoded (I read this in NetworkManager's docs). I have no clue how to encode this.
I am also guessing, if I want to create a connection with nmcli connection add
from terminal (I use Ubuntu Server 20.04), I will need to encode the PSK so it will be properly read in the config file. How should I go about this?
Can I just type the PSK in plain text into the command or change the Key/Value pair inside the .nmconnection file without using GUI so it will be read and interpreted the right way?
Thanks!
libreswan and strongswan accept PSKs that are plain text or base64 starting with 0s
. Similarily you can use either format in the vpn connection configuration file you want to edit.
If you edit the connection configuration file (e.g. to change to plain text PSK), be sure to issue the following so that any connection changes are picked up:
nmcli con reload