6

I am running a RedHat Enterprise Linux 7.3 server with NetworkManager 1.4 that needs periodic access over VPN to a client's network using openconnect 7.06-1.el7. I can use nmcli to connect with the --ask option without problems, but it obstinately refuses to let me supply a password automatically.

I followed the instructions from a previous question but whether I restart NetworkManager, use nmcli con reload, or reboot the whole system, it just ignores the [vpn-secrets] section in the configuration file.

[connection]
id=Client VPN Interface
uuid=9f0d7d19-8bdf-40e1-9fc8-abce32cda118
type=vpn
permissions=
secondaries=

[vpn]
authgroup=Comp
gateway=client.gateway.com
password-flags=0
service-type=org.freedesktop.NetworkManager.openconnect
user-name=myuser

[vpn-secrets]
password=mypass

[ipv4]
dns-search=
method=auto

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto

The error message that I receive is:

A password is required to connect to 'Client VPN Interface'.
Warning: password for 'vpn.secrets.gateway' not given in 'passwd-file' and nmcli cannot ask without '--ask' option.
Error: Connection activation failed: no valid VPN secrets.

If I use the same password with --ask, it works. If I try to supply a passwd-file, it demands that I also add vpn.secrets.cookie and vpn.secrets.gwcert, neither of which I know or need if I use the prompts. If I set cookie-flags=4 and gwcert-flags=4, it still requires them.

May I please have some help?

Brad
  • 161
  • 1
  • 1
  • 2

2 Answers2

2

After adding the lines [vpn-secrets]

Restart network manager

systemctl restart NetworkManager 

Then bring the connection up with nmcli

guntbert
  • 553
  • 7
  • 21
2

You need to keep in mind that if you are editing a config generated by the NetworkManager and any changes via the UI or CLI against the connection will reset and remove the non-default configuration elements. This means if you open the connection through "Manage network connections" or run nmcli commands to update any value, if you look at the config it will probably be missing the secrets.

As per penguinbait's answer you will need to edit the file and save, then restart NetworkManager.

dragon788
  • 756
  • 6
  • 10