Force Openconnect Anyconnect VPN to store Primary and secondary Passwords
An issue i was personally facing is that after a Manjaro Linux update my KDE Openconnect somehow removed my primary password and secondary one (2FA password).
I didn’t quite had time to diagnose and understand what went wrong. Even when relying on my lazy google search i couldn’t find a fix/workaround for this.
Ultimately i did fix the issue myself by doing the following.
sudo -i
cd /etc/NetworkManager/system-connections
vim VPNNAME.nmconnection #identify your VPNNAME connection
in the [vpn] section, after enable_csd_trojan=no, add :
form:main:password-flags=1
form:main:secondary_password-flags=1
form:password_new:new_password-flags=1
form:password_new:verify_password-flags=1
Also, copy the uuid value in the top of the file, you’ll need it afterwards.
Now open KwalletManager, then go to Network Management|Maps.
You’ll find different Maps, check for one having the vpn tag and the uuid that you previously copied.
If you don’t find it, don’t panic. All you have to do is create a new entry by right-clicking on the Maps subfolder > New.
the syntax of the element is similar to :
{uuid};vpn
By selecting your newly created element, go to the right black space, then right-click to create a new entry key.
* Key = VpnSecrets
* Value = `form:main:password%SEP%MYPASSWORD%SEP%form:main:secondary_password%SEP%push%SEP%form:password_new:new_password%SEP%MYPASSWORD%SEP%form:password_new:verify_password%SEP%MYPASSWORD`
What you need to change in this value is the MYPASSWORD to your password, and decide to keep or not the secondary_password depending if you use apps like authoticator or DUO for 2FA.
Click on save.
Now if you try to connect to your VPN from your NetworkManager you’ll magically find your values stored !!
