]> www.infradead.org Git - users/dwmw2/openconnect.git/log
users/dwmw2/openconnect.git
4 years agofactor out check_address_sanity() from gpst.c and cstp.c, and use it in oncp.c and...
Daniel Lenski [Wed, 22 May 2019 20:14:03 +0000 (13:14 -0700)]
factor out check_address_sanity() from gpst.c and cstp.c, and use it in oncp.c and pulse.c as well

Suggested by David Woodhouse: https://gitlab.com/openconnect/openconnect/merge_requests/35#note_169620281

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agogpst.c should also return -EPERM when server changes IP address, not -EINVAL
Daniel Lenski [Wed, 22 May 2019 18:55:59 +0000 (11:55 -0700)]
gpst.c should also return -EPERM when server changes IP address, not -EINVAL

(see previous commit by David Woodhouse, 24df3311ab42f062dbf1aeb7f3432dd45426e9cf, which did this for cstp.c)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoProtocols should try explicitly request the same IP addresses on reconnect, since...
Daniel Lenski [Thu, 21 Dec 2017 06:56:58 +0000 (22:56 -0800)]
Protocols should try explicitly request the same IP addresses on reconnect, since they will abort if new addresses are sent by the server.

* GlobalProtect:
  - Supported and used by official clients (POST /ssl-vpn/getconfig.esp with preferred-ip form field).
  - GlobalProtect servers often give different IP addresses on reconnect if this mechanism is *not* used,
    so this mechanism is necessary.
  - Same mechanism appears to exist for IPv6 (preferred-ipv6) and was added to OpenConnect in
    d6db0ec03394234d41fbec7ffc794ceeb486a8f0, even though IPv6 support is not yet complete.
* AnyConnect:
  - Not (yet) supported by ocserv
  - It appears that *some* AnyConnect server will try to provide the IP address provided in the X-CSTP-Address
    *request* header along with the CONNECT request, but other servers appear not to
  - This patch reproduces the behavior of GPST: attempt to request same IPv4 and IPv6 addresses on reconnect,
    via CONNECT headers.
* Juniper:
  - There does not appear to be any way to provide this using the Juniper NC protocol.
  - No known reports of Juniper servers giving out different IP address on reconnect.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoFix Signed-off-by CI check
David Woodhouse [Mon, 18 May 2020 18:18:30 +0000 (19:18 +0100)]
Fix Signed-off-by CI check

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
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 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 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>
5 years agoNo autocompletion test for mingw build
David Woodhouse [Wed, 15 Apr 2020 14:03:52 +0000 (15:03 +0100)]
No autocompletion test for mingw build

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agobetter heuristic for determining where to fill in a token in GP forms
Daniel Lenski [Thu, 9 Apr 2020 00:57:26 +0000 (17:57 -0700)]
better heuristic for determining where to fill in a token in GP forms

GlobalProtect's prelogin doesn't give us much information to determine where
a token code might be filled in.

Current behavior:

1. Use the password file in the first form as a token field.
2. Ignores the fact that a second "challenge" form might be coming.

New heuristic:

1. If the label for the password field in the first form has a non-default
   value (not empty or “Password”), then treat that as the token field.
2. Otherwise, assume a second form ("challenge") is coming, and treat the
   password field in the first form as a normal password, then treat the
   password field in the second form as the token field.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoGP auth: give challenge/2FA forms a constant auth_id/name of "_challenge"
Daniel Lenski [Thu, 9 Apr 2020 00:35:48 +0000 (17:35 -0700)]
GP auth: give challenge/2FA forms a constant auth_id/name of "_challenge"

Until now, we've been using the `inputStr` value (hex token that has to
accompany challenge form submission) as the `auth_id` for challenge forms,
but it appears these values aren't fixed from run-to-run, which makes it
impossible to use `--form-entry` to fill them out.

This patch makes all challenge forms have `auth_id=_challenge`, so they can
be filled with `--form-entry=_challenge:passwd=VALUE`. The `inputStr` value
will now be shoehorned into `form->action`.

Unless we find a GP VPN that uses multiple independent challenges (3FA?),
this should work better.

ping #112

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoperiodic TNCC
Daniel Lenski [Wed, 8 Apr 2020 06:10:14 +0000 (23:10 -0700)]
periodic TNCC

- Factor out oncp_send_tncc_command function
- Reuse csd_token and csd_starturl for TNCC state (just like GP already does)
- Teach `tncc-emulate.py` to send the TNCC interval *back* to OpenConnect
- Apply `--force-trojan` (vpninfo->trojan_interval) to TNCC as well

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoMore helpful error when Pulse server asks for TNCC
David Woodhouse [Wed, 8 Apr 2020 14:26:27 +0000 (15:26 +0100)]
More helpful error when Pulse server asks for TNCC

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix autocompletion a bit more, add tests
David Woodhouse [Wed, 8 Apr 2020 14:15:00 +0000 (15:15 +0100)]
Fix autocompletion a bit more, add tests

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoremove vestigial bit
Daniel Lenski [Wed, 8 Apr 2020 05:17:12 +0000 (22:17 -0700)]
remove vestigial bit

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agotested that Ubuntu 18.04's python3-asn1crypto version works (v0.24.0)
Daniel Lenski [Wed, 8 Apr 2020 02:54:32 +0000 (19:54 -0700)]
tested that Ubuntu 18.04's python3-asn1crypto version works (v0.24.0)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoAdd a comment explaining required Python3 modules and potentially customizable enviro...
Daniel Lenski [Sun, 5 Apr 2020 00:37:22 +0000 (17:37 -0700)]
Add a comment explaining required Python3 modules and potentially customizable environment variables

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agotncc-emulate.py: update to modernized Python 3.x version
Daniel Lenski [Sun, 5 Apr 2020 00:17:06 +0000 (17:17 -0700)]
tncc-emulate.py: update to modernized Python 3.x version

Copied from:
    https://github.com/dlenski/juniper-vpn-py/blob/5c5c6c021a80b926990e2598d27f18d3aba60513/tncc.py

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoAdd copyright and license notice, and update TNCC docs
Daniel Lenski [Sun, 5 Apr 2020 00:20:23 +0000 (17:20 -0700)]
Add copyright and license notice, and update TNCC docs

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoInclude tncc-emulate.py
Daniel Lenski [Sun, 5 Apr 2020 00:14:54 +0000 (17:14 -0700)]
Include tncc-emulate.py

Copied from LGPL v2.1-licensed source at:
    https://github.com/russdill/juniper-vpn-py/blob/6a832c3a9eea943ffa2cb2d18720556a6619e590/tncc.py

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agopass TNCC_SHA256 and TNCC_HOSTNAME environment variables to wrapper script (just...
Daniel Lenski [Thu, 2 Apr 2020 05:05:54 +0000 (22:05 -0700)]
pass TNCC_SHA256 and TNCC_HOSTNAME environment variables to wrapper script (just like for CSD)

TNCC_SHA256 will allow a future version to validate the server certificate
fingerprint (like csd-post.sh already does).

TNCC_HOSTNAME passes along the *local* hostname override from OpenConnect
(set with `--local-hostname` or `openconnect_set_localname`) to the TNCC
wrapper script.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agorecent tncc.jar looks for files in ~/.pulse_secure rather than ~/.juniper_networks
Daniel Lenski [Thu, 2 Apr 2020 04:46:42 +0000 (21:46 -0700)]
recent tncc.jar looks for files in ~/.pulse_secure rather than ~/.juniper_networks

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoAdd bash completion
David Woodhouse [Tue, 7 Apr 2020 13:12:27 +0000 (14:12 +0100)]
Add bash completion

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoTag version 8.08 v8.08
David Woodhouse [Mon, 6 Apr 2020 15:45:01 +0000 (16:45 +0100)]
Tag version 8.08

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoImport pending Fedora 31 updates to fix CI
David Woodhouse [Mon, 6 Apr 2020 13:26:32 +0000 (14:26 +0100)]
Import pending Fedora 31 updates to fix CI

The http-parser package broke its users again, and we need the fixed
GnuTLS.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoChangelog for OIDC NULL fix
David Woodhouse [Mon, 6 Apr 2020 13:17:34 +0000 (14:17 +0100)]
Changelog for OIDC NULL fix

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd tests for --servercert matching
David Woodhouse [Mon, 6 Apr 2020 13:15:38 +0000 (14:15 +0100)]
Add tests for --servercert matching

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