]> www.infradead.org Git - users/dwmw2/openconnect.git/log
users/dwmw2/openconnect.git
5 years agoFix download coverity
David Woodhouse [Mon, 7 Oct 2019 16:47:42 +0000 (17:47 +0100)]
Fix download

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoClean up Coverity curl invocations, stop trying to set PATH
David Woodhouse [Mon, 7 Oct 2019 16:39:49 +0000 (17:39 +0100)]
Clean up Coverity curl invocations, stop trying to set PATH

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix up PATH harder
David Woodhouse [Mon, 7 Oct 2019 16:32:06 +0000 (17:32 +0100)]
Fix up PATH harder

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoGSSAPI for Fedora/GnuTLS CI too
David Woodhouse [Mon, 7 Oct 2019 16:28:47 +0000 (17:28 +0100)]
GSSAPI for Fedora/GnuTLS CI too

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix PATH
David Woodhouse [Mon, 7 Oct 2019 16:25:11 +0000 (17:25 +0100)]
Fix PATH

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoCoverity build for OpenSSL too
David Woodhouse [Mon, 7 Oct 2019 16:17:14 +0000 (17:17 +0100)]
Coverity build for OpenSSL too

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd Coverity scan
David Woodhouse [Mon, 7 Oct 2019 14:30:31 +0000 (15:30 +0100)]
Add Coverity scan

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix EPEL builds in COPR
David Woodhouse [Thu, 3 Oct 2019 12:52:24 +0000 (13:52 +0100)]
Fix EPEL builds in COPR

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoMerge branch 'globalprotect_auth' of gitlab.com:dlenski/openconnect
David Woodhouse [Thu, 3 Oct 2019 11:58:52 +0000 (12:58 +0100)]
Merge branch 'globalprotect_auth' of gitlab.com:dlenski/openconnect

5 years agoMerge branch 'fix_issue_78_crash_and_stop_trying_to_reconnect' of gitlab.com:dlenski...
David Woodhouse [Thu, 3 Oct 2019 11:57:06 +0000 (12:57 +0100)]
Merge branch 'fix_issue_78_crash_and_stop_trying_to_reconnect' of gitlab.com:dlenski/openconnect

Fixes: #78
5 years agoUse GNUTLS_PK_ECC instead of GNUTLS_PK_ECDSA for compatibility
David Woodhouse [Thu, 3 Oct 2019 11:52:05 +0000 (12:52 +0100)]
Use GNUTLS_PK_ECC instead of GNUTLS_PK_ECDSA for compatibility

Fixes: #76
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoanother GP error string that tells the client to stop trying to reconnect
Daniel Lenski [Sun, 29 Sep 2019 20:29:26 +0000 (13:29 -0700)]
another GP error string that tells the client to stop trying to reconnect

As shown in https://gitlab.com/openconnect/openconnect/issues/78, the
message "Allow Automatic Restoration of SSL VPN is disabled" in a
GlobalProtect error response indicates that the server will not accept the
previously-valid auth cookie, so the client should give up retrying.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoFix double-free when client repeatedly fails to pull GlobalProtect client config
Daniel Lenski [Sun, 29 Sep 2019 20:36:44 +0000 (13:36 -0700)]
Fix double-free when client repeatedly fails to pull GlobalProtect client config

When openconnect attempts to rebuild the GP connection, upon rekey or
loss-of-connectivity, it re-requests the client configuration XML
(/ssl-vpn/getconfig.esp).  It saves the old `cstp_options` prior to querying
the new ones, and then free()'s them after verifying that the IP addresses
and netmasks haven't changed.

If the config request fails to return valid XML twice in a row, the old
`cstp_options` would be double-freed, causing the crash described in
https://gitlab.com/openconnect/openconnect/issues/78.

The fix is to ensure that the old `cstp_options` are set to NULL as soon as
they're copied into `old_cstp_options`.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoRework HTTP header fetching to receive into oc_text_buf
David Woodhouse [Fri, 13 Sep 2019 12:51:37 +0000 (13:51 +0100)]
Rework HTTP header fetching to receive into oc_text_buf

Also handles continuations.

Fixes: #65
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUse localtime_s where available to fix MSYS2 build
David Woodhouse [Fri, 13 Sep 2019 09:43:44 +0000 (10:43 +0100)]
Use localtime_s where available to fix MSYS2 build

Fixes: #74
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoExplicitly link libtss2-mu for tss2-esys build
David Woodhouse [Fri, 13 Sep 2019 07:35:43 +0000 (08:35 +0100)]
Explicitly link libtss2-mu for tss2-esys build

We use the marshalling functions directly and mustn't rely on transitive
linking.

Fixes: #73
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoTag version 8.05 v8.05
David Woodhouse [Wed, 11 Sep 2019 23:31:04 +0000 (00:31 +0100)]
Tag version 8.05

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix buffer overflow with chunked HTTP handling (CVE-2019-16239)
David Woodhouse [Tue, 10 Sep 2019 16:30:12 +0000 (17:30 +0100)]
Fix buffer overflow with chunked HTTP handling (CVE-2019-16239)

Over a decade ago, I was vocally sad about the fact that I needed to
implement HTTP client code for myself because none of the available
options at the time gave me sufficient control over the underlying
TLS connection.

This is why. A malicious HTTP server (after we have accepted its
identity certificate) can provide bogus chunk lengths for chunked
HTTP encoding and cause a heap overflow.

Reported by Lukas Kupczyk of the Advanced Research Team at CrowdStrike
Intelligence.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUpdate translations from GNOME
David Woodhouse [Wed, 11 Sep 2019 13:51:36 +0000 (14:51 +0100)]
Update translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoClose HTTPS connection on failure returns from process_http_response()
David Woodhouse [Tue, 10 Sep 2019 16:10:23 +0000 (17:10 +0100)]
Close HTTPS connection on failure returns from process_http_response()

If we've failed to process the response, don't leave the connection open.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoDon't crash if gnutls_x509_crt_list_import() fails
Omar Sandoval [Tue, 27 Aug 2019 16:27:51 +0000 (09:27 -0700)]
Don't crash if gnutls_x509_crt_list_import() fails

On error, gnutls_x509_crt_list_import() deinitializes any certificates
that it loaded (this isn't documented, of course, but see [1]). However,
we're also deinitializing them in the error handling case, resulting in
a double-free. Set nr_extra_certs to zero in that case so that we don't
crash.

1: https://gitlab.com/gnutls/gnutls/blob/gnutls_3_6_9/lib/x509/x509.c#L3864

Signed-off-by: Omar Sandoval <osandov@osandov.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoexplain GlobalProtect portals vs. gateways in the docs
Daniel Lenski [Wed, 28 Aug 2019 23:43:27 +0000 (16:43 -0700)]
explain GlobalProtect portals vs. gateways in the docs

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoGlobalProtect: try to connect to portal interface before gateway
Daniel Lenski [Wed, 28 Aug 2019 23:21:03 +0000 (16:21 -0700)]
GlobalProtect: try to connect to portal interface before gateway

This makes OpenConnect behave more like the official GP clients, which
should make more sense to new users especially when troublesheeting, without
removing the useful ability to connect directly to a gateway.
(See https://gitlab.com/openconnect/openconnect/merge_requests/56#note_209428777)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoGlobalProtect login bugfix: reversed condition where portal form should be retried...
Daniel Lenski [Wed, 28 Aug 2019 23:18:39 +0000 (16:18 -0700)]
GlobalProtect login bugfix: reversed condition where portal form should be retried on gateway

I broke this in 3e91f7bf

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoUpdate changelog for GP ESP fix
David Woodhouse [Mon, 12 Aug 2019 08:39:35 +0000 (10:39 +0200)]
Update changelog for GP ESP fix

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoOnly add packet to oNCP control queue with nc and pulse protocols
Corey Wright [Sun, 11 Aug 2019 10:00:04 +0000 (05:00 -0500)]
Only add packet to oNCP control queue with nc and pulse protocols

Don't add packets to the oNCP control queue if not using Juniper
Network Connect or Pulse Connect Secure protocols otherwise a number
of packets equal to the maximum queue length can be queued and disable
reading from the TUN device for the duration of the VPN connection
because the packets will never get dequeued except when using those
two protocols.

Commit b4f50f8 broke OpenConnect transmitting across the GlobalProtect
protocol with ESP packets when:
1. The tun device has an IPv6 address (eg link local).
2. IPv6 packets (eg router solicitation) are transmitted in quantity
   equal to maximum queue length.

[dwmw2: Check the udp_send_probes function insted of two string compares]
Signed-off-by: Corey Wright <cwright@digitalocean.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoTag version 8.04 v8.04
David Woodhouse [Fri, 9 Aug 2019 15:08:45 +0000 (16:08 +0100)]
Tag version 8.04

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoRemove hipreport-android.sh from COPR RPM build
David Woodhouse [Tue, 6 Aug 2019 11:57:29 +0000 (12:57 +0100)]
Remove hipreport-android.sh from COPR RPM build

It causes bogus dependencies on /system/bin/sh

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoSimplify openconnect_set_http_proxy() and report errors
David Woodhouse [Fri, 2 Aug 2019 21:52:22 +0000 (14:52 -0700)]
Simplify openconnect_set_http_proxy() and report errors

There was a failure mode where openconnect would exit silently if given
a --proxy= argument it didn't like. Make it print errors in all cases,
and eliminate an -ENOMEM case which seems entirely gratuitous; I don't
think internal_parse_url() needs the 'const char *url' it's passed to
be hackishly writeable, so there is no need to allocate our own copy.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix proxy username and password parsing.
David Woodhouse [Fri, 2 Aug 2019 21:05:08 +0000 (14:05 -0700)]
Fix proxy username and password parsing.

We are supposed to take the *last* (unescaped) @ sign as the separation
between user:pass and hostname, not the first. So use strrchr() instead
of strchr().

Conversely, the first colon is the separation between user and pass so
strchr is still correct there.

Also actually support unescaping the resulting username and password.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoImplicitly enable basic auth for SOCKS if creds are provided.
David Woodhouse [Fri, 2 Aug 2019 17:51:09 +0000 (10:51 -0700)]
Implicitly enable basic auth for SOCKS if creds are provided.

Forcing the user to add --proxy-auth=basic on the command line as well as
providing the creds in the proxy URL is horrid. It took me a long time to
work out why it wasn't working.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUpdate translatons from GNOME
David Woodhouse [Thu, 1 Aug 2019 22:33:58 +0000 (15:33 -0700)]
Update translatons from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoKill bogus 'no GSSAPI' warning when it isn't true
David Woodhouse [Thu, 1 Aug 2019 22:32:40 +0000 (15:32 -0700)]
Kill bogus 'no GSSAPI' warning when it isn't true

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoIncrease buffer size for oNCP configuration
David Woodhouse [Wed, 24 Jul 2019 11:02:44 +0000 (12:02 +0100)]
Increase buffer size for oNCP configuration

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1729693

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoSupport autobuild for COPR
David Woodhouse [Tue, 16 Jul 2019 13:22:42 +0000 (14:22 +0100)]
Support autobuild for COPR

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd IPPROTO_IPIP compat definition to fix MinGW build
David Woodhouse [Tue, 16 Jul 2019 11:27:23 +0000 (12:27 +0100)]
Add IPPROTO_IPIP compat definition to fix MinGW build

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFor Pulse, send ESP only of the same IP protocol as we're connected over
David Woodhouse [Tue, 16 Jul 2019 10:37:59 +0000 (11:37 +0100)]
For Pulse, send ESP only of the same IP protocol as we're connected over

It really seems that when we're connected over Legacy IP, it only accepts
Legacy IP packets in ESP. And when we're connected over IPv6, it only
accepts IPv6 packets in ESP.

This matches the behaviour of the Windows client too.

If you connect to a NC server over IPv6 it doesn't even offer the ESP
config (since NC doesn't support IPv6 within the tunnel).

Someone really ought to report this bug to Pulse. For IPv6 VPN traffic
to be forced into TCP-over-TCP mode when you happen to be connected to
the VPN over Legacy IP is very bad.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoSet ESP Next Header correctly for IPv6 again
David Woodhouse [Tue, 16 Jul 2019 09:41:44 +0000 (10:41 +0100)]
Set ESP Next Header correctly for IPv6 again

This reverts commit a6fe0d0d8088c49b65df7ae2ea1ee254ab34639a, and allows
the protocol to be specified for the Pulse/NC probes.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUpdate translatons from GNOME
David Woodhouse [Tue, 16 Jul 2019 08:51:21 +0000 (09:51 +0100)]
Update translatons from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoVarious documentation updates (DTLSv1.2, Pulse, TNCC)
David Woodhouse [Fri, 28 Jun 2019 13:32:52 +0000 (14:32 +0100)]
Various documentation updates (DTLSv1.2, Pulse, TNCC)

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAttempt to handle Pulse password/passcode auth flow better
David Woodhouse [Fri, 28 Jun 2019 13:02:17 +0000 (14:02 +0100)]
Attempt to handle Pulse password/passcode auth flow better

Lots of special cases here for primary/secondary and retries.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAllow oversized incoming DTLS packets
David Woodhouse [Thu, 27 Jun 2019 14:59:18 +0000 (15:59 +0100)]
Allow oversized incoming DTLS packets

Bring DTLS into line with everything else, as with commit 0281a8e1db.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoRevert "Look a lot more like the Windows client..."
David Woodhouse [Sat, 15 Jun 2019 21:20:50 +0000 (22:20 +0100)]
Revert "Look a lot more like the Windows client..."

This reverts commit 8b3f467a9280dabc5b151feb88b894895178bf91, which was
only really for testing and I never meant to push it to the master branch.

Apparently it makes the server do EAP-TLS within EAP-TTLS if no
certificate is presented by the client. I am not ready for that level of
insanity just yet.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoInterpret Pulse auth failure AVP
David Woodhouse [Sat, 15 Jun 2019 20:17:04 +0000 (21:17 +0100)]
Interpret Pulse auth failure AVP

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAcknowledge Pulse post-signin message
David Woodhouse [Sat, 15 Jun 2019 19:14:01 +0000 (20:14 +0100)]
Acknowledge Pulse post-signin message

The whole auth handling now wants cleaning up, and a pre-signin message can
appear with the login request too.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd tokencode support for Pulse
David Woodhouse [Fri, 14 Jun 2019 22:48:11 +0000 (23:48 +0100)]
Add tokencode support for Pulse

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUpdate CSTP for IPv6 DNS servers
Colin Petrie [Thu, 27 Jun 2019 16:24:51 +0000 (18:24 +0200)]
Update CSTP for IPv6 DNS servers

When the Cisco side is configured with IPv4 and IPv6 DNS resolver IPs,
it will send option X-CSTP-DNS-IP6
This patch captures the IPv6 addresses provided, and puts them in
INTERNAL_IP6_DNS variable for vpnc-scripts (which is already handled
there)

Signed-off-by: Colin Petrie <colin@spakka.net>
[dwmw2: Put them in $INTERNAL_IP4_DNS instead. They shouldn't be split.]
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd IPv6 DNS and split routing for Pulse.
David Woodhouse [Thu, 13 Jun 2019 20:17:28 +0000 (21:17 +0100)]
Add IPv6 DNS and split routing for Pulse.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoTurn off Extended Master Secret support (RFC7627) for resumed DTLS sessions
David Woodhouse [Wed, 12 Jun 2019 09:16:22 +0000 (10:16 +0100)]
Turn off Extended Master Secret support (RFC7627) for resumed DTLS sessions

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoTranslate strings in openconnect_get_supported_protocols()
David Woodhouse [Tue, 11 Jun 2019 12:30:41 +0000 (13:30 +0100)]
Translate strings in openconnect_get_supported_protocols()

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoImprove Pulse ESP setup reliability.
David Woodhouse [Mon, 10 Jun 2019 21:55:25 +0000 (22:55 +0100)]
Improve Pulse ESP setup reliability.

Sometimes, the server is slow to process the ESP config so our first probes
don't elicit a response. Abuse the licensing information packet which comes
after the connection is set up, and send a second set of probes when it
arrives.

Perhaps we should actually send three probes, half a second apart.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoLook a lot more like the Windows client...
David Woodhouse [Mon, 10 Jun 2019 21:26:41 +0000 (22:26 +0100)]
Look a lot more like the Windows client...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoRevert "Set ESP Next Header field to 0x29 for IPv6 packets"
David Woodhouse [Mon, 10 Jun 2019 21:35:26 +0000 (22:35 +0100)]
Revert "Set ESP Next Header field to 0x29 for IPv6 packets"

This reverts commit 02ae906bb691c8b342d7ff0875e200ce55c18f2a. Turns out
Pulse doesn't *accept* ESP frames with the correct Next-Header field
for IPv6. You have to send 0x04 (IPIP). So I cleaned it up and removed
the duplication for nothing...

Might need to put this back when we work out how GPST does IPv6.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoSet IPv6 netmask vs. address fields correctly for Pulse
David Woodhouse [Mon, 10 Jun 2019 21:09:11 +0000 (22:09 +0100)]
Set IPv6 netmask vs. address fields correctly for Pulse

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUpdate changelog
David Woodhouse [Mon, 10 Jun 2019 14:52:04 +0000 (15:52 +0100)]
Update changelog

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoImport translations from GNOME
David Woodhouse [Mon, 10 Jun 2019 13:23:13 +0000 (14:23 +0100)]
Import translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agopulse: Handle multiple IF-T/TLS records in a single SSL record
David Woodhouse [Mon, 10 Jun 2019 12:53:14 +0000 (13:53 +0100)]
pulse: Handle multiple IF-T/TLS records in a single SSL record

We are still assuming that IT-F/TLS record won't be *split* between SSL
records. That turned out to be a false assumption for Network Connect,
but hopefully they're saner here. We should cleanly complain about that
if it does happen.

There may be better ways to do this; perhaps we should receive the whole SSL
record then handle each record separately. In the common case there's no
real reason for the incoming packet queue anyway. We could just call
os_write_tun() directly. And then only have to resort to memcpy to
split packets up in the very rare case that the tun isn't taking writes
anyway.

This will do for now. The TCP connection *shouldn't* be the fast path
anyway. Not that we've worked out how to make the Pulse server actually
send data in ESP; even with the Windows client it still sends in TCP...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix EAP-TTLS build for OpenSSL 1.0.2 and earlier
David Woodhouse [Mon, 10 Jun 2019 12:10:52 +0000 (13:10 +0100)]
Fix EAP-TTLS build for OpenSSL 1.0.2 and earlier

The BIO structures aren't opaque there, and the accessors don't exist.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoRefuse to use libp11 0.4.7 as it's broken
David Woodhouse [Mon, 10 Jun 2019 11:47:53 +0000 (12:47 +0100)]
Refuse to use libp11 0.4.7 as it's broken

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix pulse build without HAVE_ESP
David Woodhouse [Mon, 10 Jun 2019 11:35:33 +0000 (12:35 +0100)]
Fix pulse build without HAVE_ESP

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoDisable encrypt-then-mac where possible with DTLS and OpenSSL
David Woodhouse [Mon, 10 Jun 2019 11:34:43 +0000 (12:34 +0100)]
Disable encrypt-then-mac where possible with DTLS and OpenSSL

There is pain here. Just don't bother.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix DTLS bug when lacking deprecated APIs
Rosen Penev [Mon, 10 Jun 2019 06:40:21 +0000 (23:40 -0700)]
Fix DTLS bug when lacking deprecated APIs

HAVE_DTLS12 is for DTLSv1_method. This causes dtls_method to be NULL and
crash.

[dwmw2: Rework it quite a bit more]

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix compilation without deprecated OpenSSL 1.1 APIs
Rosen Penev [Mon, 10 Jun 2019 06:36:53 +0000 (23:36 -0700)]
Fix compilation without deprecated OpenSSL 1.1 APIs

Initialization and deinitialization is deprecated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
5 years agofix GP MTU calculation
Daniel Lenski [Sun, 9 Jun 2019 21:58:25 +0000 (14:58 -0700)]
fix GP MTU calculation

1) Had been erroneously assuming 32-byte blocksize for AES-256 (it's only 16)
2) HMAC-SHA256 writes a 16-byte MAC

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoalso support sha256 with GlobalProtect ESP
Daniel Lenski [Sun, 9 Jun 2019 20:42:21 +0000 (13:42 -0700)]
also support sha256 with GlobalProtect ESP

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agogpst: Fix memory leak if udp_connect() fails.
raminfp [Wed, 29 May 2019 15:21:02 +0000 (15:21 +0000)]
gpst: Fix memory leak if udp_connect() fails.

Signed-off-by: Ramin Farajpour Cami <ramin.blackhat@gmail.com>
5 years agoAdd hipreport-android.sh
Daniel Lenski [Sat, 1 Jun 2019 02:10:10 +0000 (19:10 -0700)]
Add hipreport-android.sh

The desktop version of the HIP report doesn't work on Android in part
because the here-doc appears to exceed the size of the read buffer in
Android's rather primitive /system/bin/sh.  This is a rather confusing bug
to identify and diagnose.

Include an alternate script with minimal contents (hipreport-minimal.sh)
which is suitable for use on Android.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoconsolidate GlobalProtect OS name translation
Daniel Lenski [Fri, 18 Jan 2019 03:15:33 +0000 (19:15 -0800)]
consolidate GlobalProtect OS name translation

Suggested by David Woohouse:
    https://gitlab.com/openconnect/openconnect/merge_requests/17#note_124400905

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agocomment about GlobalProtect HTTP user-agent value
Daniel Lenski [Fri, 18 Jan 2019 03:02:02 +0000 (19:02 -0800)]
comment about GlobalProtect HTTP user-agent value

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoClean up and simplify GP ESP keying
Daniel Lenski [Mon, 14 Jan 2019 01:59:26 +0000 (17:59 -0800)]
Clean up and simplify GP ESP keying

Also, check for buffer overflow and inconsistent sizes (number of bits in
key != number specified) in ESP keys.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoIncomplete, speculative IPv6 for GlobalProtect
Daniel Lenski [Fri, 12 Jan 2018 09:44:17 +0000 (01:44 -0800)]
Incomplete, speculative IPv6 for GlobalProtect

Client-side IPv6 support was added in v4.0:
https://live.paloaltonetworks.com/t5/Colossal-Event-Blog/New-GlobalProtect-4-0-announced-with-IPv6-support/ba-p/141593

Server-side IPv6 support was added in PanOS 8.0:
https://www.paloaltonetworks.com/documentation/80/pan-os/newfeaturesguide/globalprotect-features

I've been wanting to get IPv6 working for a while, but don't have access to
a GP VPN that supports IPv6, and haven't found anyone else who does.  I'm
adding incomplete, speculative IPv6 support here in the hopes that someone
will use it and report back on partial success/failure:

* Known from Windows client: `ipv6-support=yes` in `/ssl-vpn/login.esp`
  request, `preferred-ipv6` in `/ssl-vpn/getconfig.esp` request,
  `client-ipv6` in `/ssl-vpn/hipreport{,check}.esp` requests,
  `app-version=4.0.5-8`,
* Educated guess: 0x0800 in GPST packet header represents IPv4 ethertype,
  and will be replaced with 0x86DD for IPv6 packets.
* Unknown: IPv6 routing configuration tags to expect in
  `/ssl-vpn/getconfig.esp` response. This build prints a prominent
  error message if it encounters any unknown configuration tags
  containing the character '6', and requests feedback to the mailing
  list.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoReport GP session lifetime
Dan Lenski [Sat, 25 May 2019 05:41:19 +0000 (22:41 -0700)]
Report GP session lifetime

OpenConnect doesn't have a mechanism to immediately stop trying to reconnect
after the session expires.

Server-forced session expiration "takes care of itself" when OpenConnect
tries to reconnect repeatedly and fails, though it might be useful to save
the expected expiration time somewhere to be able to report it in a more
user-friendly fashion.

Signed-off-by: Dan Lenski <dlenski@gmail.com>
5 years agoBetter spoofed HIP report
Dan Lenski [Sat, 25 May 2019 04:54:40 +0000 (21:54 -0700)]
Better spoofed HIP report

Some GlobalProtect VPNs appear to actually check the contents of the HIP
report in some way, and require that anti-virus/anti-spyware software be
labeled as up-to-date.

Also, the --computer parameter is no longer needed (now that its value
is included in the "cookie")

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoSet ESP Next Header field to 0x29 for IPv6 packets
David Woodhouse [Sun, 9 Jun 2019 23:43:43 +0000 (00:43 +0100)]
Set ESP Next Header field to 0x29 for IPv6 packets

This didn't matter before as we didn't transport IPv6 in ESP — NC doesn't
support it and we haven't worked it out for GPST yet. But Pulse does.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoSplit out construct_esp_packet() to avoid duplication
David Woodhouse [Sun, 9 Jun 2019 23:39:27 +0000 (00:39 +0100)]
Split out construct_esp_packet() to avoid duplication

I want to make it set the next header field correctly, and that's the last
straw; I don't want multiple copies of it.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd ESP support for Pulse
David Woodhouse [Sun, 9 Jun 2019 23:05:12 +0000 (00:05 +0100)]
Add ESP support for Pulse

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agopulse: Split out config packet handling and loop until end-of-config received
David Woodhouse [Sun, 9 Jun 2019 20:39:51 +0000 (21:39 +0100)]
pulse: Split out config packet handling and loop until end-of-config received

Dan did this. It seemed like a good idea.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd HMAC-SHA256-128 support for ESP
David Woodhouse [Sat, 8 Jun 2019 15:20:37 +0000 (16:20 +0100)]
Add HMAC-SHA256-128 support for ESP

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd Pulse Connect Secure support
David Woodhouse [Fri, 7 Jun 2019 19:32:07 +0000 (20:32 +0100)]
Add Pulse Connect Secure support

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoConvert dump_buf_hex() to use oc_text_buf instead of sprintf
David Woodhouse [Fri, 7 Jun 2019 16:04:41 +0000 (17:04 +0100)]
Convert dump_buf_hex() to use oc_text_buf instead of sprintf

I seem to recall the OpenBSD build will complain loudly about the use of
"bad" functions like sprintf. And even though this particular code does
seem to be perfectly correct, they do have a point in the general case.

Just use buf_append() for this, since that's what it was designed for.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agomake dump_buf_hex() show printable characters as well
Daniel Lenski [Tue, 4 Jun 2019 18:09:31 +0000 (11:09 -0700)]
make dump_buf_hex() show printable characters as well

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoFix peer_cert_hash memory leaks
David Woodhouse [Fri, 7 Jun 2019 18:36:49 +0000 (19:36 +0100)]
Fix peer_cert_hash memory leaks

Spotted while running Pulse code under Valgrind

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoRevamp MTU detection
David Woodhouse [Fri, 24 May 2019 15:53:05 +0000 (16:53 +0100)]
Revamp MTU detection

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoConsolidate common parts of setup_esp_keys()
David Woodhouse [Mon, 15 Apr 2019 12:43:06 +0000 (13:43 +0100)]
Consolidate common parts of setup_esp_keys()

There was a fair amount of redundancy between the OpenSSL and GnuTLS
variants. Create a new common function for that instead.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoTag version 8.03 v8.03
David Woodhouse [Sat, 18 May 2019 17:54:18 +0000 (18:54 +0100)]
Tag version 8.03

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoResync translations with sources
David Woodhouse [Sat, 18 May 2019 17:49:22 +0000 (10:49 -0700)]
Resync translations with sources

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUpdate translations from GNOME
David Woodhouse [Sat, 18 May 2019 17:47:37 +0000 (10:47 -0700)]
Update translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUpdate changelog
David Woodhouse [Sat, 18 May 2019 17:43:15 +0000 (10:43 -0700)]
Update changelog

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoInclude <errno.h> in gnutls_tpm2_ibm.c
David Woodhouse [Thu, 16 May 2019 18:18:30 +0000 (11:18 -0700)]
Include <errno.h> in gnutls_tpm2_ibm.c

Some environments don't pull it in implicitly; we should include it for
ourselves.

gnutls_tpm2_ibm.c: In function ‘install_tpm2_key’:
gnutls_tpm2_ibm.c:485:11: error: ‘EINVAL’ undeclared (first use in this function)
   return -EINVAL;
           ^~~~~~
gnutls_tpm2_ibm.c:485:11: note: each undeclared identifier is reported only once for each function it appears in
gnutls_tpm2_ibm.c:490:11: error: ‘ENOMEM’ undeclared (first use in this function)
   return -ENOMEM;
           ^~~~~~
gnutls_tpm2_ibm.c:528:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
Makefile:1206: recipe for target 'libopenconnect_la-gnutls_tpm2_ibm.lo' failed

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoKill MAX_BUF_LEN
David Woodhouse [Sat, 11 May 2019 09:41:14 +0000 (10:41 +0100)]
Kill MAX_BUF_LEN

There's no real point in having a hard limit for struct oc_text_buf, the
whole point of which is that it is dynamically allocated. Just guard
against the int buf_len overflowing.

In process_http_response() the hard-coded buf[] array is only used for
headers one line at a time now, so 8KiB should suffice.

Fixes: #39
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoMerge branch 'tmp-update-gui-link' of gitlab.com:nmav/openconnect
David Woodhouse [Fri, 10 May 2019 12:28:21 +0000 (13:28 +0100)]
Merge branch 'tmp-update-gui-link' of gitlab.com:nmav/openconnect

5 years agoReturn -EPERM when server changes IP address, not -EINVAL
David Woodhouse [Fri, 10 May 2019 11:06:19 +0000 (12:06 +0100)]
Return -EPERM when server changes IP address, not -EINVAL

This will be treated as an auth failure, and the ssl_reconnect() function
will give up instead of continuing to retry.

Fixes: #38
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoMerge branch 'allow_routes_with_no_netmask' of gitlab.com:dlenski/openconnect
David Woodhouse [Fri, 10 May 2019 10:46:00 +0000 (11:46 +0100)]
Merge branch 'allow_routes_with_no_netmask' of gitlab.com:dlenski/openconnect

5 years agolinked to the right page for openconnect-gui and updated description
Nikos Mavrogiannopoulos [Sat, 4 May 2019 07:38:48 +0000 (09:38 +0200)]
linked to the right page for openconnect-gui and updated description

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
6 years agoAllow script_setenv() to truncate values
David Woodhouse [Thu, 25 Apr 2019 11:57:31 +0000 (13:57 +0200)]
Allow script_setenv() to truncate values

This means we don't have to do nasty things to const strings in
process_split_xxclude().

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoClean up memset_s() detection a bit more.
David Woodhouse [Thu, 25 Apr 2019 11:01:02 +0000 (13:01 +0200)]
Clean up memset_s() detection a bit more.

Definining __STDC_WANT_LIB_EXT1__ to get memset_s() is required by the C11
standard, not a Solaris-ism. It's no use just to check for its presence
in the library with AC_CHECK_FUNC() if it isn't going to compile, so make
sure we check for it with AC_LINK_IFELSE() *and* with the warning flags
that might include -Werror-implicit-function-declarations.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoInclude <netinet/in_systm.h> before <netinet/ip_icmp.h> for Solaris
David Woodhouse [Wed, 24 Apr 2019 16:12:54 +0000 (18:12 +0200)]
Include <netinet/in_systm.h> before <netinet/ip_icmp.h> for Solaris

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFix Solaris 11.4 compilation by making memset_s() visible
David Woodhouse [Wed, 24 Apr 2019 16:10:40 +0000 (18:10 +0200)]
Fix Solaris 11.4 compilation by making memset_s() visible

Reported-by: Thomas Hildebrandt <thomas.hildebrandt@oracle.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFix wrong long option is used in the help messages
Yoshimasa Niwa [Thu, 11 Apr 2019 10:11:31 +0000 (03:11 -0700)]
Fix wrong long option is used in the help messages

`-F` has long option `--form-entry` and man page and many places are
all using `--form-entry`, however, help messages are using
`--form-field`.

Signed-off-by: Yoshimasa Niwa <niw@niw.at>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoAllow routes with no netmask (equivalent to /32 for IPv4 or /128 for IPv6)
Daniel Lenski [Sat, 20 Apr 2019 19:13:30 +0000 (15:13 -0400)]
Allow routes with no netmask (equivalent to /32 for IPv4 or /128 for IPv6)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>