Bug 2038446 - openconnect command line can establish Pulse sessions but NetworkManager-openconnect cannot
Summary: openconnect command line can establish Pulse sessions but NetworkManager-open...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: NetworkManager-openconnect
Version: 35
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: David Woodhouse
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-07 22:45 UTC by James Ralston
Modified: 2022-12-13 16:16 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2022-12-13 16:16:26 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description James Ralston 2022-01-07 22:45:58 UTC
Description of problem:

Our organization uses Juniper Pulse for our VPN, with Duo Security for 2FA. If I use the openconnect command line as root to connect, it works perfectly:

$ openconnect --protocol=pulse https://vpn.example.org/it-esp
Connected to 1.2.3.4:443
SSL negotiation with vpn.example.org
Connected to HTTPS on vpn.example.org with ciphersuite (TLS1.2)-(ECDHE-SECP384R1)-(ECDSA-SHA512)-(AES-256-GCM)
Got HTTP response: HTTP/1.1 101 Switching Protocols
Enter user credentials:
Username:myusername
Password:xxxxxxxxxxxxxxxxxxx
Enter secondary credentials:
Secondary password:push

[confirm Duo Secure prompt]

Connected as 10.64.207.167, using SSL, with ESP in progress
ESP session established with server

$ openconnect --protocol=pulse https://vpn.example.org/it
Connected to 1.2.3.4:443
SSL negotiation with vpn.example.org
Connected to HTTPS on vpn.example.org with ciphersuite (TLS1.2)-(ECDHE-SECP384R1)-(ECDSA-SHA512)-(AES-256-GCM)
Got HTTP response: HTTP/1.1 101 Switching Protocols
Enter user credentials:
Username:myusername
Password:xxxxxxxxxxxxxxxxxxx
Enter secondary credentials:
Secondary password:push

[confirm Duo Secure prompt]

Set up UDP failed; using SSL instead
Connected as 10.64.207.167, using SSL, with ESP disabled

But if I configure a Pulse VPN connection in NetworkManager, using either the ESP or non-ESP URI, NetworkManager-openconnect fails to connect.  After I confirm the Duo Secure prompt, the connection dialog hangs for about 20 seconds, then vanishes (not giving me a chance to copy the log), and these errors appear in the system logs:

$ cat /etc/NetworkManager/system-connections/myvpn.nmconnection
[connection]
id=myvpn
uuid=819937ae-fbc4-4f0d-a74f-3ebce890aec4
type=vpn
autoconnect=false
permissions=user:myusername:;

[vpn]
authtype=password
autoconnect-flags=0
certsigs-flags=0
cookie-flags=2
enable_csd_trojan=no
gateway=https://vpn.example.org/it-esp
gateway-flags=2
gwcert-flags=2
lasthost-flags=0
pem_passphrase_fsid=no
prevent_invalid_cert=no
protocol=pulse
stoken_source=disabled
xmlconfig-flags=0
service-type=org.freedesktop.NetworkManager.openconnect

[vpn-secrets]
form:pulse_user:username=myusername
lasthost=https:

[ipv4]
dns-search=
method=auto

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

[proxy]

$ journalctl -u NetworkManager | tail
Jan 07 17:14:09 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593649.2930] manager: (tun0): new Tun device (/org/freedesktop/NetworkManager/Devices/11)
Jan 07 17:14:09 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593649.3096] device (tun0): state change: unmanaged -> unavailable (reason 'connection-assumed', sys-iface-state: 'external')
Jan 07 17:14:09 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593649.3107] device (tun0): state change: unavailable -> disconnected (reason 'connection-assumed', sys-iface-state: 'external')
Jan 07 17:14:09 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593649.3111] device (tun0): Activation: starting connection 'tun0' (923923d0-6b25-4c59-a238-aa96e3da3962)
Jan 07 17:14:09 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593649.3127] device (tun0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'external')
Jan 07 17:14:09 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593649.3128] device (tun0): state change: prepare -> config (reason 'none', sys-iface-state: 'external')
Jan 07 17:14:09 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593649.3134] device (tun0): state change: config -> ip-config (reason 'none', sys-iface-state: 'external')
Jan 07 17:14:09 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593649.3135] device (tun0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'external')
Jan 07 17:14:09 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593649.3207] device (tun0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'external')
Jan 07 17:14:09 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593649.3208] device (tun0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'external')
Jan 07 17:14:09 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593649.3212] device (tun0): Activation: successful, device activated.
Jan 07 17:14:28 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593668.4309] device (tun0): state change: activated -> unmanaged (reason 'unmanaged', sys-iface-state: 'removed')
Jan 07 17:14:42 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593682.9731] audit: op="connection-update" uuid="819937ae-fbc4-4f0d-a74f-3ebce890aec4" name="myvpn" args="vpn.data" pid=238143 uid=2000 result="success"
Jan 07 17:14:46 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593686.9434] audit: op="connection-activate" uuid="819937ae-fbc4-4f0d-a74f-3ebce890aec4" name="myvpn" pid=3498 uid=2000 result="success"
Jan 07 17:14:46 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593686.9454] vpn-connection[0x5564b2088740,819937ae-fbc4-4f0d-a74f-3ebce890aec4,"myvpn",0]: Started the VPN service, PID 239490
Jan 07 17:14:46 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593686.9511] vpn-connection[0x5564b2088740,819937ae-fbc4-4f0d-a74f-3ebce890aec4,"myvpn",0]: Saw the service appear; activating connection
Jan 07 17:15:25 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593725.0155] vpn-connection[0x5564b2088740,819937ae-fbc4-4f0d-a74f-3ebce890aec4,"myvpn",0]: VPN connection: (ConnectInteractive) reply received
Jan 07 17:15:25 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593725.0171] manager: (vpn0): new Tun device (/org/freedesktop/NetworkManager/Devices/12)
Jan 07 17:15:25 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593725.0184] vpn-connection[0x5564b2088740,819937ae-fbc4-4f0d-a74f-3ebce890aec4,"myvpn",0]: VPN plugin: state changed: starting (3)
Jan 07 17:15:25 shieldbreaker.l33tskillz.private openconnect[239536]: Connected to 1.2.3.4:443
Jan 07 17:15:25 shieldbreaker.l33tskillz.private openconnect[239536]: SSL negotiation with 1.2.3.4
Jan 07 17:15:25 shieldbreaker.l33tskillz.private openconnect[239536]: Server certificate verify failed: signer not found
Jan 07 17:15:25 shieldbreaker.l33tskillz.private openconnect[239536]: Connected to HTTPS on 1.2.3.4 with ciphersuite (TLS1.2)-(ECDHE-SECP384R1)-(ECDSA-SHA512)-(AES-256-GCM)
Jan 07 17:15:25 shieldbreaker.l33tskillz.private openconnect[239536]: Got HTTP response: HTTP/1.1 101 Switching Protocols
Jan 07 17:15:25 shieldbreaker.l33tskillz.private openconnect[239536]: Pulse authentication cookie not accepted
Jan 07 17:15:25 shieldbreaker.l33tskillz.private NetworkManager[239536]: Creating SSL connection failed
Jan 07 17:15:25 shieldbreaker.l33tskillz.private NetworkManager[1496]: <warn>  [1641593725.2258] vpn-connection[0x5564b2088740,819937ae-fbc4-4f0d-a74f-3ebce890aec4,"myvpn",0]: VPN plugin: failed: connect-failed (1)
Jan 07 17:15:25 shieldbreaker.l33tskillz.private NetworkManager[1496]: <warn>  [1641593725.2259] vpn-connection[0x5564b2088740,819937ae-fbc4-4f0d-a74f-3ebce890aec4,"myvpn",0]: VPN plugin: failed: connect-failed (1)
Jan 07 17:15:25 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593725.2259] vpn-connection[0x5564b2088740,819937ae-fbc4-4f0d-a74f-3ebce890aec4,"myvpn",0]: VPN plugin: state changed: stopping (5)
Jan 07 17:15:25 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593725.2260] vpn-connection[0x5564b2088740,819937ae-fbc4-4f0d-a74f-3ebce890aec4,"myvpn",0]: VPN plugin: state changed: stopped (6)
Jan 07 17:15:25 shieldbreaker.l33tskillz.private NetworkManager[1496]: <info>  [1641593725.2264] vpn-connection[0x5564b2088740,819937ae-fbc4-4f0d-a74f-3ebce890aec4,"myvpn",0]: VPN service disappeared

The “Server certificate verify failed” error seems suspicious, but since the TLS certificate the VPN presents verifies perfectly with the openconnect command line, I don’t know why that would be the case.

For now, this is trivial to work around: I can simply run openconnect as root by hand, which works perfectly, and has since at least Fedora 33 (possibly as far back as Fedora 29).

But this is klugy. If the openconnect command line works, so should NetworkManager-openconnect. If there are additional settings that need to be specified in the NetworkManager configuration screens to make it work, it’s not obvious what those settings are, given that the openconnect command line works perfectly with just the protocol specification and the URI.

Version-Release number of selected component (if applicable):

openconnect-8.10-7.fc35.x86_64
NetworkManager-openconnect-1.2.6-8.fc35.x86_64
NetworkManager-openconnect-gnome-1.2.6-8.fc35.x86_64

Additional info:

I am a Fedora developer and packager, so I can easily rebuild RPM packages in order to test patches.

I am willing to privately provide non-redacted logs and connection information (sans passwords, of course).

Comment 1 David Woodhouse 2022-04-19 19:08:54 UTC
What happens if you run openconnect in the "two-phase" mode from the command line, using '--authenticate' on the first connection and then providing the resulting cookie in a '-C' argument to a second invocation of openconnect?

Can you mail me full logs of those with --dump-http-traffic please?

Comment 2 James Ralston 2022-04-20 17:58:56 UTC
Aha: in two-phase mode, the first phase succeeds, outputting the (COOKIE, HOST, FINGERPRINT) environment variables, but when supplying those to the second phase, it fails. For the second phase, I see these two additional error messages now:

Got inappropriate HTTP CONNECT response: HTTP/1.1 302 Found
Creating SSL connection failed

I will email complete logs of both phases with --dump-http-traffic to you momentarily.

Thanks!

Comment 3 David Woodhouse 2022-04-20 18:28:11 UTC
Thanks for logs. Can you repeat using `--protocol pulse` for the connection phase too, please? That was trying to connect as if it was an AnyConnect server...

Comment 4 James Ralston 2022-04-20 18:59:26 UTC
Doh—yes, using --protocol=pulse in both phases would probably be useful. I emailed new logs to you just now.

Comment 5 Ben Cotton 2022-11-29 17:37:01 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '35'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 6 Ben Cotton 2022-12-13 16:16:26 UTC
Fedora Linux 35 entered end-of-life (EOL) status on 2022-12-13.

Fedora Linux 35 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.