]> www.infradead.org Git - users/dwmw2/openconnect.git/log
users/dwmw2/openconnect.git
5 years agoTry blithely ignoring lack of IcedTea plugin.jar and/or tncc_preload.so
Daniel Lenski [Thu, 2 Apr 2020 04:46:18 +0000 (21:46 -0700)]
Try blithely ignoring lack of IcedTea plugin.jar and/or tncc_preload.so

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agowe can be a *little* more user-friendly
Daniel Lenski [Thu, 2 Apr 2020 04:26:29 +0000 (21:26 -0700)]
we can be a *little* more user-friendly

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoconvert tncc-wrapper.py to Python 3.6
Daniel Lenski [Thu, 2 Apr 2020 03:58:24 +0000 (20:58 -0700)]
convert tncc-wrapper.py to Python 3.6

- rip out junk: unused imports, unnecessary function and variables
- replace urllib.urlretrieve with urllib.request.urlretrieve (deprecated as of Python 3.6),
  using unverified SSL context for Python 2.ancient emulation
- replace `print` statement with `print()` function

The good news:

- It “works” fine with Python3
- It could easily be converted to a shell script that invokes curl and Java,
  much like `csd-wrapper.sh`

The bad news:

- It requires an Iced Tea plugin for Java web applets that isn't available with modern applets
- It requires a `tncc-preload.so` binary blob which has no obvious source on
  a modern 64-bit Linux system.

Conclusion: Anyone who has to run this should use @russdill's TNCC emulator/spoofer
(https://github.com/russdill/juniper-vpn-py/blob/master/tncc.py), not this
horrid binary blob.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoDTLS: check at runtime whether GnuTLS is giving us a zero'ed ClientHello
Luca Boccassi [Wed, 1 Apr 2020 12:56:32 +0000 (13:56 +0100)]
DTLS: check at runtime whether GnuTLS is giving us a zero'ed ClientHello

Use a handshake hook, and abort the handshake if it fails.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoMerge branch 'ignore-empty-select-tag' of gitlab.com:klyr/openconnect
David Woodhouse [Wed, 1 Apr 2020 15:36:56 +0000 (16:36 +0100)]
Merge branch 'ignore-empty-select-tag' of gitlab.com:klyr/openconnect

5 years agoReduce duplication in start_dtls_handshake()
David Woodhouse [Wed, 1 Apr 2020 15:27:05 +0000 (16:27 +0100)]
Reduce duplication in start_dtls_handshake()

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoMerge branch 'fix-gnutls-check' of gitlab.com:mrueg/openconnect
David Woodhouse [Wed, 1 Apr 2020 14:52:55 +0000 (15:52 +0100)]
Merge branch 'fix-gnutls-check' of gitlab.com:mrueg/openconnect

5 years agoDo not process <select/> nodes with no children
Julien Barbot [Wed, 1 Apr 2020 14:31:53 +0000 (16:31 +0200)]
Do not process <select/> nodes with no children

Signed-off-by: Julien Barbot <julien@barbot.org>
5 years agoconfigure.ac: Fix gnutls version check
Manuel Rüger [Wed, 1 Apr 2020 12:57:06 +0000 (14:57 +0200)]
configure.ac: Fix gnutls version check

This version number is hexadecimal

See gnutls/gnutls.h

 #define GNUTLS_VERSION "3.6.13"
 #define GNUTLS_VERSION_MAJOR 3
 #define GNUTLS_VERSION_MINOR 6
 #define GNUTLS_VERSION_PATCH 13
 #define GNUTLS_VERSION_NUMBER 0x03060d

Signed-off-by: Manuel Rüger <manuel@rueg.eu>
5 years agoFix up Dan's aversion to writing changelog entries...
David Woodhouse [Wed, 1 Apr 2020 11:47:00 +0000 (12:47 +0100)]
Fix up Dan's aversion to writing changelog entries...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoDon't abort Pulse connection for bad cert MD5
David Woodhouse [Wed, 1 Apr 2020 11:43:50 +0000 (12:43 +0100)]
Don't abort Pulse connection for bad cert MD5

This happens in the wild and the official clients seem not to care. It's
a pointless check anyway. It's too late, and it's only MD5.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agofix off-by-one error in GnuTLS version check (v3.6.12 is known-bad), and also warn...
Daniel Lenski [Tue, 31 Mar 2020 00:32:32 +0000 (17:32 -0700)]
fix off-by-one error in GnuTLS version check (v3.6.12 is known-bad), and also warn at compile time

Not-signed-off-by: Daniel Lenski <dlenski@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoTag version 8.06 v8.06
David Woodhouse [Mon, 30 Mar 2020 23:32:07 +0000 (00:32 +0100)]
Tag version 8.06

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoResync translations with sources
David Woodhouse [Mon, 30 Mar 2020 23:27:37 +0000 (00:27 +0100)]
Resync translations with sources

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoDisable DTLS for GnuTLS 3.6.3 - 3.6.12
David Woodhouse [Mon, 30 Mar 2020 23:20:33 +0000 (00:20 +0100)]
Disable DTLS for GnuTLS 3.6.3 - 3.6.12

Upgrade to 3.6.13.
https://gitlab.com/gnutls/gnutls/-/issues/960

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd changelog for RFC6750 bearer token support
David Woodhouse [Mon, 30 Mar 2020 23:18:53 +0000 (00:18 +0100)]
Add changelog for RFC6750 bearer token support

Not utterly convinced I like treating it like a soft token; I wonder if
it should have a dedicated callback to the UI, or be handled through
the webview support that we're working on. But there's a release imminent
and this gets people something functional.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoMerge branch 'issue99' of gitlab.com:Alan_Jowett/openconnect
David Woodhouse [Mon, 30 Mar 2020 23:16:34 +0000 (00:16 +0100)]
Merge branch 'issue99' of gitlab.com:Alan_Jowett/openconnect

5 years agoFix merge request references in changelog
David Woodhouse [Mon, 30 Mar 2020 22:41:11 +0000 (23:41 +0100)]
Fix merge request references in changelog

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoMerge branch 'periodic_Trojan_touch_up'
Daniel Lenski [Mon, 30 Mar 2020 16:04:00 +0000 (09:04 -0700)]
Merge branch 'periodic_Trojan_touch_up'

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

5 years agoadd OC_PROTO_PERIODIC_TROJAN feature flag
Daniel Lenski [Mon, 30 Mar 2020 15:38:12 +0000 (08:38 -0700)]
add OC_PROTO_PERIODIC_TROJAN feature flag

Follow-up to !56.  The API is now there for cross-protocol operation, and
oNCP is known to use this too, but only GP protocol currently has support in
OpenConnect.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoadd Java wrapper function for setTrojanInterval()
Daniel Lenski [Mon, 30 Mar 2020 15:38:12 +0000 (08:38 -0700)]
add Java wrapper function for setTrojanInterval()

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoUpdate changelog.xml
Daniel Lenski [Mon, 30 Mar 2020 16:14:56 +0000 (09:14 -0700)]
Update changelog.xml

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoRun Cisco CSD script as child, not daemonized grandchild
Daniel Lenski [Tue, 17 Mar 2020 17:15:29 +0000 (10:15 -0700)]
Run Cisco CSD script as child, not daemonized grandchild

This allows us to capture a failure in the CSD script/binary much more
quickly, rather than spinning endlessly (see #108 for one of many examples
where this confuses users).

Tested with both “real” CSD trojan binaries and wrapper script, as well as
`trojans/csd-post.sh`.

GP already does this for the HIP script, and it works fine, including with
NM and Android clients based on libopenconnect.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoString fixes
David Woodhouse [Mon, 30 Mar 2020 11:02:10 +0000 (12:02 +0100)]
String fixes

A couple of cosmetic fixes suggested by "scootergrisen" in
https://gitlab.com/openconnect/openconnect/-/merge_requests/72
https://gitlab.com/openconnect/openconnect/-/merge_requests/73/

Also fix up translations so that they don't get lost and need to
be re-translated.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUpdate translations from GNOME
David Woodhouse [Mon, 30 Mar 2020 09:03:19 +0000 (10:03 +0100)]
Update translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoDon't split translated strings with #ifdefs
David Woodhouse [Mon, 30 Mar 2020 08:59:21 +0000 (09:59 +0100)]
Don't split translated strings with #ifdefs

It makes the translators hunt you down and hurt you. And while they're
hurting you, they shout at you in multiple languages that you don't
understand.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoMerge branch 'upstream/master'
Daniel Lenski [Mon, 30 Mar 2020 01:56:47 +0000 (18:56 -0700)]
Merge branch 'upstream/master'

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoremove README.TESTS from Makefile.am
Daniel Lenski [Mon, 30 Mar 2020 01:55:47 +0000 (18:55 -0700)]
remove README.TESTS from Makefile.am

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoMerge branch 'origin/explain_server_0x08'
Daniel Lenski [Mon, 30 Mar 2020 01:49:10 +0000 (18:49 -0700)]
Merge branch 'origin/explain_server_0x08'

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

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoadd some clarifications about Pulse vs. NC to the documentation
Daniel Lenski [Mon, 26 Aug 2019 22:36:15 +0000 (15:36 -0700)]
add some clarifications about Pulse vs. NC to the documentation

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agooNCP: explain likely meaning of long-puzzling 'error 0x08'
Daniel Lenski [Sun, 2 Jun 2019 23:38:58 +0000 (16:38 -0700)]
oNCP: explain likely meaning of long-puzzling 'error 0x08'

It appears that the 'error 0x08' returned by some Juniper servers in
response to attempted initiation of the oNCP tunnel means that the server
doesn't support, or has disabled, the older oNCP protocol and only supports
the newer Junos Pulse protocol

This conclusion was based on the investigations of
https://gitlab.com/openconnect/openconnect/issues/42.
See also http://lists.infradead.org/pipermail/openconnect-devel/2018-August/005041.html
for a list of past reports of this error.

OpenConnect previously did not support the Pulse protocol at all (see
http://lists.infradead.org/pipermail/openconnect-devel/2019-April/005334.html),
but now has experimental support as of v8.04 (see
https://lists.infradead.org/pipermail/openconnect-devel/2019-August/005396.html).

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agomissing defines (IPPROTO_ICMP and ICMP_ECHOREPLY) for Windows
Daniel Lenski [Mon, 30 Mar 2020 01:25:19 +0000 (18:25 -0700)]
missing defines (IPPROTO_ICMP and ICMP_ECHOREPLY) for Windows

I missed these in 89c40812d0b9fedf344551f8bb1deeb57fd4f8fd and don't want to rebuild this whole branch right now just to trigger coverity

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoMerge branch 'gnutls_priority_override_option'
Daniel Lenski [Mon, 30 Mar 2020 01:03:37 +0000 (18:03 -0700)]
Merge branch 'gnutls_priority_override_option'

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoMerge branch 'windows_read_stdin_line_ending'
Daniel Lenski [Mon, 30 Mar 2020 00:56:35 +0000 (17:56 -0700)]
Merge branch 'windows_read_stdin_line_ending'

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agowindows read_stdin should strip either "\r\n" or "\n" as line ending (#113)
Daniel Lenski [Mon, 30 Mar 2020 00:52:58 +0000 (17:52 -0700)]
windows read_stdin should strip either "\r\n" or "\n" as line ending (#113)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agouse run-time version numbers (per dwmw)
Daniel Lenski [Fri, 27 Mar 2020 06:57:46 +0000 (23:57 -0700)]
use run-time version numbers (per dwmw)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoMerge branch 'github_PR_164'
Daniel Lenski [Mon, 30 Mar 2020 00:40:31 +0000 (17:40 -0700)]
Merge branch 'github_PR_164'

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoDon't prevent compilation on GnuTLS <3.5.0, and add comment on OpenSSL/GnuTLS difference
Daniel Lenski [Fri, 20 Mar 2020 21:42:40 +0000 (14:42 -0700)]
Don't prevent compilation on GnuTLS <3.5.0, and add comment on OpenSSL/GnuTLS difference

Discussion of OpenSSL/GnuTLS difference with client cert issuer mistmatch:

https: //github.com/curl/curl/issues/1411
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoAlways send client cert
jethrogb [Thu, 20 Feb 2020 17:43:00 +0000 (18:43 +0100)]
Always send client cert

TLS servers may request a certificate from the client. This request includes a list of 0 or more acceptable issuer DNs. The client may use this list to determine which certificate to send. GnuTLS's default behavior is to not send a client certificate if there is no match. However, we generally always have a specific certificate specified, so we just want to send that regardless.

Originally submitted as PR on GitHub: https://github.com/dlenski/openconnect/pull/164
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoMerge branch 'origin/ignore_missing_CSD_stub_if_wrapper_specified'
Daniel Lenski [Mon, 30 Mar 2020 00:36:53 +0000 (17:36 -0700)]
Merge branch 'origin/ignore_missing_CSD_stub_if_wrapper_specified'

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoignore failure in downloading CSD stub if CSD wrapper is specified
Daniel Lenski [Fri, 27 Mar 2020 03:20:30 +0000 (20:20 -0700)]
ignore failure in downloading CSD stub if CSD wrapper is specified

Resolves the issue reported here:
https://lists.infradead.org/pipermail/openconnect-devel/2020-March/005554.html

Basically, what's happened here is that the Cisco VPN admins have
misconfigured things so that they require running CSD on all platforms, but
the CSD “stub” script specified for Linux _doesn't actually exist_.  (They
probably only tested with Mac, Windows, and Android… and never considered
Linux clients.)

That said, the absence of the CSD stub *doesn't even matter* for those who
are running a recent version of `csd-post.sh`, which entirely sidesteps
running the server provided stub and binaries.

Long story short: This patch makes OpenConnect not fail if the CSD stub
can't be downloaded… as long as a CSD wrapper script was specified.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agomention test suite in Getting Started / Building docs
Daniel Lenski [Fri, 27 Mar 2020 08:27:18 +0000 (01:27 -0700)]
mention test suite in Getting Started / Building docs

also tweak language about default vpnc-script

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoadd comments on confusing TLS/DTLS cipher description fields
Daniel Lenski [Fri, 6 Mar 2020 03:32:32 +0000 (19:32 -0800)]
add comments on confusing TLS/DTLS cipher description fields

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agodon't try to describe "DTLS" cipher if protocol's "DTLS" is actually ESP
Daniel Lenski [Fri, 6 Mar 2020 02:34:45 +0000 (18:34 -0800)]
don't try to describe "DTLS" cipher if protocol's "DTLS" is actually ESP

(or any other future, hypothetical UDP-based protocol that's not DTLS)

Also, handle OpenSSL and GnuTLS consistently in `openconnect_get_dtls_cipher`.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoRemove checks for no-longer supported GnuTLS versions
Daniel Lenski [Fri, 6 Mar 2020 02:14:53 +0000 (18:14 -0800)]
Remove checks for no-longer supported GnuTLS versions

Per 3235855966f2c3ce7f528f04964796bcaa1e0b5a, "We don't build with GnuTLS older then 3.2.10 now anyway."

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoinclude negotiated [D]TLS version in ciphersuite string for OpenSSL (GnuTLS already...
Daniel Lenski [Fri, 6 Mar 2020 02:37:37 +0000 (18:37 -0800)]
include negotiated [D]TLS version in ciphersuite string for OpenSSL (GnuTLS already does this)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agolog ciphersuite on every new HTTPS connection, not just AnyConnect protocol
Daniel Lenski [Thu, 5 Mar 2020 04:28:59 +0000 (20:28 -0800)]
log ciphersuite on every new HTTPS connection, not just AnyConnect protocol

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoallow cipher list overrides with OpenSSL as well
Daniel Lenski [Thu, 5 Mar 2020 02:26:53 +0000 (18:26 -0800)]
allow cipher list overrides with OpenSSL as well

This adds an undocumented `--openssl-ciphers` option.

Both `--openssl-ciphers` and `--gnutls-priority` options now manipulate the same
`vpninfo->ciphersuite_config`, but they should be kept with separate names
to avoid confusion, given that their contents are incompatible.

For reference:

* OpenSSL cipher list documentation: https://www.openssl.org/docs/man1.0.2/man1/ciphers.html
* GnuTLS priority string documentation: https://gnutls.org/manual/html_node/Priority-Strings.html
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoshow exact GnuTLS/OpenSSL version in --version/--help text
Daniel Lenski [Wed, 4 Mar 2020 21:06:50 +0000 (13:06 -0800)]
show exact GnuTLS/OpenSSL version in --version/--help text

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agocouple other touch-ups to the docs
Daniel Lenski [Thu, 19 Mar 2020 04:02:11 +0000 (21:02 -0700)]
couple other touch-ups to the docs

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoadd long-sought README.md
Daniel Lenski [Thu, 19 Mar 2020 03:58:42 +0000 (20:58 -0700)]
add long-sought README.md

ping #55, !57

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoMerge 'gitlab/pass_IDLE_TIMEOUT_to_script'
Daniel Lenski [Tue, 17 Mar 2020 04:07:35 +0000 (21:07 -0700)]
Merge 'gitlab/pass_IDLE_TIMEOUT_to_script'

https: //gitlab.com/openconnect/openconnect/-/merge_requests/67
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoMerge branch 'less_confusing_GP_SAML_output'
Daniel Lenski [Tue, 17 Mar 2020 04:06:44 +0000 (21:06 -0700)]
Merge branch 'less_confusing_GP_SAML_output'

https: //gitlab.com/openconnect/openconnect/-/merge_requests/69
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoMerge branch 'gitlab/more_careful_highlighting_of_unknown_GP_login_return_values'
Daniel Lenski [Tue, 17 Mar 2020 04:05:12 +0000 (21:05 -0700)]
Merge branch 'gitlab/more_careful_highlighting_of_unknown_GP_login_return_values'

https: //gitlab.com/openconnect/openconnect/-/merge_requests/66
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoMerge branch 'improve_HIP_check'
Daniel Lenski [Tue, 17 Mar 2020 04:02:54 +0000 (21:02 -0700)]
Merge branch 'improve_HIP_check'

https: //gitlab.com/openconnect/openconnect/-/merge_requests/56
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agofail if GP portal config contains no gateways (rather than simply attempting to conti...
Daniel Lenski [Mon, 16 Mar 2020 00:05:05 +0000 (17:05 -0700)]
fail if GP portal config contains no gateways (rather than simply attempting to continue with same server)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoAdd support to OpenConnect client to use RFC6750 style Bearer tokens to authenticate...
Alan Jowett [Mon, 27 Jan 2020 16:22:27 +0000 (09:22 -0700)]
Add support to OpenConnect client to use RFC6750 style Bearer tokens to authenticate to the server.

Resolves: #99

Signed-off-by: Alan TG Jowett <alan.jowett@microsoft.com>
5 years agoAdd undocumented --gnutls-priority command line option
Daniel Lenski [Wed, 4 Mar 2020 20:58:43 +0000 (12:58 -0800)]
Add undocumented --gnutls-priority command line option

Rationale: https://gitlab.com/openconnect/openconnect/issues/21#note_299083798
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoAdd some basic hostscan support to csd-post.sh
David Woodhouse [Wed, 26 Feb 2020 11:29:31 +0000 (11:29 +0000)]
Add some basic hostscan support to csd-post.sh

Fetch the data.xml, handle File and Process data requests.

This should save a little bit of manual work in crafting acceptable
responses for some users/configurations.

There's still a bunch of random crap that the real hostscan trojan can
do that we aren't attempting; some of which we probably never still.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix double colon in DTLS12 ciphersuite list
David Woodhouse [Mon, 24 Feb 2020 18:04:10 +0000 (18:04 +0000)]
Fix double colon in DTLS12 ciphersuite list

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAlways openconnect_close_https() before intermittent HIP check
Daniel Lenski [Mon, 3 Feb 2020 17:07:34 +0000 (09:07 -0800)]
Always openconnect_close_https() before intermittent HIP check

Even when tunnel is using ESP, attempting to reuse the stale HTTPS
connection from the last round can cause problems (half-open TCP sockets).

See this comment:
https: //gitlab.com/dlenski/openconnect/commit/a8dc68ae3ff9a9d492a839a385cc481d0c4bca73#note_281131962
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agofewer hardcoded constants, fewer problems
Daniel Lenski [Mon, 27 Jan 2020 06:27:35 +0000 (22:27 -0800)]
fewer hardcoded constants, fewer problems

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agocleanup parse_portal_xml()
Daniel Lenski [Mon, 27 Jan 2020 05:57:24 +0000 (21:57 -0800)]
cleanup parse_portal_xml()

This thing is getting bigger and messier, and the structure of its parsing and nested variable reuse is, ermmm… not exactly confidence-inducing

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agodon't tell Windows/Java users to use --csd-wrapper since it doesn't work yet
Daniel Lenski [Mon, 27 Jan 2020 04:41:23 +0000 (20:41 -0800)]
don't tell Windows/Java users to use --csd-wrapper since it doesn't work yet

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agonitpick docs: --force-trojan option placement and description
Daniel Lenski [Mon, 27 Jan 2020 04:29:26 +0000 (20:29 -0800)]
nitpick docs: --force-trojan option placement and description

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoHIP timing nitpicks
Daniel Lenski [Mon, 27 Jan 2020 03:53:12 +0000 (19:53 -0800)]
HIP timing nitpicks

* If no HIP script was provided, we should only check HIP *once*, to warn
  the user. Either the VPN won't work without HIP, or it will… because lots
  of GP VPNs lie or don't enforce it.

  There's no point in repeatedly checking it and warning about it, though.

* Set last_trojan and trojan_interval in gpst_setup(), not in gpst_parse_config_xml()

  The gateway config doesn't actually specify anything about the HIP/trojan
  requirements; those come from the portal config.

  The HIP check and submission do need to run after connecting to the gateway,
  though, because we need to know the client's assigned IP address(es) in
  order for HIP submission to succeed.

GlobalProtect is dumb.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agomove dtls_state checks into gpst_connect() itself, to avoid repetition
Daniel Lenski [Mon, 27 Jan 2020 01:20:28 +0000 (17:20 -0800)]
move dtls_state checks into gpst_connect() itself, to avoid repetition

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agosimplify
Daniel Lenski [Mon, 27 Jan 2020 01:38:04 +0000 (17:38 -0800)]
simplify

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoperiodic HIP checking works fine with HTTPS tunnel as long as we pause-and-reconnect...
Daniel Lenski [Mon, 27 Jan 2020 00:55:38 +0000 (16:55 -0800)]
periodic HIP checking works fine with HTTPS tunnel as long as we pause-and-reconnect the tunnel

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agomore possible login.esp arguments
Daniel Lenski [Fri, 24 Jan 2020 08:06:21 +0000 (00:06 -0800)]
more possible login.esp arguments

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoDon't show SAML details in banner, and don't show SAML “path” when it's actually...
Daniel Lenski [Thu, 16 Jan 2020 19:59:17 +0000 (11:59 -0800)]
Don't show SAML details in banner, and don't show SAML “path” when it's actually a complete HTML page

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agolog message should distinguish when SAML authentication is needed, vs. SAML authentic...
Daniel Lenski [Thu, 16 Jan 2020 19:44:58 +0000 (11:44 -0800)]
log message should distinguish when SAML authentication is needed, vs. SAML authentication complete

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agodon't show SAML login details in banner when alt-secret was specified (implying SAML...
Daniel Lenski [Thu, 16 Jan 2020 19:41:14 +0000 (11:41 -0800)]
don't show SAML login details in banner when alt-secret was specified (implying SAML login already done)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agopulse: Fix another error-path leak in pulse_eap_ttls_recv()
David Woodhouse [Wed, 15 Jan 2020 13:56:36 +0000 (14:56 +0100)]
pulse: Fix another error-path leak in pulse_eap_ttls_recv()

Spotted by Coverity. We need to return buf_free(frag) not jut buf_error().

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agopulse: Fix memory leaks in pulse_eap_ttls_send()
David Woodhouse [Wed, 15 Jan 2020 13:44:09 +0000 (14:44 +0100)]
pulse: Fix memory leaks in pulse_eap_ttls_send()

A couple of leaks spotted by Coverity, and a couple more I spotted while
staring at it.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agohttp: Retry request (once) on error receiving response
David Woodhouse [Wed, 15 Jan 2020 13:11:58 +0000 (14:11 +0100)]
http: Retry request (once) on error receiving response

A Juniper server has been encountered in the wild which sends an initial
302 redirect without Connection:close, but then just closes the connection
when it receives the next request.

This happens only for the first redirect to /dana-na/auth/… and not for
subsequent redirects through cookie-check and realm stuff. So instead of
a preemptive hack to avoid connection reuse for *all* redirects in NC,
just cope with it when it happens.

Since rq_retry is only set when the connection is already open, it won't
get set again the second time round, thus avoiding endless retries.

Fixes: #96
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUpdate translations from GNOME
David Woodhouse [Tue, 14 Jan 2020 12:27:20 +0000 (13:27 +0100)]
Update translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUpdate translations from GNOME, prioritising GNOME translations
David Woodhouse [Mon, 30 Dec 2019 00:36:15 +0000 (00:36 +0000)]
Update translations from GNOME, prioritising GNOME translations

Previously, translations from NetworkManager-openconnect have only been
pulled in if there was no existing translation in OpenConnect. Since the
GNOME translations are maintained and corrected, it's better to let them
overide the ones in OpenConnect.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoResync translations with sources
David Woodhouse [Mon, 30 Dec 2019 00:34:09 +0000 (00:34 +0000)]
Resync translations with sources

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix potential NULL dereference in openconnect_get_peer_cert_chain()
David Woodhouse [Mon, 30 Dec 2019 00:11:46 +0000 (00:11 +0000)]
Fix potential NULL dereference in openconnect_get_peer_cert_chain()

Using 'ctx' before checking it for NULL.

Fixes: #93
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agopulse: Attempt to handle EAP-TTLS fragmentation
David Woodhouse [Sun, 29 Dec 2019 13:58:10 +0000 (13:58 +0000)]
pulse: Attempt to handle EAP-TTLS fragmentation

This seems entirely gratuitous but has been seen in the wild, with a
server bizarrely fragmenting a TTLS message of only 3637 bytes, into a
first fragment of 3550 bytes.

We limit the individual IF-T/TLS fragments to 16KiB which is the TLS
record length, because we've never seen IF-T/TLS messages which aren't
precisely aligned in a TLS record (although NC did do horrible things
there).

Each call to pulse_eap_ttls_recv() will receive data from only a single
fragment; another call will be needed to send the Acknowledge frame and
then receive data from the next fragment.

Also implement outbound fragmentation with a fragment limit of 8KiB,
in case it's ever needed.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAllow custom stoken rcfile to be specfied
David Woodhouse [Tue, 17 Dec 2019 14:28:54 +0000 (14:28 +0000)]
Allow custom stoken rcfile to be specfied

Fixes: #71
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoMove read_file_into_string() to ssl.c and rename it
David Woodhouse [Tue, 17 Dec 2019 14:00:57 +0000 (14:00 +0000)]
Move read_file_into_string() to ssl.c and rename it

We'll want to use this from stoken.c too.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoConsolidate almost-identical set_[ht]otp_mode() functions
David Woodhouse [Tue, 17 Dec 2019 13:18:21 +0000 (13:18 +0000)]
Consolidate almost-identical set_[ht]otp_mode() functions

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoSend Coverity reports to $GITLAB_USER_EMAIL instead of hard-coding it.
David Woodhouse [Tue, 17 Dec 2019 13:17:34 +0000 (13:17 +0000)]
Send Coverity reports to $GITLAB_USER_EMAIL instead of hard-coding it.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoDetect closed HTTPS socket when sending requests
David Woodhouse [Mon, 16 Dec 2019 13:15:43 +0000 (13:15 +0000)]
Detect closed HTTPS socket when sending requests

Fixes: #87
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd separate list-taps.exe "test"
David Woodhouse [Tue, 17 Dec 2019 17:09:06 +0000 (17:09 +0000)]
Add separate list-taps.exe "test"

This should help debug user reports of tailing to find tap devices,
like https://gitlab.com/openconnect/openconnect/issues/88

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoMake win32 search_taps() function work standalone, add debugging
David Woodhouse [Tue, 17 Dec 2019 17:07:58 +0000 (17:07 +0000)]
Make win32 search_taps() function work standalone, add debugging

Would like to create a separate list-taps.exe binary.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoAdd password change support
David Woodhouse [Thu, 12 Dec 2019 14:43:43 +0000 (14:43 +0000)]
Add password change support

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agotun-win32: Attempt to open all adapters, don't bail if the first is in use
David Woodhouse [Tue, 10 Dec 2019 09:44:21 +0000 (09:44 +0000)]
tun-win32: Attempt to open all adapters, don't bail if the first is in use

https://gitlab.com/openconnect/openconnect-gui/issues/278

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoUpdate translations from GNOME
David Woodhouse [Fri, 29 Nov 2019 10:58:33 +0000 (10:58 +0000)]
Update translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agopass IDLE_TIMEOUT to configuration script
Daniel Lenski [Wed, 23 Oct 2019 01:11:32 +0000 (18:11 -0700)]
pass IDLE_TIMEOUT to configuration script

`vpninfo->idle_timeout` was added in
37fbeedd73cc75395f67fdcaa758cf6b0cc87675, for use by the Java API and
Android ics-openconnect, which uses it to keep the connection alive at
appropriate intervals.

This patch makes this variable available to the normal vpnc-script used by
OpenConnect, so that it can likewise spawn a keepalive process if desired.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoTry harder to explain unknown values in GP /ssl-vpn/login.esp response
Daniel Lenski [Fri, 11 Oct 2019 19:09:55 +0000 (12:09 -0700)]
Try harder to explain unknown values in GP /ssl-vpn/login.esp response

Relevant to issue #79.

This modifies the behavior of the parser for the login response XML so that it will print unknown arguments' values even if they appear after the expected number of arguments, or even if unrecoverably-wrong values have already been detected.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
5 years agoFix build error in select fix
David Woodhouse [Mon, 14 Oct 2019 14:16:00 +0000 (15:16 +0100)]
Fix build error in select fix

Bad dwmw2. No biscuit.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoWhen select() returns with errno == EINTR, that isn't an error
David Woodhouse [Mon, 14 Oct 2019 14:08:53 +0000 (15:08 +0100)]
When select() returns with errno == EINTR, that isn't an error

This stopped us from actually sending the BYE packet and closing the
session cleanly on exit.

Fixes: a07183b79f ("Check select() return value in main loop") et al.
This is why we don't blindly "fix warnings" reported by tools like
Coverity, and should sometimes be a little more reticent, and only
actually fix *bugs* that are highlighted.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix pulse session kill request
David Woodhouse [Mon, 14 Oct 2019 13:07:11 +0000 (14:07 +0100)]
Fix pulse session kill request

Fixing leaks is good. Fixing them by freeing a string we were about to
use and then setting it to NULL, thus triggering a later check to report
-ENOMEM, less good.

Stupid dwmw2, no biscuit.

Fixes: 097586fe ("Fix leaks in Pulse duplicate session handling")
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoFix build with libressl 2.7.x/2.9.x
John Spencer [Wed, 9 Oct 2019 15:41:23 +0000 (16:41 +0100)]
Fix build with libressl 2.7.x/2.9.x

rather than hardcoding version numbers with ifdefs, we simply check
whether the functionality is available or not.

[dwmw2: Use #ifndef instead of #if !HAVE_SSL_CIPHER_FIND]
Signed-off-by: John Spencer <maillist-openconnect@barfooze.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
5 years agoGlobalProtect: Ensure timeout is less than DPD when DTLS connecting
Corey Wright [Mon, 23 Sep 2019 05:37:53 +0000 (00:37 -0500)]
GlobalProtect: Ensure timeout is less than DPD when DTLS connecting

When transitioning from DTLS_CONNECTING to DTLS_CONNECTED ensure that
the current timeout is less than or equal to 10-second DTLS DPD
otherwise timeout might be greater than 2x DPD, eg set to 60-second
DTLS attempt period from the ESP main loop where we were "connecting",
and we might sleep right through the DTLS DPD period and falsely
detect a dead peer and needlessly fall back to HTTPS.

This is only relevant to reconnects because during the initial
connection the timeout is artificially set low, ie 1 second, by the
OpenConnect mainloop because the TUN device is not yet up.

Signed-off-by: Corey Wright <cwright@digitalocean.com>
5 years agoMerge branch 'clarify_cafile_and_no_system_trust' of gitlab.com:dlenski/openconnect
David Woodhouse [Mon, 14 Oct 2019 12:06:30 +0000 (13:06 +0100)]
Merge branch 'clarify_cafile_and_no_system_trust' of gitlab.com:dlenski/openconnect

5 years agoMerge branch 'correct_mimetype_and_charset_for_XML_post' of gitlab.com:dlenski/openco...
David Woodhouse [Mon, 14 Oct 2019 12:04:42 +0000 (13:04 +0100)]
Merge branch 'correct_mimetype_and_charset_for_XML_post' of gitlab.com:dlenski/openconnect