]> www.infradead.org Git - users/dwmw2/openconnect.git/log
users/dwmw2/openconnect.git
6 years agoProcess X-DTLS12-CipherSuite: header from server
David Woodhouse [Wed, 9 Jan 2019 12:36:05 +0000 (12:36 +0000)]
Process X-DTLS12-CipherSuite: header from server

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoClean up X-DTLS-CipherSuite header generation to allow for DTLSv1.2
David Woodhouse [Mon, 7 Jan 2019 11:51:34 +0000 (11:51 +0000)]
Clean up X-DTLS-CipherSuite header generation to allow for DTLSv1.2

Allow crypto code to provide the values for both DTLS and DTLSv1.2
headers separately.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoOpenSSL: Loop over DTLS ciphersuites looking for the one we asked for.
David Woodhouse [Wed, 9 Jan 2019 12:02:57 +0000 (12:02 +0000)]
OpenSSL: Loop over DTLS ciphersuites looking for the one we asked for.

As of OpenSSL 1.1.1, the trick of using SSL_CTX_set_cipher_list() and then
expecting only the one ciphersuite to be present in what we get back from
SSL_get_ciphers(), is no longer working. It now always returns the TLSv1.3
ciphers, even though we don't have DTLSv1.3 yet.

Reported as https://github.com/openssl/openssl/issues/8004 but probably
not going to change; the most likely outcome there is that I'm told that
I'm Doing It Wrong™ and a different approach is suggested.

In the meantime, just loop over the results and pick the one that we
actually asked for.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFix up building against local static OpenSSL
David Woodhouse [Wed, 9 Jan 2019 11:40:45 +0000 (11:40 +0000)]
Fix up building against local static OpenSSL

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoMerge branch 'libtasn1_fix_for_Android' of gitlab.com:dlenski/openconnect
David Woodhouse [Mon, 7 Jan 2019 10:15:09 +0000 (10:15 +0000)]
Merge branch 'libtasn1_fix_for_Android' of gitlab.com:dlenski/openconnect

6 years agodon't double-include libtasn1.h (breaks Android cross-build)
Daniel Lenski [Sun, 6 Jan 2019 06:52:50 +0000 (22:52 -0800)]
don't double-include libtasn1.h (breaks Android cross-build)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
6 years agoFix Mageia TSS2_ESYS build
David GEIGER [Sat, 5 Jan 2019 22:27:24 +0000 (22:27 +0000)]
Fix Mageia TSS2_ESYS build

On Mageia Cauldron latest openconnect 8.00 and 8.01 fais to build with
TSS2_ESYS support due to a missing header in gnutls_tpm2_esys.c file, so
adding #include <errno.h> in gnutls_tpm2_esys.c fixes build.

Signed-off-by: David Geiger (Mageia Linux Team Packager) <geiger.david68210@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoTag version 8.01 v8.01
David Woodhouse [Sat, 5 Jan 2019 10:44:38 +0000 (10:44 +0000)]
Tag version 8.01

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoUpdate changelog
David Woodhouse [Sat, 5 Jan 2019 10:42:01 +0000 (10:42 +0000)]
Update changelog

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFix memset_s arguments harder.
David Woodhouse [Sat, 5 Jan 2019 10:40:13 +0000 (10:40 +0000)]
Fix memset_s arguments harder.

Doh.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoMerge branch 'extra_headers_for_IP_packet_munging_on_BSDs' of gitlab.com:dlenski...
David Woodhouse [Sat, 5 Jan 2019 10:37:06 +0000 (10:37 +0000)]
Merge branch 'extra_headers_for_IP_packet_munging_on_BSDs' of gitlab.com:dlenski/openconnect

6 years agoGP ESP: extra headers must be explicitly included for IP packet munging on *BSD
Daniel Lenski [Sat, 5 Jan 2019 00:19:46 +0000 (16:19 -0800)]
GP ESP: extra headers must be explicitly included for IP packet munging on *BSD

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
6 years agoTag version 8.00 v8.00
David Woodhouse [Sat, 5 Jan 2019 00:01:33 +0000 (00:01 +0000)]
Tag version 8.00

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoResync translations with sources
David Woodhouse [Sat, 5 Jan 2019 00:00:10 +0000 (00:00 +0000)]
Resync translations with sources

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoExplicitly reference python2 in shebang for tncc-wrapper.py
David Woodhouse [Fri, 4 Jan 2019 23:51:47 +0000 (23:51 +0000)]
Explicitly reference python2 in shebang for tncc-wrapper.py

The RPM build complains:
BUILDSTDERR: *** ERROR: ambiguous python shebang in /usr/libexec/openconnect/tncc-wrapper.py: #!/usr/bin/python. Change it to python3 (or python2) explicitly.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoInstall trojan scripts to $(pkglibexecdir)
David Woodhouse [Fri, 4 Jan 2019 23:19:27 +0000 (23:19 +0000)]
Install trojan scripts to $(pkglibexecdir)

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoMerge branch 'CLOEXEC_for_GP_HIP' of gitlab.com:dlenski/openconnect
David Woodhouse [Fri, 4 Jan 2019 20:25:17 +0000 (20:25 +0000)]
Merge branch 'CLOEXEC_for_GP_HIP' of gitlab.com:dlenski/openconnect

6 years agoFix memset_s() parameters.
David Woodhouse [Fri, 4 Jan 2019 20:23:30 +0000 (20:23 +0000)]
Fix memset_s() parameters.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoset CLOEXEC for GP's HIP pipes as well
Daniel Lenski [Fri, 4 Jan 2019 18:11:13 +0000 (10:11 -0800)]
set CLOEXEC for GP's HIP pipes as well

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
6 years agoClean up TNCC error handling
David Woodhouse [Fri, 4 Jan 2019 14:37:14 +0000 (14:37 +0000)]
Clean up TNCC error handling

As suggested by Daniel Lenski, create the oc_text_buf for the request
only once the TNCC wrapper has been spawned, to make the error handling
a bit saner. And remember to close the socketpair if fork() fails, too.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFix order of dup2 args in spawning TNCC, and add comments
David Woodhouse [Fri, 4 Jan 2019 14:31:30 +0000 (14:31 +0000)]
Fix order of dup2 args in spawning TNCC, and add comments

Reported-by: Daniel Lenski <dlenski@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoUse cancellable_gets() for TNCC communication
David Woodhouse [Fri, 4 Jan 2019 12:44:33 +0000 (12:44 +0000)]
Use cancellable_gets() for TNCC communication

Just keep things simple. This avoids SOCK_SEQPACKET which doesn't work on
OSX, and stops assuming that TNCC will send the whole response in a single
send() call.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoSplit out cancellable recv/send/gets functions from proxy code
David Woodhouse [Fri, 4 Jan 2019 12:24:04 +0000 (12:24 +0000)]
Split out cancellable recv/send/gets functions from proxy code

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoTNCC periodic host checking fix
Nick Parrin [Wed, 12 Dec 2018 17:19:06 +0000 (18:19 +0100)]
TNCC periodic host checking fix

Fix periodic host checking in check_cookie_success() by passing
dspreauth to TNCC instead of dsid

Signed-off-by: Nick Parrin <spam@coreworks.be>
6 years agoInclude all keys in dist
David Woodhouse [Thu, 3 Jan 2019 23:17:25 +0000 (23:17 +0000)]
Include all keys in dist

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoUpdate translations from GNOME
David Woodhouse [Thu, 3 Jan 2019 22:52:51 +0000 (22:52 +0000)]
Update translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoMerge branch 'oh_what_fun_it_is_to_spoof' of gitlab.com:dlenski/openconnect
David Woodhouse [Thu, 3 Jan 2019 22:41:20 +0000 (22:41 +0000)]
Merge branch 'oh_what_fun_it_is_to_spoof' of gitlab.com:dlenski/openconnect

6 years agomake csd-post.sh continue with a warning without xmlstarlet (using Poor Man's vary...
Daniel Lenski [Mon, 17 Dec 2018 00:49:58 +0000 (16:49 -0800)]
make csd-post.sh continue with a warning without xmlstarlet (using Poor Man's vary speshul XML parsing)

6 years agomove trojans (csd-post.sh, csd-wrapper.sh, hipreport.sh, tncc-wrapper.py) to trojans...
Daniel Lenski [Mon, 17 Dec 2018 00:38:40 +0000 (16:38 -0800)]
move trojans (csd-post.sh, csd-wrapper.sh, hipreport.sh, tncc-wrapper.py) to trojans/ subdirectory and expand and clarify their documentation

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
6 years agoEncrypt digests being signed with IBM TSS2.
David Woodhouse [Thu, 3 Jan 2019 21:39:08 +0000 (21:39 +0000)]
Encrypt digests being signed with IBM TSS2.

The digest itself will end up on the wire. But the computed hash including
the secrets should probably be obsecured. For the TPM that's an input
parameter, which it must decrypt. Hence TPMA_SESSION_DECRYPT.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoDisable TLSv1.3 when hardware RSA keys can't support PSS
David Woodhouse [Thu, 3 Jan 2019 15:16:38 +0000 (15:16 +0000)]
Disable TLSv1.3 when hardware RSA keys can't support PSS

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoMerge branch 'fix_asprintf' into 'master'
David Woodhouse [Sat, 29 Dec 2018 08:42:41 +0000 (08:42 +0000)]
Merge branch 'fix_asprintf' into 'master'

asprintf() returns -1 on error

See merge request openconnect/openconnect!22

6 years agoasprintf() returns -1 on error
Daniel Lenski [Thu, 27 Dec 2018 23:13:32 +0000 (15:13 -0800)]
asprintf() returns -1 on error

Fixes the bugs reported on the mailing list and Ubuntu tracker…

- http://lists.infradead.org/pipermail/openconnect-devel/2018-December/005164.html "Failed to obtain WebVPN cookie introduced by f08767d9644029bd3ac0e83bf160a7bf03a5c8de"
- https://bugs.launchpad.net/bugs/1809839 "[Bug 1809839] [NEW] Daily build 2667 broken for protocol=GP"

6 years agoClear TCG TSS2 auth passwords on free
David Woodhouse [Fri, 21 Dec 2018 22:03:48 +0000 (22:03 +0000)]
Clear TCG TSS2 auth passwords on free

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoMore free_pass() for TPMv1 passwords
David Woodhouse [Fri, 21 Dec 2018 16:29:18 +0000 (16:29 +0000)]
More free_pass() for TPMv1 passwords

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoUse free_pass() in openconnect_vpninfo_free()
David Woodhouse [Fri, 21 Dec 2018 16:25:02 +0000 (16:25 +0000)]
Use free_pass() in openconnect_vpninfo_free()

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoUse free_pass() for TCG TSS2
David Woodhouse [Fri, 21 Dec 2018 16:21:51 +0000 (16:21 +0000)]
Use free_pass() for TCG TSS2

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoUse free_pass() for freeing certificate passwords
David Woodhouse [Fri, 21 Dec 2018 16:19:35 +0000 (16:19 +0000)]
Use free_pass() for freeing certificate passwords

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoUse free_pass() for yubikey PIN
David Woodhouse [Fri, 21 Dec 2018 16:14:11 +0000 (16:14 +0000)]
Use free_pass() for yubikey PIN

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoClear form field entries in free_auth_form()
David Woodhouse [Fri, 21 Dec 2018 15:47:38 +0000 (15:47 +0000)]
Clear form field entries in free_auth_form()

This covers more of the CVE-2018-20319 "passwords found in memory" issue.

Reported-by: Tom Wilson <twilson@nettitude.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFix re-prompting for empty parent key password with TCG TSS2
David Woodhouse [Fri, 21 Dec 2018 15:45:42 +0000 (15:45 +0000)]
Fix re-prompting for empty parent key password with TCG TSS2

It's odd, but persistent keys can be generated with empty password yet
still without the NODA flag.

It's OK to prompt the user for the (empty) password in that case, but
not to do it more than once, after already authenticating successfully
the first time.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoAllow --form-entry on win32 builds too
David Woodhouse [Fri, 21 Dec 2018 12:24:22 +0000 (12:24 +0000)]
Allow --form-entry on win32 builds too

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoClear full buffer in buf_truncate() and buf_free()
David Woodhouse [Fri, 21 Dec 2018 12:12:46 +0000 (12:12 +0000)]
Clear full buffer in buf_truncate() and buf_free()

This reduces the chances of passwords and other secrets lying around in
memory when we're done. Arguably if anyone can just read memory of the
VPN client while it's running, the game is already lost... but still,
this is easy enough to do, and it's been reported as CVE-2018-20319.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoMerge branch 'tmp-fix-sigterm' of gitlab.com:nmav/openconnect
David Woodhouse [Wed, 12 Dec 2018 14:52:27 +0000 (14:52 +0000)]
Merge branch 'tmp-fix-sigterm' of gitlab.com:nmav/openconnect

6 years agoGlobalProtect: apparently, the parameter `clientos=Linux` value is not just allowed...
Daniel Lenski [Sun, 25 Nov 2018 15:53:37 +0000 (10:53 -0500)]
GlobalProtect: apparently, the parameter `clientos=Linux` value is not just allowed, but necessary, for some VPNs.

* Previously, I had received at least two reports of servers where
  `clientos=Windows` was required for the VPN to work correctly.

* Per https://github.com/dlenski/openconnect/issues/126, there is at least
  one report where *not* setting `clientos=Windows` was required for the VPN
  to work.

* The truly maddening part is not only the pointless and inconsistent
  behavior of the GlobalProtect servers, but also the fact that the servers
  give such misleading and irrelevant error messages ("Incorrect username or
  password" or "Unable to assign private IP address", etc.) rather than
  something that makes sense like "Unknown clientos value."

This patch makes `clientos=Linux` the default behavior when
`vpninfo->platname` is `linux-64` or `android`, while still allowing it to
be overridden with `--os=win` etc.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
6 years agoSIGTERM cleans up the session similarly to SIGINT
Nikos Mavrogiannopoulos [Sat, 27 Oct 2018 10:23:04 +0000 (12:23 +0200)]
SIGTERM cleans up the session similarly to SIGINT

Resolves #9

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
6 years agoAllow form responses to be provided on command line
David Woodhouse [Sun, 4 Nov 2018 16:08:42 +0000 (17:08 +0100)]
Allow form responses to be provided on command line

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoMove prepare_stoken() call to generic openconnect_obtain_cookie()
David Woodhouse [Mon, 5 Nov 2018 09:14:08 +0000 (10:14 +0100)]
Move prepare_stoken() call to generic openconnect_obtain_cookie()

We were missing it for Juniper. Rather than adding a third copy of the
same code, put it in the generic caller.

Reported-by: Andy Wang <dopey@moonteeth.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoCheck TPM2 key OIDs
David Woodhouse [Thu, 25 Oct 2018 17:41:39 +0000 (18:41 +0100)]
Check TPM2 key OIDs

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agotests: added data transfer test under DTLS
Nikos Mavrogiannopoulos [Sat, 6 Oct 2018 18:13:52 +0000 (20:13 +0200)]
tests: added data transfer test under DTLS

This tests in addition to traffic, whether the PSK-NEGOTIATE
is functional. It requires root access.

[dwmw2: Check for netns support directly, strip vpnc-script to
        prevent users from being tempted to use it instead of
        the real one.]

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agochg: add --version-string
Ralph Schmieder [Sat, 8 Sep 2018 12:57:29 +0000 (14:57 +0200)]
chg: add --version-string

I've included a patch that provides better compatibility with CSD on
ASA head ends. E.g. it allows to specify the version string that is
presented to the ASA. Previous to this patch, OC presents its own
version e.g. 0.7.8 but that could cause rejection on the head end if
it looks for a matching AC version string.

[dwmw2: All the library ABI support for the new function]

Signed-off-by: Ralph Schmieder <ralph.schmieder@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoResync translations with sources
David Woodhouse [Sat, 13 Oct 2018 13:45:21 +0000 (06:45 -0700)]
Resync translations with sources

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoUpdate translations from GNOME
David Woodhouse [Sat, 13 Oct 2018 13:45:02 +0000 (06:45 -0700)]
Update translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoNo longer send the TLS extension for the PSK protocol
Nikos Mavrogiannopoulos [Sat, 6 Oct 2018 17:52:49 +0000 (19:52 +0200)]
No longer send the TLS extension for the PSK protocol

ocserv can read the identifier from the session ID field
and as such there is no need to attach the extension any
more.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoUse the client hello session identifier to transmit the client identifier
Nikos Mavrogiannopoulos [Sat, 6 Oct 2018 05:44:12 +0000 (07:44 +0200)]
Use the client hello session identifier to transmit the client identifier

Currently the openconnect (protocol) client uses a custom extension to provide
information to the server on which session it was previously associated with.
However, a private extension cannot be defined in IETF without going through
a tedious standardization process involving the TLS working group. To avoid
that process we should provide the client identifier on the DTLS session using
alternative methods.

In TLS 1.3 (and DTLS) the session ID field was made obsolete, and as such we can
use it to place the client identifier instead of an extension field. We can do it
safely because (1) there is no session resumption -in the dtls1.2 or earlier sense-
and (2) ocserv is already checking this field for that value due to the old protocol
format.

Resolves #5

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoUpdate TPM docs tpm2
David Woodhouse [Sat, 13 Oct 2018 04:06:47 +0000 (21:06 -0700)]
Update TPM docs

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFall back to tpm2tss engine
David Woodhouse [Sat, 13 Oct 2018 03:34:59 +0000 (20:34 -0700)]
Fall back to tpm2tss engine

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoClean up ibmtss error reporting to use vpn_progress()
David Woodhouse [Fri, 12 Oct 2018 21:18:18 +0000 (14:18 -0700)]
Clean up ibmtss error reporting to use vpn_progress()

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoConsolidate tpm2_get_session_handle()
David Woodhouse [Fri, 12 Oct 2018 21:00:53 +0000 (14:00 -0700)]
Consolidate tpm2_get_session_handle()

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoClean up persistent/generated handle checks a little
David Woodhouse [Fri, 12 Oct 2018 20:53:29 +0000 (13:53 -0700)]
Clean up persistent/generated handle checks a little

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoReinstate support for TPM2 'TSS2 KEY BLOB' support with GnuTLS
David Woodhouse [Fri, 12 Oct 2018 19:25:35 +0000 (12:25 -0700)]
Reinstate support for TPM2 'TSS2 KEY BLOB' support with GnuTLS

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoRemove legacy tpm2tss PEM support
David Woodhouse [Fri, 12 Oct 2018 19:25:06 +0000 (12:25 -0700)]
Remove legacy tpm2tss PEM support

That format got removed before it was ever released...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoRemove static ui_vpninfo hack for ENGINE callbacks
David Woodhouse [Fri, 12 Oct 2018 18:49:45 +0000 (11:49 -0700)]
Remove static ui_vpninfo hack for ENGINE callbacks

This doesn't seem to be needed; all the TPM engines (even v1) handle
the callback properly now.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agotpm2-esys: Check parent NODA flag and demand password if needed
David Woodhouse [Fri, 12 Oct 2018 17:34:33 +0000 (10:34 -0700)]
tpm2-esys: Check parent NODA flag and demand password if needed

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoSwitch to standard TSS2 PEM format
David Woodhouse [Fri, 12 Oct 2018 05:51:08 +0000 (22:51 -0700)]
Switch to standard TSS2 PEM format

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFactor out PKCS#1 padding
David Woodhouse [Thu, 11 Oct 2018 20:34:58 +0000 (13:34 -0700)]
Factor out PKCS#1 padding

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoAdd tss2-devel to CI
David Woodhouse [Thu, 11 Oct 2018 01:09:40 +0000 (18:09 -0700)]
Add tss2-devel to CI

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFirst cut at IBM TSS support, mostly copied from James's tpm2 engine.
David Woodhouse [Wed, 10 Oct 2018 22:19:33 +0000 (15:19 -0700)]
First cut at IBM TSS support, mostly copied from James's tpm2 engine.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoUpdate changelog. TPM2 is no longer OpenSSL-only.
David Woodhouse [Wed, 10 Oct 2018 19:22:47 +0000 (12:22 -0700)]
Update changelog. TPM2 is no longer OpenSSL-only.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoAdd support for persistent parent keys and other hierarchies
David Woodhouse [Wed, 10 Oct 2018 19:10:23 +0000 (12:10 -0700)]
Add support for persistent parent keys and other hierarchies

We should now be able to cope with anything James's tpm2 engine creates,
except for the policies.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoAllow parsing of permanent handles for TPM2 parents
David Woodhouse [Wed, 10 Oct 2018 19:09:13 +0000 (12:09 -0700)]
Allow parsing of permanent handles for TPM2 parents

These need to be returned in 5 bytes because they have the top
bit set and would otherwise be interpreted as negative.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoSkeleton IBM TSS support
David Woodhouse [Tue, 9 Oct 2018 10:06:16 +0000 (11:06 +0100)]
Skeleton IBM TSS support

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoMove non-TSS-specific code to gnutls_tpm2.c
David Woodhouse [Tue, 9 Oct 2018 09:01:07 +0000 (10:01 +0100)]
Move non-TSS-specific code to gnutls_tpm2.c

In preparation for potentially implementing a version using ibmtss.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFix signedness handling for EC signatures
David Woodhouse [Tue, 9 Oct 2018 07:44:20 +0000 (08:44 +0100)]
Fix signedness handling for EC signatures

If R or S have the top bit set, we need to prepend a zero byte to prevent
them from being interpreted as negative.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFactor out sign_hash functions for tpm2
David Woodhouse [Mon, 8 Oct 2018 19:14:17 +0000 (20:14 +0100)]
Factor out sign_hash functions for tpm2

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoAdd openconnect_set_key_password()
David Woodhouse [Mon, 8 Oct 2018 20:13:30 +0000 (21:13 +0100)]
Add openconnect_set_key_password()

For auto-provisioning via NetworkManager it's actually quite useful to be
able to set vpninfo->cert_password and have that special case handled,
instead of having to inject the password into the user's keyring somehow.

It's either that or revise the FSID hack...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoAdd openconnect_has_tss2_blob_support()
David Woodhouse [Mon, 8 Oct 2018 20:06:33 +0000 (21:06 +0100)]
Add openconnect_has_tss2_blob_support()

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoUpdate licence and TPM docs
David Woodhouse [Mon, 8 Oct 2018 20:02:12 +0000 (21:02 +0100)]
Update licence and TPM docs

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoTell GnuTLS the TPM2 can't do SHA512
David Woodhouse [Thu, 4 Oct 2018 23:57:29 +0000 (00:57 +0100)]
Tell GnuTLS the TPM2 can't do SHA512

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFix TPM2 emptyauth handling
David Woodhouse [Thu, 4 Oct 2018 23:57:08 +0000 (00:57 +0100)]
Fix TPM2 emptyauth handling

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoAdd TPM2 ECC support
David Woodhouse [Thu, 4 Oct 2018 13:00:25 +0000 (14:00 +0100)]
Add TPM2 ECC support

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoSupport TPM2 auth
David Woodhouse [Wed, 3 Oct 2018 22:40:00 +0000 (23:40 +0100)]
Support TPM2 auth

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoFirst pass at proper TPM2 support for GnuTLS using tss2-esys
David Woodhouse [Wed, 3 Oct 2018 20:19:44 +0000 (21:19 +0100)]
First pass at proper TPM2 support for GnuTLS using tss2-esys

Various caveats, including the complete lack of authentication, lack
of EC and policy support, hard-coded use of PKCS#1 padding, etc.

But hey, it works for my test case.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoParse TPM2 ASN.1 blob
David Woodhouse [Wed, 3 Oct 2018 14:46:26 +0000 (15:46 +0100)]
Parse TPM2 ASN.1 blob

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoPost CSD results even when no other auth is needed.
David Woodhouse [Mon, 8 Oct 2018 19:14:42 +0000 (20:14 +0100)]
Post CSD results even when no other auth is needed.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoMerge branch 'fix_authgroup_dropdown_handling' of gitlab.com:dlenski/openconnect
David Woodhouse [Mon, 8 Oct 2018 19:16:49 +0000 (20:16 +0100)]
Merge branch 'fix_authgroup_dropdown_handling' of gitlab.com:dlenski/openconnect

6 years agoFix GlobalProtect authgroup handling
Daniel Lenski [Mon, 8 Oct 2018 18:03:45 +0000 (11:03 -0700)]
Fix GlobalProtect authgroup handling

When connecting to a GlobalProtect server via the portal interface, then
`vpninfo->authgroup` needs to be set to the URL of one of the allowed
gateways.

The problem here is that if the user actually wanted to select the _first_
gateway in the dropdown list, it was already pre-selected, and thus clicking
"continue"/"login" on the form wouldn't trigger `OC_FORM_RESULT_NEWGROUP`.

This would prevent `vpninfo->authgroup` from getting set correctly, and the
gateway redirect would be skipped entirely.  Thus it was effectively
impossible to select the first option in the gateway dropdown.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
6 years agoFix issue causing front-ends/GUIs to be insensitive to changes in the Juniper realm...
Daniel Lenski [Mon, 8 Oct 2018 17:39:54 +0000 (10:39 -0700)]
Fix issue causing front-ends/GUIs to be insensitive to changes in the Juniper realm dropdown

This has been a persistent, puzzling issue
(http://lists.infradead.org/pipermail/openconnect-devel/2018-July/004926.html,
http://lists.infradead.org/pipermail/openconnect-devel/2017-November/004558.html,
etc.).  When connecting to a Juniper VPN from a front-end (e.g.
NM-OpenConnect, OpenConnect-GUI for Windows, OpenConnect for Android),
changing the selected realm/`authgroup` in the drop-down box causes the form
to immediately reload *without* saving the change.

This turned out to be a rather subtle issue…

The meaning and usage of `vpninfo->authgroup` differs across the different
protocols, which made this hard to isolate.

* With AnyConnect, changing the authgroup value in the form is supposed to
  trigger an immediate reload of the form, since the form contents can
  differ from one authgroup to another.  Hence a `process_auth_form`
  callback should immediately return `OC_FORM_RESULT_NEWGROUP` when the form
  value changes.
* With Juniper, the authgroup dropdown don't *actually* need to trigger a reloading
  of the form, since the form won't change if the authgroup field changes.
  (At least not on any Juniper VPN I have access to.) However, it doesn't
  hurt anything either, and setting the dropdown as `form->authgroup_opt`
  allows CLI users to specify the desired setting with `--authgroup`, which
  is very convenient.
* With GlobalProtect, the authgroup has been repurposed to represent the desired
  *gateway* to connect to, in the cases where the user is connecting via the
  *portal* interface.  The authgroup selection always appears in a form by
  itself, currently.  This similarly allows CLI users to pick the desired
  gateway with `--authgroup`.

Long story short, the problem here was that `form->authgroup_selection`
needed to be set to a specific index (within `form->authgroup_opt->choices[]`)
 of the currently selected value, in order
for the GUI to show the right value as selected.  If this wasn't set, then
every time the selection was changed (causing the form handler to return
`OC_FORM_RESULT_NEWGROUP`), the selected index would revert to `0` on the
next iteration of the form.

For AnyConnect, the `form->authgroup_selection` was already set correctly;
for Juniper and GlobalProtect, it wasn't.  It seems to me that the most
robust fix here is to ensure that `process_auth_form` itself always sets
`form->authgroup_selection` to the index of the value matching
`vpninfo->authgroup` _before_ handing the form off `process_auth_form_cb`.

Tested that this change makes Juniper realm dropdowns work correctly in the
NM-OpenConnect and Android front-ends.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
6 years agoMerge branch 'multiple_search_domains_GPST' into 'master'
David Woodhouse [Sat, 6 Oct 2018 08:26:32 +0000 (08:26 +0000)]
Merge branch 'multiple_search_domains_GPST' into 'master'

Don't segfault when search domain list is empty (and thus `domains->pos == 0`)

See merge request openconnect/openconnect!11

6 years agoDon't segfault when search domain list is empty (and thus `domains->pos == 0`)
Daniel Lenski [Sat, 6 Oct 2018 04:36:38 +0000 (21:36 -0700)]
Don't segfault when search domain list is empty (and thus `domains->pos == 0`)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
6 years agoUpdate TPM documentation to mention TPMv2
David Woodhouse [Wed, 3 Oct 2018 08:09:36 +0000 (09:09 +0100)]
Update TPM documentation to mention TPMv2

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoAdd shell of TPM2 support
David Woodhouse [Thu, 27 Sep 2018 12:59:19 +0000 (14:59 +0200)]
Add shell of TPM2 support

This doesn't do anything useful at all yet. It would be nice if the two
available OpenSSL engines were actually compatible.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoShift TSS context out of generic vpninfo
David Woodhouse [Mon, 1 Oct 2018 11:51:20 +0000 (12:51 +0100)]
Shift TSS context out of generic vpninfo

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoShift PC/SC context out of generic vpninfo
David Woodhouse [Mon, 1 Oct 2018 11:01:00 +0000 (12:01 +0100)]
Shift PC/SC context out of generic vpninfo

TPM2 support wants its own BOOL definition which conflicts with the
"standard" Windows one from libpcsc. Let's just isolate things so that
we only need to include PC/SC header files from within yubikey.c.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoMake yubikey less picky about what it'll generate tokens for
David Woodhouse [Wed, 3 Oct 2018 07:06:52 +0000 (08:06 +0100)]
Make yubikey less picky about what it'll generate tokens for

The protocol should validate which form fields are OK; no need to apply
CSTP-specific filters (which are now out of date) in the yubikey code.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoMerge branch 'master' of gitlab.com:j.l-w/openconnect into HEAD
David Woodhouse [Wed, 3 Oct 2018 07:02:54 +0000 (08:02 +0100)]
Merge branch 'master' of gitlab.com:j.l-w/openconnect into HEAD

6 years agoAdd support for files from the *other* OpenSSL TPM2 engine. FFS.
David Woodhouse [Wed, 3 Oct 2018 06:59:12 +0000 (07:59 +0100)]
Add support for files from the *other* OpenSSL TPM2 engine. FFS.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoRecognise auth forms named "challenge" as token requests
James Laird-Wah [Wed, 18 Jul 2018 06:02:36 +0000 (16:02 +1000)]
Recognise auth forms named "challenge" as token requests

This was found in the wild on an AnyConnect instance which is hooked up
to a Microsoft 2FA platform.

Signed-off-by: James Laird-Wah <james-oc@laird-wah.net>
6 years agoAdd Changelog for OpenSSL TPM2 support
David Woodhouse [Mon, 1 Oct 2018 10:28:23 +0000 (11:28 +0100)]
Add Changelog for OpenSSL TPM2 support

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
6 years agoGlobalProtect: query and parse prelogin.esp and use it to build auth forms, including...
Daniel Lenski [Sat, 8 Sep 2018 05:22:40 +0000 (22:22 -0700)]
GlobalProtect: query and parse prelogin.esp and use it to build auth forms, including preliminary SAML support

Until recently, I've believed the prelogin.esp to be useless, because the
initial GlobalProtect login form always contains the same two fields:
username and password.

However, the prelogin response is also important for signalling when SAML
login is required.  When the VPN uses SAML login, the official GP clients
redirect the user to a web-based authentication flow (e.g.  Okta,
https://github.com/dlenski/openconnect/issues/116).

That auth flow eventually sends the official client back to the GP VPN,
armed with a special cookie field, `portal-userauthcookie` or
`prelogin-cookie`, that needs to be submitted in place of the password
(already supported by openconnect as of 8b2bc5f22dda).

This preliminary SAML support simply includes the SAML method and URL in the
form banner, and fails with an error message if the cookie field name was
not specified (since it cannot be autodetected).

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