]> www.infradead.org Git - users/dwmw2/openconnect.git/log
users/dwmw2/openconnect.git
4 years agoMerge branch 'multiple_auth_feature' of gitlab.com:incentive.design/openconnect multiple_auth_feature
David Woodhouse [Fri, 15 May 2020 16:26:51 +0000 (17:26 +0100)]
Merge branch 'multiple_auth_feature' of gitlab.com:incentive.design/openconnect

4 years agoMerge branch 'add_set_cookie' of gitlab.com:randymoss/openconnect
David Woodhouse [Fri, 15 May 2020 16:06:31 +0000 (17:06 +0100)]
Merge branch 'add_set_cookie' of gitlab.com:randymoss/openconnect

4 years agoAdd `openconnect_set_cookie` function to library and jni
Randy Moss [Fri, 15 May 2020 16:04:53 +0000 (16:04 +0000)]
Add `openconnect_set_cookie` function to library and jni
Signed-off-by: Randy Moss <kasaxet794@homedepinst.com>
4 years agoAdd missing files to tarball for win32 build
Justin Kendrick [Thu, 14 May 2020 21:56:25 +0000 (16:56 -0500)]
Add missing files to tarball for win32 build

Fixes building from distribution tarball on win32/mingw.

Makefile.am: Include win32-ipicmp.h and openconnect.ico in tarball

Signed-off-by: Justin Kendrick <justin@kendrick.tech>
4 years agoCheck for Signed-off-by: in CI
David Woodhouse [Fri, 15 May 2020 13:00:39 +0000 (14:00 +0100)]
Check for Signed-off-by: in CI

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoRun Coverity only in openconnect/openconnect repo
David Woodhouse [Fri, 15 May 2020 12:33:56 +0000 (13:33 +0100)]
Run Coverity only in openconnect/openconnect repo

It won't work in someone else's master branch if they've forked the repo.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoUpdate packages documentation
David Woodhouse [Fri, 15 May 2020 10:32:14 +0000 (11:32 +0100)]
Update packages documentation

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoRemove Fedora updates-testing packages now pushed to stable
David Woodhouse [Fri, 15 May 2020 09:34:31 +0000 (10:34 +0100)]
Remove Fedora updates-testing packages now pushed to stable

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoWork around SoftHSM lockup in CI
David Woodhouse [Fri, 15 May 2020 09:31:27 +0000 (10:31 +0100)]
Work around SoftHSM lockup in CI

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoFix COPR release builds for mingw-openconnect
David Woodhouse [Thu, 14 May 2020 18:51:07 +0000 (19:51 +0100)]
Fix COPR release builds for mingw-openconnect

For release builds, the tarball contents still don't have the default
name; we need to explicitly state that it's openconnect-%{version}

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoTag version 8.10 v8.10
David Woodhouse [Thu, 14 May 2020 15:46:24 +0000 (16:46 +0100)]
Tag version 8.10

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoUpdate changelog
David Woodhouse [Thu, 14 May 2020 15:27:43 +0000 (16:27 +0100)]
Update changelog

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoMerge branch 'bug721570' of gitlab.com:floppym/openconnect
David Woodhouse [Thu, 14 May 2020 15:09:14 +0000 (16:09 +0100)]
Merge branch 'bug721570' of gitlab.com:floppym/openconnect

4 years agoBump Android API level to 23 to allow it to run on Android 10
David Woodhouse [Thu, 14 May 2020 13:28:21 +0000 (14:28 +0100)]
Bump Android API level to 23 to allow it to run on Android 10

Nobody cares about older API versions, which would only be needed
to support Android versions older than 6.0.

cf. https://gitlab.com/openconnect/openconnect/-/merge_requests/92

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoUpdate Android dependencies
David Woodhouse [Thu, 14 May 2020 11:56:46 +0000 (12:56 +0100)]
Update Android dependencies

Update GnuTLS, libxml2, nettle, gmp and lz4

Based on a patch from Severus <huynhok.uit@gmail.com>

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoMerge branch 'Juniper_frmNextToken_submit_button' of gitlab.com:openconnect/openconnect
David Woodhouse [Thu, 14 May 2020 11:18:41 +0000 (12:18 +0100)]
Merge branch 'Juniper_frmNextToken_submit_button' of gitlab.com:openconnect/openconnect

4 years agoMerge branch 'GP_stop_asking_to_report_unexpected_arg19=4' of gitlab.com:openconnect...
David Woodhouse [Thu, 14 May 2020 11:09:31 +0000 (12:09 +0100)]
Merge branch 'GP_stop_asking_to_report_unexpected_arg19=4' of gitlab.com:openconnect/openconnect

4 years agoMerge branch 'do_not_strip_newlines_in_CSD_response' of gitlab.com:dlenski/openconnect
David Woodhouse [Thu, 14 May 2020 10:50:07 +0000 (11:50 +0100)]
Merge branch 'do_not_strip_newlines_in_CSD_response' of gitlab.com:dlenski/openconnect

4 years agoget rid of a bunch of casts
Daniel Lenski [Wed, 13 May 2020 05:20:24 +0000 (22:20 -0700)]
get rid of a bunch of casts

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agostop asking users to report unexpected GP login argument arg[20]="unknown"
Daniel Lenski [Fri, 1 May 2020 18:49:25 +0000 (11:49 -0700)]
stop asking users to report unexpected GP login argument arg[20]="unknown"

We don't know what this one means, but newer GP servers always send it and it's basically uninteresting.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agognutls: prevent buffer overflow in get_cert_name
Sergei Trofimovich [Fri, 8 May 2020 14:39:41 +0000 (10:39 -0400)]
gnutls: prevent buffer overflow in get_cert_name

The test suite for ocserv calls openconnect with a certificate that has
a name that is 84 bytes in length. The buffer passed to get_cert_name is
currently 80 bytes.

The gnutls_x509_crt_get_dn_by_oid function will update the buffer size
parameter if the buffer is too small.

http://man7.org/linux/man-pages/man3/gnutls_x509_crt_get_dn_by_oid.3.html

RETURNS
       GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long
       enough, and in that case the  buf_size will be updated with the
       required size. GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE if there are no
       data in the current index. On success 0 is returned.

Use a temporary variable to avoid clobbering the namelen variable that is
passed to get_cert_name.

Bug: https://bugs.gentoo.org/721570
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
4 years agoJuniper frmNextToken: recognize secidactionEnter as submit button
Daniel Lenski [Thu, 7 May 2020 16:12:09 +0000 (09:12 -0700)]
Juniper frmNextToken: recognize secidactionEnter as submit button

ping #137

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoDisable OpenSSL RDRAND in COPR tests to work around SoftHSM deadlock
David Woodhouse [Thu, 7 May 2020 14:17:37 +0000 (15:17 +0100)]
Disable OpenSSL RDRAND in COPR tests to work around SoftHSM deadlock

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoFix name of tpm2-tss-engine
David Woodhouse [Thu, 7 May 2020 09:42:57 +0000 (10:42 +0100)]
Fix name of tpm2-tss-engine

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoAlso disable cURL's use of HTTP/1.1 expect logic
Daniel Lenski [Wed, 6 May 2020 22:05:00 +0000 (15:05 -0700)]
Also disable cURL's use of HTTP/1.1 expect logic

This is only a useful optimization for large payloads, and seems to confuse some Cisco ASAs or middleboxes.

See https://gms.tf/when-curl-sends-100-continue.html#disabling-expect-logic

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agosome ASAs are confused by stripping newlines from CSD response
Daniel Lenski [Wed, 6 May 2020 19:15:42 +0000 (12:15 -0700)]
some ASAs are confused by stripping newlines from CSD response

See #139 for report of this.

Using `curl --data-binary` instead of `--data` should avoid this issue.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoCheck status of gnutls_privkey_init and related
Tom Carroll [Sun, 3 May 2020 04:59:36 +0000 (21:59 -0700)]
Check status of gnutls_privkey_init and related

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoProvide password to load_tpm2_key
Tom Carroll [Sun, 3 May 2020 04:38:11 +0000 (21:38 -0700)]
Provide password to load_tpm2_key

Permit a single instance of tpm2. Return -EBUSY to inform of caller of
existing instance. Duplicate password when necessary.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoCheck calloc and gnutls_privkey_init status
Tom Carroll [Mon, 27 Apr 2020 00:01:50 +0000 (17:01 -0700)]
Check calloc and gnutls_privkey_init status

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoStub openssl challenge_response functions.
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
Stub openssl challenge_response functions.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoCheck key purpose satisfies authentication
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
Check key purpose satisfies authentication

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoAnnounce multiple cert auth in get_protocols
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
Announce multiple cert auth in get_protocols

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoConverse the multicert auth protocol
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
Converse the multicert auth protocol

Implement the multiple certificate-based authentication protocol.  The
XML-message protocol may require three rounds of conversations (instead
of the existing two): HTTP redirect, announce capabilities and receive
multicert challenge, and respond to the multicert challenge and obtain
cookie.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoAdd password parameter to load_tpm1
Tom Carroll [Sat, 25 Apr 2020 06:04:43 +0000 (23:04 -0700)]
Add password parameter to load_tpm1

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoAdd password to pin callback
Tom Carroll [Sat, 25 Apr 2020 06:47:33 +0000 (23:47 -0700)]
Add password to pin callback

There are (at least) two passwords, one for TLS session and another for
the multiple certificate-based authentication challenge. Add password
parameter to the pin callback.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoGnuTLS challenge signing
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
GnuTLS challenge signing

This is the GnuTLS implementation for signing the challenge. Variables
added to store the paths for the second set of credentials.

Challenge response comprises two elements: an identity and signature.
The identity is the user certificate, represented as a PEM-encoded PKCS7
certificate chain. The challenge is signed with the user certificate
and submitted back to the server as a PEM-encoded signature.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoUse rcstring for password.
Tom Carroll [Wed, 6 May 2020 07:23:36 +0000 (00:23 -0700)]
Use rcstring for password.

rcstring simplifies password handling, especially in latter phases.
Moreover, it reduces the number of copies.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoFactor out keycert loading
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
Factor out keycert loading

The objective is to have load_keycert fetch credentials for both
establishing the TLS session and responding to the multicert auth
challenge. The main changes are: load_keycert that is parameterized by
key_path, cert_path, and password; have secondary functions
parameterized by password; load_certificate stub to call load_keycert
and match caller impedance, including maintaining
gnutls_certificate_credentials and gnutls_session dependencies.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoA simple referenced-counted string
Tom Carroll [Wed, 6 May 2020 05:57:48 +0000 (22:57 -0700)]
A simple referenced-counted string

An implementation of a simple reference-counted string. The purpose of
this is to simplify password password and handling, and reduce the
number of password copies.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoCheck gnutls_init return status
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
Check gnutls_init return status

Check if gnutls_init has signaled error. If error, then unwind, freeing
credentials and other resources. Return error to caller.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoFactor out tls13 checks
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
Factor out tls13 checks

Simplifies subsequent load_keycert work.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoFactor out trust and cafile loading
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
Factor out trust and cafile loading

Simplifies subsequent load_keycert rework.

Previously, a separate path for android existed. Noted that it
duplicated much of the existing functionality of load_datum and cafile.
Functionality was factored into a separate function, removing
duplicative code path for Android.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoDistinguish out of memory from insufficient creds
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
Distinguish out of memory from insufficient creds

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoCopy the certificate
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
Copy the certificate

Making a copy of the certificate simplifies the logic. It sets us up
so that a certificate chain can be returned.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoFactored out key+cert match mechanism
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
Factored out key+cert match mechanism

Previously there were two alternates to check that the key matched the
certificate. Alternative one was employed if the key was a x509_privkey;
alternative two was used if the key was an abstract privkey. By
preferring the abstract privkey, the code can be deduplicated and
simplified. The adoption was modeled after GnuTLS 3.6.13
_gnutls_check_key_cert_match, which GnuTLS uses to verify that key and
cert are a pair. Match was factored out of load_certificate and put into
a separate function.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoRework load_certificate to prefer abstract privkey
Tom Carroll [Fri, 24 Apr 2020 06:15:59 +0000 (23:15 -0700)]
Rework load_certificate to prefer abstract privkey

Sets up a subsequent commit.

Previously, there were two types of keys: x509_privkey and abstract
privkey. Deduplicate functionality by preferring abstract privkey.

Signed-off-by: Tom Carroll <incentivedesign@gmail.com>
4 years agoMerge branch 'master' of ssh://gitlab.com/openconnect/OpenConnect
Tom Carroll [Wed, 6 May 2020 05:25:44 +0000 (22:25 -0700)]
Merge branch 'master' of ssh://gitlab.com/openconnect/OpenConnect

4 years agoFix up COPR specfiles for bash-completion script location
David Woodhouse [Mon, 4 May 2020 15:27:46 +0000 (16:27 +0100)]
Fix up COPR specfiles for bash-completion script location

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoMerge branch 'bash-completion' of gitlab.com:bluca/openconnect
David Woodhouse [Mon, 4 May 2020 12:50:38 +0000 (13:50 +0100)]
Merge branch 'bash-completion' of gitlab.com:bluca/openconnect

4 years agoUse shorter pathname for COPR RPM build
David Woodhouse [Mon, 4 May 2020 10:56:36 +0000 (11:56 +0100)]
Use shorter pathname for COPR RPM build

If the path of SOCKET_WRAPPER_DIR is too long, it doesn't fit in the
sun_path field of the sockaddr_un, and libsocket_wrapper gets very
unhappy, reporting 'Too many unix sockets'. Despite actually only ever
trying *one* path over and over again 1024 times due to truncation.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoUpdate CI
Tom Carroll [Mon, 4 May 2020 01:27:49 +0000 (18:27 -0700)]
Update CI

4 years agoInstall tncc-emulate.py too
Luca Boccassi [Sat, 2 May 2020 10:58:05 +0000 (11:58 +0100)]
Install tncc-emulate.py too

Signed-off-by: Luca Boccassi <bluca@debian.org>
4 years agoFix typo in autocomplete test log message
Luca Boccassi [Sat, 2 May 2020 10:57:14 +0000 (11:57 +0100)]
Fix typo in autocomplete test log message

Signed-off-by: Luca Boccassi <bluca@debian.org>
4 years agoBash completion: install as /usr/share/bash-completion/completions/openconnect
Luca Boccassi [Sat, 2 May 2020 10:53:37 +0000 (11:53 +0100)]
Bash completion: install as /usr/share/bash-completion/completions/openconnect

This is the common default installation pattern for quite some time

Signed-off-by: Luca Boccassi <bluca@debian.org>
4 years agoFix path to openconnect in bash completion
David Woodhouse [Sat, 2 May 2020 08:25:29 +0000 (09:25 +0100)]
Fix path to openconnect in bash completion

Oops, that wasn't supposed to get committed like that.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agostop asking users to report unexpected GP login argument arg[19]="4"
Daniel Lenski [Fri, 1 May 2020 18:49:25 +0000 (11:49 -0700)]
stop asking users to report unexpected GP login argument arg[19]="4"

We still don't know what this one means (my wild guess is that it's telling the client to prefer IPv4), but newer GP servers always send it and it's basically uninteresting.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoFix sigterm test at last
David Woodhouse [Fri, 1 May 2020 11:06:17 +0000 (12:06 +0100)]
Fix sigterm test at last

Make the main script wait for the device to be *up* not just exist.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoMore debug for sigterm
David Woodhouse [Fri, 1 May 2020 10:57:57 +0000 (11:57 +0100)]
More debug for sigterm

It's actually the vpnc-script which is failing:

 + '[' connect = connect ']'
+ ip link set dev oc-6352-tun0 up mtu 1434
Error: Device for nexthop is not up.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoNo, the sigterm test is just unreliable, like it always has been.
David Woodhouse [Fri, 1 May 2020 10:36:21 +0000 (11:36 +0100)]
No, the sigterm test is just unreliable, like it always has been.

A little more debugging. Perhaps just a longer sleep would suffice?

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoThe sigterm test is actually passing on CentOS8/GnuTLS
David Woodhouse [Fri, 1 May 2020 10:22:13 +0000 (11:22 +0100)]
The sigterm test is actually passing on CentOS8/GnuTLS

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoRevert "Add DLL requires for mingw package"
David Woodhouse [Fri, 1 May 2020 09:14:57 +0000 (10:14 +0100)]
Revert "Add DLL requires for mingw package"

This reverts commit 7f015dbf2aacf48356bb3e587d56e9ff21beefd7. With
https://bugzilla.redhat.com/show_bug.cgi?id=1830233 understood, it isn't
necessary to provide these manually.

4 years agoAttempt to fix EPEL8 build
David Woodhouse [Thu, 30 Apr 2020 16:41:20 +0000 (17:41 +0100)]
Attempt to fix EPEL8 build

Use --without-gnutls-version-check; as if EPEL8 *does* get the fix for
the zero-client-random bug it will probably come without a version bump.

This also partially reverts commit 68641c0393e which disabled the use of
--with-default-gnutls-priority on *all* EPEL versions, but since I wasn't
building for EPEL8 at that point I don't think it was done for EPEL8
specifically, and can probably be restored.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoImport wine fix for CI
David Woodhouse [Thu, 30 Apr 2020 15:19:47 +0000 (16:19 +0100)]
Import wine fix for CI

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoUpdate translations from GNOME
David Woodhouse [Thu, 30 Apr 2020 08:17:38 +0000 (09:17 +0100)]
Update translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoFix up changelog confusion a bit more
David Woodhouse [Thu, 30 Apr 2020 08:03:28 +0000 (09:03 +0100)]
Fix up changelog confusion a bit more

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agofix wrong string in error message
Daniel Lenski [Wed, 29 Apr 2020 21:35:36 +0000 (14:35 -0700)]
fix wrong string in error message

Typo in https://gitlab.com/openconnect/openconnect/-/merge_requests/97

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoadd and fix a few changelog entries
Daniel Lenski [Wed, 29 Apr 2020 21:34:43 +0000 (14:34 -0700)]
add and fix a few changelog entries

One significant user-facing entries left out of v8.09 changelog:
* modernized Juniper TNCC script

Two were labeled as being in v8.08 when in fact they weren't merged until v8.09:
* GlobalProtect MRs (!90, !93, !95)
* disabling of Nagle's algorithm for TLS sockets

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoAdd DLL requires for mingw package
David Woodhouse [Wed, 29 Apr 2020 15:58:40 +0000 (16:58 +0100)]
Add DLL requires for mingw package

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoNo SoftHSM for EPEL8 for now
David Woodhouse [Wed, 29 Apr 2020 15:49:18 +0000 (16:49 +0100)]
No SoftHSM for EPEL8 for now

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoTag version 8.09 v8.09
David Woodhouse [Wed, 29 Apr 2020 13:21:06 +0000 (14:21 +0100)]
Tag version 8.09

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoUpdate translations from GNOME
David Woodhouse [Wed, 29 Apr 2020 13:15:32 +0000 (14:15 +0100)]
Update translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoUse OpenSSL X509_check_host() and X509_check_ip() correctly.
Jordy Zomer [Thu, 23 Apr 2020 11:28:12 +0000 (13:28 +0200)]
Use OpenSSL X509_check_host() and X509_check_ip() correctly.

These functions return 1 for a successful match, 0 for a failed match,
-1 for an internal error, or -2 if the certificate is malformed.

OpenConnect has been treating any value other than zero as a success,
meaning that an attacker who could get a trusted CA to issue an invalid
certificate (on which the ASN.1 decoder fails, for example), could use
that to assume *any* identity.

This is CVE-2020-12105.

https://gitlab.com/openconnect/openconnect/-/merge_requests/96

Signed-off-by: Jordy Zomer <jordy@simplyhacker.com>
4 years agofix IPv4 split-{in,ex}clude routes with misspecified host bits
Daniel Lenski [Thu, 23 Apr 2020 17:30:40 +0000 (10:30 -0700)]
fix IPv4 split-{in,ex}clude routes with misspecified host bits

Some VPN platforms (GlobalProtect, apparently) allow administrators to input
such non-canonical IPv4 routes, and some routing configuration utilities
(apparently *not* iproute2) simply do not accept such non-canonical IPv4
routes.

An example of the confusion this can cause:
    https://lists.infradead.org/pipermail/openconnect-devel/2020-April/005665.html

The robustness principle suggests that the best thing to do here is to fix
these routes, but complain about them while we're at it.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoBuild mingw with lz4 and stoken
David Woodhouse [Mon, 27 Apr 2020 16:53:25 +0000 (17:53 +0100)]
Build mingw with lz4 and stoken

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoDrop wine-common for now, openconnect.exe in bindir
David Woodhouse [Mon, 27 Apr 2020 15:12:12 +0000 (16:12 +0100)]
Drop wine-common for now, openconnect.exe in bindir

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
4 years agoAdd mingw build in copr
David Woodhouse [Mon, 27 Apr 2020 12:20:16 +0000 (13:20 +0100)]
Add mingw build in copr

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix dependencies and tests/configs/server-cert.prm to dist
David Woodhouse [Sat, 25 Apr 2020 08:54:28 +0000 (09:54 +0100)]
Fix dependencies and tests/configs/server-cert.prm to dist

Strictly, *break* the dependencies. We don't want server-cert.pem being
gratuitously rebuilt. It's breaking the CI because the file isn't pristine
when 'make tmp-distdir' runs.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd commands for creating server-cert
David Woodhouse [Thu, 23 Apr 2020 13:33:02 +0000 (14:33 +0100)]
Add commands for creating server-cert

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd CentOS8 CI
David Woodhouse [Wed, 22 Apr 2020 15:57:59 +0000 (16:57 +0100)]
Add CentOS8 CI

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoLog in slots with CKF_USER_PIN_INITIALIZED and not CKF_LOGIN_REQUIRED
David Woodhouse [Tue, 14 Apr 2020 12:48:09 +0000 (13:48 +0100)]
Log in slots with CKF_USER_PIN_INITIALIZED and not CKF_LOGIN_REQUIRED

Fixes: #123 (for OpenSSL build)
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoReimport with SoftHSM v2.2
David Woodhouse [Wed, 22 Apr 2020 15:04:37 +0000 (16:04 +0100)]
Reimport with SoftHSM v2.2

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUpdate SoftHSM token import scripting and reimport
David Woodhouse [Wed, 22 Apr 2020 14:30:11 +0000 (15:30 +0100)]
Update SoftHSM token import scripting and reimport

The slot numbers get reassigned now.

The RSA key modulus had been imported with a leading zero bytes,
confusing SoftHSM when it tried to perform CKM_RSA_PKCS or
CKM_RSA_PKCS_PSS signatures.

https://github.com/opendnssec/SoftHSMv2/issues/544

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoMerge branch 'use_TCP_NODELAY_when_tunnel_running_over_TCP' of gitlab.com:openconnect...
David Woodhouse [Tue, 21 Apr 2020 21:31:39 +0000 (22:31 +0100)]
Merge branch 'use_TCP_NODELAY_when_tunnel_running_over_TCP' of gitlab.com:openconnect/openconnect

5 years agochangelog
Daniel Lenski [Tue, 21 Apr 2020 21:22:34 +0000 (14:22 -0700)]
changelog

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoset TCP_NODELAY unconditionally on TCP/TLS sockets
Daniel Lenski [Tue, 21 Apr 2020 20:03:42 +0000 (13:03 -0700)]
set TCP_NODELAY unconditionally on TCP/TLS sockets

This replaces 67162301, where I tried to only set `TCP_NODELAY` when using
TLS for the tunnel transport.

See https://gitlab.com/openconnect/openconnect/-/merge_requests/89#note_328398311
for why setting it unconditionally is probably the best choice for openconnect.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoMerge branch 'tncc_wrapper_Py3k' of gitlab.com:dlenski/openconnect
David Woodhouse [Tue, 21 Apr 2020 17:05:47 +0000 (18:05 +0100)]
Merge branch 'tncc_wrapper_Py3k' of gitlab.com:dlenski/openconnect

5 years agoMerge branch 'GP_urldecode_login_arguments' of gitlab.com:dlenski/openconnect
David Woodhouse [Tue, 21 Apr 2020 16:57:42 +0000 (17:57 +0100)]
Merge branch 'GP_urldecode_login_arguments' of gitlab.com:dlenski/openconnect

5 years agoChangelog entry for GP changes (covers !90, !93, !95)
Daniel Lenski [Tue, 21 Apr 2020 16:45:39 +0000 (09:45 -0700)]
Changelog entry for GP changes (covers !90, !93, !95)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoURL-decode GlobalProtect login response fields
Daniel Lenski [Sun, 19 Apr 2020 01:13:39 +0000 (18:13 -0700)]
URL-decode GlobalProtect login response fields

The usage of URL encoding in the fields sent by GP servers here is
inconsistent, but in particular the value "%28empty_domain%29" keeps popping up
in places where the server expects "(empty_domain)" (like the stupidly redundant
logout operation). So we do this to be safe and to ensure logout succeeds.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agotrigger periodic TNCC even if we have no packets to receive from oNCP, and don't...
Daniel Lenski [Wed, 8 Apr 2020 06:25:17 +0000 (23:25 -0700)]
trigger periodic TNCC even if we have no packets to receive from oNCP, and don't use server's interval if zero

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoMerge branch 'modify_GP_challenge_2FA_form_handling' of gitlab.com:openconnect/openco...
David Woodhouse [Tue, 21 Apr 2020 16:26:12 +0000 (17:26 +0100)]
Merge branch 'modify_GP_challenge_2FA_form_handling' of gitlab.com:openconnect/openconnect

5 years agoMerge branch 'fix_print_supported_protocols' of gitlab.com:openconnect/openconnect
David Woodhouse [Tue, 21 Apr 2020 16:18:22 +0000 (17:18 +0100)]
Merge branch 'fix_print_supported_protocols' of gitlab.com:openconnect/openconnect

5 years agoMerge branch 'potential_HIP_fix' of gitlab.com:openconnect/openconnect
David Woodhouse [Tue, 21 Apr 2020 16:17:16 +0000 (17:17 +0100)]
Merge branch 'potential_HIP_fix' of gitlab.com:openconnect/openconnect

5 years agoGP: run HIP report 60 seconds in advance of the server's interval (just as we rekey...
Daniel Lenski [Tue, 21 Apr 2020 02:34:36 +0000 (19:34 -0700)]
GP: run HIP report 60 seconds in advance of the server's interval (just as we rekey 60 seconds in advance)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoperiodic HIP fix: ping /ssl-vpn/hipreportcheck.esp at specified interval no matter...
Daniel Lenski [Tue, 21 Apr 2020 01:51:41 +0000 (18:51 -0700)]
periodic HIP fix: ping /ssl-vpn/hipreportcheck.esp at specified interval no matter what

This is a fix for the very subtle regression between v8.05 and v8.08 described in this thread: https://lists.infradead.org/pipermail/openconnect-devel/2020-April/005609.html

- Server never asks for HIP report submission, and no HIP script specified
  with `--csd-wrapper`
- v8.05 successfully rekeys 1 minute before server-specified rekey interval,
  and continues successfully
- v8.08 appears to successfully rekey, but then gets forced off one minute
  later
- Only apparent difference between the two is that v8.05 re-pings
  /ssl-vpn/hipreportcheck.esp every time it gets the config
  (/ssl-vpn/getconfig.esp), whereas v8.08 only pings it exactly once.

The bottom line is that _even if_ we have no mechanism to actually submit a
HIP report (no `--csd-wrapper`) and _even if_ we think the server will say
"no HIP report needed" every time we check, in order to keep the server from
kicking the client off, we should still…

* ping /ssl-vpn/hipreportcheck.esp at the interval (specified by the portal or `--force-trojan` or 1 hour default)
* ping /ssl-vpn/hipreportcheck.esp every time we re-fetch the config (/ssl-vpn/getconfig.esp) in order to rekey or reconnect

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoAdd AC_DEFINE description for LIBPROXY_HDR in non-pkgconfig case
David Woodhouse [Tue, 21 Apr 2020 15:56:03 +0000 (16:56 +0100)]
Add AC_DEFINE description for LIBPROXY_HDR in non-pkgconfig case

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoCheck for localtime_s() only on Windows.
David Woodhouse [Tue, 21 Apr 2020 15:54:46 +0000 (16:54 +0100)]
Check for localtime_s() only on Windows.

Solaris has it too, but with the arguments reversed. Yay!

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix print_supported_protocols and print_supported_protocols_usage
Daniel Lenski [Mon, 20 Apr 2020 17:14:50 +0000 (10:14 -0700)]
Fix print_supported_protocols and print_supported_protocols_usage

These were broken in 7cb8996e21b442c4ec60ce25c87e8a69516fac17, when the
empty sentinel value at the end of the array was removed, without changing
the way these functions iterate over that array.

For some reason, this continues to work on Linux (probably due to `calloc`
allocating more zeroed bytes than we request, in
`openconnect_get_supported_protocols`), but is causing the expected SIGSEGV on
Solaris:
https://lists.infradead.org/pipermail/openconnect-devel/2020-April/005640.html

Fix:

- Modify `print_supported_protocols` and `print_supported_protocols_usage` to
  rely on the length returned by `openconnect_get_supported_protocols`.
- Restore the sentinel value at the end of the array returned by
  `openconnect_get_supported_protocols`, to preserve ABI compatibility for
  other users who may depend on this sentinel.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoClean up autocompletion a little
David Woodhouse [Thu, 16 Apr 2020 14:06:19 +0000 (15:06 +0100)]
Clean up autocompletion a little

Make it handle short options with arguments. Long options with arguments
don't work yet because the = makes strange things happen.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix uninitialised 'matcher' in autocompletion
David Woodhouse [Wed, 15 Apr 2020 14:05:33 +0000 (15:05 +0100)]
Fix uninitialised 'matcher' in autocompletion

Signed-off-by: David Woodhouse <dwmw2@infradead.org>