]> www.infradead.org Git - users/dwmw2/openconnect.git/log
users/dwmw2/openconnect.git
3 years agoAdd a fake SAML handler/form to fake-gp-server.py
Daniel Lenski [Thu, 12 May 2022 21:58:22 +0000 (14:58 -0700)]
Add a fake SAML handler/form to fake-gp-server.py

This allows authenticating to the fake server with https://github.com/dlenski/gp-saml-gui

    # Start fake server
    $ ./fake-gp-server localhost 8080 certs/server-{cert,key}.pem 2>&1 >/dev/null &

    # Configure fake server for SAML on the portal interface
    $ curl -sk https://localhost:8080/CONFIGURE -d portal_saml=portal-userauthcookie -d portal_cookie=portal-userauthcookie

    # Use gp-saml-gui to authenticate to it
    $ gp-saml-gui --no-verify localhost:8080
    ...
    ... pops up window
    ... fills out login form
    ...
    HOST=https://localhost:8080/global-protect/getconfig.esp:portal-userauthcookie
    USER=nobody
    COOKIE=FAKE_username_nobody_password_whatever
    OS=linux-64

The goal of this is to have a SAML-supporting GP server to test against
while modifying openconnect to directly call the GP SAML webview handler
itself (see https://github.com/dlenski/gp-saml-gui/issues/45).

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoRework GP fake server to have a persistent configuration
Daniel Lenski [Thu, 12 May 2022 20:58:04 +0000 (13:58 -0700)]
Rework GP fake server to have a persistent configuration

Until now, all of our Flask-based servers for testing protocol
authentication flows have "cheated" a bit.

They're configurable (e.g.  should the authentication require a 2FA token,
or should it not?), but this configuration has not actually been persisted
by the server.

Instead, the server sends the client a session cookie which has the desired
*server* configuration glommed into it, and relies on the client sending
this cookie back on every request (which OpenConnect obliges, for
authentication requests) so that the server can "remember" what it's
configured to do.

This is very confusing to read and understand, and it's also untenable to
continue using it for fake servers that simulate external authentication
(SAML/SSO).  That's because external authentication uses a separate
browser/handler for the authentication flow, so it won't share the session
cookies.

This modifies the fake GP server to store a persistent in-memory
configuration which can easily be set and inspected with cURL:

    $ ./fake-gp-server localhost 8080 certs/server-{cert,key}.pem 2>&1 >/dev/null &
    $ curl -sk https://localhost:8080/CONFIGURE -d gw_2fa=1
    $ curl -sk https://localhost:8080/CONFIGURE
    Current configuration of fake GP server configuration:
    TestConfiguration(gateways=('Default gateway',), portal_2fa=False, gw_2fa=True, portal_cookie=None, portal_saml=None, gateway_saml=None)
    $ openconnect --protocol=gp localhost:8080
    Please login to this fake GP VPN portal
    Username: fakeusername
    Password: *******
    ...
    2FA challenge from gateway
    Challenge:

Contrast this with the old approach:

    $ ./fake-gp-server localhost 8080 certs/server-{cert,kem}.pem 2>&1 >/dev/null &
    $ openconnect --protocol=gp localhost:8080/global-protect/testconfig.esp?gw_2fa=1

The gp-auth-and-config tests are modified accordingly to set the persistent
configuration of the fake server.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoCleanup GP auth tests (don't need to disable IPv6 here)
Daniel Lenski [Thu, 12 May 2022 21:59:20 +0000 (14:59 -0700)]
Cleanup GP auth tests (don't need to disable IPv6 here)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoClearer error for list-system-keys on Unix-like platforms
Daniel Lenski [Sat, 28 May 2022 21:37:44 +0000 (14:37 -0700)]
Clearer error for list-system-keys on Unix-like platforms

It appears that the `gnutls_system_key*` functions are only implemented on
Windows currently. Lots of people are likely to test this executable on
Unix-y systems, so we should give a clearer error message.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoClearer error message when GlobalProtect portal configuration contains no gateways...
Daniel Lenski [Thu, 2 Jun 2022 21:54:54 +0000 (21:54 +0000)]
Clearer error message when GlobalProtect portal configuration contains no gateways at all

The GP portal config parser is intended to print a clear error message when the list
of gateway servers is empty.

However, when the `<gateways><external><list>` tag is entirely absent, this
message is skipped, resulting in a vague "Failed to parser server response"
as seen in https://gitlab.com/openconnect/openconnect/-/issues/444.

This patch fixes that.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoImport translations from GNOME
David Woodhouse [Tue, 24 May 2022 16:14:06 +0000 (17:14 +0100)]
Import translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoDetect Array session timeout and exit cleanly
David Woodhouse [Mon, 23 May 2022 22:54:34 +0000 (23:54 +0100)]
Detect Array session timeout and exit cleanly

We need to return -EPERM so that we exit cleanly instead of treating it
like a network error and retrying repeatedly.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoLooks like Array *does* split packets across TLS records
David Woodhouse [Mon, 23 May 2022 09:56:46 +0000 (10:56 +0100)]
Looks like Array *does* split packets across TLS records

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoFix constness of character buffers in HKDF/HPKE-related functions
Dimitri Papadopoulos [Fri, 20 May 2022 19:56:37 +0000 (21:56 +0200)]
Fix constness of character buffers in HKDF/HPKE-related functions

gnutls.c: In function ‘hkdf_sha256_extract_expand’:
gnutls.c:3057:41: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 3057 |         const gnutls_datum_t info_d = { info, infolen };
      |                                         ^~~~

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoDefault 'Getting Started' top-level menu to connecting.html
David Woodhouse [Sun, 22 May 2022 12:55:13 +0000 (13:55 +0100)]
Default 'Getting Started' top-level menu to connecting.html

It's basically packaged everywhere; no need to take users to a page on
building by default.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoUpdate changelog, improve Windows certificate store documentation
David Woodhouse [Sun, 22 May 2022 12:52:15 +0000 (13:52 +0100)]
Update changelog, improve Windows certificate store documentation

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoAttempt to handle multiple IP packets in an Array TLS frame
David Woodhouse [Fri, 20 May 2022 16:58:34 +0000 (17:58 +0100)]
Attempt to handle multiple IP packets in an Array TLS frame

Fixes: #435
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoDon't install list-system-keys
David Woodhouse [Sat, 21 May 2022 22:12:12 +0000 (23:12 +0100)]
Don't install list-system-keys

It breaks the Linux COPR builds since the native RPM doesn't list it as
one of the files that are expected to be installed. And in fact we don't
*want* it installed for Linux as GnuTLS system keys aren't supported on
Linux anyway. So just leave it uninstalled for now. It's in the Windows
installer.

We *will* want to make it available for the GUI installer to use, but
I'm still not sure how to handle that. Since the GUI changes less often
perhaps I should actually pull in the openconnect-gui MinGW package as
a dependency of the openconnect build. Which is backwards really, but
it would allow us to spit out an installer including OpenConnect-GUI
for every libopenconnect build. Not today though...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoClean up NSIS installation a bit
David Woodhouse [Sat, 21 May 2022 20:39:24 +0000 (21:39 +0100)]
Clean up NSIS installation a bit

Move list-system-keys.exe to the top-level directory as it isn't really
a test, and install it as part of the RPM.

Clean up the DLL dependency handling to allow for multiple .exe files as
'roots', and also add a hack to make it possible to include extra files
like openconnect-gui.exe

That required supporting Qt and its plugin DLLs, which isn't strictly
needed in OpenConnect itself but I'll probably lift the same mechanisms
to use them in the mingw-openconnect-gui build, and it's best for them
to remain in sync.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoFix COPR builds
David Woodhouse [Sat, 21 May 2022 12:35:35 +0000 (13:35 +0100)]
Fix COPR builds

These have recently started complaining that the git directory isn't owned
by the current user:

./mkspec.sh mingw-openconnect
fatal: unsafe repository ('/mnt/workdir-0bz7gifx/openconnect' is owned by someone else)

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoAdd list-system-keys tool
David Woodhouse [Mon, 16 May 2022 13:11:18 +0000 (14:11 +0100)]
Add list-system-keys tool

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoOpenConnect has too many slightly-varying and undocumented interfaces for external...
Daniel Lenski [Fri, 13 May 2022 17:40:08 +0000 (10:40 -0700)]
OpenConnect has too many slightly-varying and undocumented interfaces for external scripts with similar functions

Document them in 'What needs doing?' for now.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoFix signedness of character buffers in HKDF/HPKE-related functions
Dimitri Papadopoulos [Sat, 14 May 2022 10:50:13 +0000 (12:50 +0200)]
Fix signedness of character buffers in HKDF/HPKE-related functions

GCC warned of inconsistent signedness in function arguments.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoBugfix fake-gp-server.py: <saml-request> uses the 'standard' base64 alphabet, not...
Daniel Lenski [Thu, 12 May 2022 21:16:20 +0000 (14:16 -0700)]
Bugfix fake-gp-server.py: <saml-request> uses the 'standard' base64 alphabet, not the 'URL-safe' one

We know that both openconnect_base64_decode() and
https://github.com/dlenski/gp-saml-gui successfully decode the contents of
the <saml-request> tag fromn real GP servers that require SAML auth, so
their expectation of the 'standard' base64 alphabet here must be correct.

This may fix some of the intermittent failures in tests/gp-auth-and-config.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoUse OpenSSL_version() not deprecated SSLeay_version()
David Woodhouse [Thu, 12 May 2022 14:55:59 +0000 (15:55 +0100)]
Use OpenSSL_version() not deprecated SSLeay_version()

Fixes: #428
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoFix ESP recv() error handling for Windows
David Woodhouse [Tue, 10 May 2022 07:02:35 +0000 (08:02 +0100)]
Fix ESP recv() error handling for Windows

Fixes: #427
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoRemove stray debug message on Pulse ESP rekey
David Woodhouse [Wed, 4 May 2022 10:38:49 +0000 (11:38 +0100)]
Remove stray debug message on Pulse ESP rekey

Reported-by: Schütz Dominik <Dominik.Schuetz@esolutions.de>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoImport translations from GNOME
David Woodhouse [Wed, 4 May 2022 06:44:10 +0000 (07:44 +0100)]
Import translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoBuildRequire glibc-langpack-cs on EPEL9 for auth-nonascii test
David Woodhouse [Sat, 30 Apr 2022 14:50:12 +0000 (15:50 +0100)]
BuildRequire glibc-langpack-cs on EPEL9 for auth-nonascii test

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoRevert "Use more idiomatic super().__init__() in html.py"
David Woodhouse [Sat, 30 Apr 2022 14:45:52 +0000 (15:45 +0100)]
Revert "Use more idiomatic super().__init__() in html.py"

This reverts commit 1b3ffa6fb8f77b3924f474e675c3fe9ac16901fb, which
broke the build with python 2.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'autoconf' into 'master'
David Woodhouse [Sat, 30 Apr 2022 07:35:51 +0000 (07:35 +0000)]
Merge branch 'autoconf' into 'master'

AC_PREREQ expects a single version argument

Closes #413

See merge request openconnect/openconnect!374

3 years agoMerge branch 'rhel5' into 'master'
David Woodhouse [Sat, 30 Apr 2022 07:19:21 +0000 (07:19 +0000)]
Merge branch 'rhel5' into 'master'

No need to support RHEL 5

See merge request openconnect/openconnect!377

3 years agoMerge branch 'CentOS6' into 'master'
David Woodhouse [Sat, 30 Apr 2022 07:18:47 +0000 (07:18 +0000)]
Merge branch 'CentOS6' into 'master'

Stop CentOS6 CI job

Closes #416

See merge request openconnect/openconnect!375

3 years agoMerge branch 'obs' into 'master'
David Woodhouse [Sat, 30 Apr 2022 07:18:05 +0000 (07:18 +0000)]
Merge branch 'obs' into 'master'

obs: remove libtss2-dev from debian dependency, to allow build for 18.04 to succeed

See merge request openconnect/openconnect!378

3 years agoobs: remove libtss2-dev from debian dependency, to allow build for 18.04 to succeed
Luca Boccassi [Fri, 29 Apr 2022 23:53:07 +0000 (00:53 +0100)]
obs: remove libtss2-dev from debian dependency, to allow build for 18.04 to succeed

It will be added for newer distributions via prjconf

Signed-off-by: Luca Boccassi <bluca@debian.org>
3 years agoNo need to support RHEL 5
Dimitri Papadopoulos [Fri, 29 Apr 2022 21:53:40 +0000 (23:53 +0200)]
No need to support RHEL 5

It is EOL'ed and we don't build on it.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoAC_PREREQ expects a single version argument
Dimitri Papadopoulos [Fri, 29 Apr 2022 12:17:24 +0000 (14:17 +0200)]
AC_PREREQ expects a single version argument

As enforced by autopudate, see 4.2 Dealing with Autoconf versions:
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/html_node/Versioning.html

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoStop CentOS6 CI job
Dimitri Papadopoulos [Fri, 29 Apr 2022 19:26:10 +0000 (21:26 +0200)]
Stop CentOS6 CI job

CentOS 6 has reached End of Life, Maintenance support ended in November 2020.

RHEL 6 has entered Extended Life Phase (ELP), but its scope is limited:
• assistance on existing installs only (not new installs),
• no investigation of the root cause for unknown issues.

Extended Life Cycle Support (ELS) does include some updates,  but only
certain critical-impact security fixes and selected urgent priority bug fixes.

It's  pointless to provide more support than Red Hat themselves.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoTag version 9.01 v9.01
David Woodhouse [Fri, 29 Apr 2022 21:19:46 +0000 (22:19 +0100)]
Tag version 9.01

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoChangelog for API minor fix
David Woodhouse [Fri, 29 Apr 2022 21:18:44 +0000 (22:18 +0100)]
Changelog for API minor fix

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoBump OPENCONNECT_API_VERSION_MINOR
David Woodhouse [Fri, 29 Apr 2022 16:32:12 +0000 (17:32 +0100)]
Bump OPENCONNECT_API_VERSION_MINOR

Oops, I thought that was all automated...

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoTag version 9.00 v9.00
David Woodhouse [Fri, 29 Apr 2022 15:43:16 +0000 (16:43 +0100)]
Tag version 9.00

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoAdd changelog entry for SAML/SSO
David Woodhouse [Fri, 29 Apr 2022 15:42:22 +0000 (16:42 +0100)]
Add changelog entry for SAML/SSO

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'autoconf' into 'master'
David Woodhouse [Fri, 29 Apr 2022 12:13:40 +0000 (12:13 +0000)]
Merge branch 'autoconf' into 'master'

AC_PROG_CC_C99 / AC_TRY_COMPILE are obsolete starting with autoconf 2.70

Closes #413

See merge request openconnect/openconnect!369

3 years agoImplement a function openconnect_set_useragent
Ambroise Rosset [Fri, 29 Apr 2022 11:14:32 +0000 (13:14 +0200)]
Implement a function openconnect_set_useragent

Implement a function openconnect_set_useragent to allow external
programme that use libopenconnect to start a VPN (like NetworkManager)
to tune the Useragent of the connection like the option --useragent do.

If they only tune the useragent agent name by the variable passed
through the opeconnect_vpninfo_new function, the version number of
openconnect is automatically added after the string choosed.

Signed-off-by: Ambroise Rosset <earendil@toleressea.fr>
3 years agoAdd missing host-cpu-c-abi.m4
Dimitri Papadopoulos [Thu, 28 Apr 2022 12:20:45 +0000 (14:20 +0200)]
Add missing host-cpu-c-abi.m4

This M4 file is a dependency of lib-prefix.m4.

Fixes this Autoconf warning:
warning: gl_HOST_CPU_C_ABI_32BIT is m4_require'd but not m4_defun'd

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoAC_TRY_COMPILE is obsolete starting with autoconf 2.70
Dimitri Papadopoulos [Thu, 28 Apr 2022 12:04:08 +0000 (14:04 +0200)]
AC_TRY_COMPILE is obsolete starting with autoconf 2.70

AC_COMPILE_IFELSE has been around since autoconf 2.50 at least,
according to "18.6.5 AC_ACT_IFELSE vs. AC_TRY_ACT":
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/html_node/AC_005fACT_005fIFELSE-vs-AC_005fTRY_005fACT.html#AC_005fFOO_005fIFELSE-vs-AC_005fTRY_005fFOO

Since Autoconf 2.50, internal codes uses
AC_PREPROC_IFELSE, AC_COMPILE_IFELSE, AC_LINK_IFELSE, and AC_RUN_IFELSE
on one hand and
AC_LANG_SOURCE, and AC_LANG_PROGRAM
on the other hand instead of the deprecated
AC_TRY_CPP, AC_TRY_COMPILE, AC_TRY_LINK, and AC_TRY_RUN.

Fixes this Autoconf warning:
warning: The macro `AC_TRY_COMPILE' is obsolete.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoUpdate m4 files
Dimitri Papadopoulos [Thu, 28 Apr 2022 08:03:04 +0000 (10:03 +0200)]
Update m4 files

m4/lib-ld.m4
m4/lib-link.m4
m4/lib-prefix.m4
  the latest versions from gnulib

acinclude.m4 → m4/ax_jni_include_dir.m4
  the latest release 2022.02.11 from the Autoconf Archive

acinclude.m4 → as-compiler-flag.m4
  copied as is because the origin of this file is unclear
  it is different from the latest version in the Autostar Sandbox

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoArguments should be enclosed within ‘[’ and ‘]’
Dimitri Papadopoulos [Wed, 27 Apr 2022 18:45:24 +0000 (20:45 +0200)]
Arguments should be enclosed within ‘[’ and ‘]’

As enforced by autopudate, see 3.1.2 The Autoconf Language:
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/html_node/Autoconf-Language.html

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoAC_PROG_CC_C99 is obsolete starting with autoconf 2.70
Dimitri Papadopoulos [Wed, 27 Apr 2022 18:39:46 +0000 (20:39 +0200)]
AC_PROG_CC_C99 is obsolete starting with autoconf 2.70

Fixes this Autoconf warning:
warning: The macro `AC_PROG_CC_C99' is obsolete.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoNo need to support RHEL 5
Dimitri Papadopoulos [Fri, 29 Apr 2022 09:10:50 +0000 (11:10 +0200)]
No need to support RHEL 5

It is EOL'ed and we don't build on it.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoDo not ignore 0.0.0.0/0 specified as a "split"-{in,ex}clude route for oNCP
Daniel Lenski [Thu, 20 May 2021 00:01:01 +0000 (00:01 +0000)]
Do not ignore 0.0.0.0/0 specified as a "split"-{in,ex}clude route for oNCP

This addresses https://gitlab.com/openconnect/openconnect/-/issues/245. In the case
presented there, the oNCP server sends a Legacy IP netmask ("default route") of
255.255.255.255, and a "split"-include route of 0.0.0.0/0.0.0.0:

> Received split include route 0.0.0.0/0.0.0.0
> Received netmask 255.255.255.255

We also should not ignore 0.0.0.0/0 if specified as a "split"-exclude route, though
the purpose of such a route is unclear and we have never seen one in the wild.

Next, we should handle this case in the same way that we do for GlobalProtect,
as of https://gitlab.com/openconnect/openconnect/-/merge_requests/118; namely,
by replacing the 255.255.255.255 netmask with the 0.0.0.0/0 send as a "split"-include,
and removing the latter from the list of split-includes.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoobs: add a strict versioned dependency from openconnect to libopenconnect5
Luca Boccassi [Thu, 28 Apr 2022 21:38:47 +0000 (22:38 +0100)]
obs: add a strict versioned dependency from openconnect to libopenconnect5

Signed-off-by: Luca Boccassi <bluca@debian.org>
3 years agoMerge branch 'fortinet_split_excludes' of gitlab.com:openconnect/openconnect
David Woodhouse [Thu, 28 Apr 2022 21:14:50 +0000 (22:14 +0100)]
Merge branch 'fortinet_split_excludes' of gitlab.com:openconnect/openconnect

3 years agoAdd missing export-strings.sh
David Woodhouse [Thu, 28 Apr 2022 21:09:21 +0000 (22:09 +0100)]
Add missing export-strings.sh

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoResync translations with sources
David Woodhouse [Thu, 28 Apr 2022 21:04:13 +0000 (22:04 +0100)]
Resync translations with sources

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'scootergrisen-master-patch-59421' of gitlab.com:DimitriPapadopoulos...
David Woodhouse [Thu, 28 Apr 2022 21:03:58 +0000 (22:03 +0100)]
Merge branch 'scootergrisen-master-patch-59421' of gitlab.com:DimitriPapadopoulos/openconnect

3 years agoImport translations from GNOME
David Woodhouse [Thu, 28 Apr 2022 21:03:54 +0000 (22:03 +0100)]
Import translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'obs' of gitlab.com:bluca/openconnect
David Woodhouse [Thu, 28 Apr 2022 21:01:04 +0000 (22:01 +0100)]
Merge branch 'obs' of gitlab.com:bluca/openconnect

3 years agoMerge branch 'codespell' of gitlab.com:DimitriPapadopoulos/openconnect
David Woodhouse [Thu, 28 Apr 2022 20:59:46 +0000 (21:59 +0100)]
Merge branch 'codespell' of gitlab.com:DimitriPapadopoulos/openconnect

3 years agoFix setsockopt(SO_REUSEADDR) warnings
David Woodhouse [Thu, 28 Apr 2022 19:52:26 +0000 (20:52 +0100)]
Fix setsockopt(SO_REUSEADDR) warnings

Coverity didn't like that we were ignoring the return value, and the mingw
build didnt like that the optval pointer is (unsigned char *) on Windows.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoFix potential leak of cookie_buf on error path
David Woodhouse [Thu, 28 Apr 2022 18:44:39 +0000 (19:44 +0100)]
Fix potential leak of cookie_buf on error path

Spotted by Coverity.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoAllow gmp without pkgconfig
David Woodhouse [Thu, 28 Apr 2022 18:44:00 +0000 (19:44 +0100)]
Allow gmp without pkgconfig

The MinGW builds seem to have it like this. Now HPKE works on Windows
(although I haven't worked out how to spawn the browser)

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoOnly abort on certificate fail for CERT2_REQUESTED
David Woodhouse [Thu, 28 Apr 2022 14:30:59 +0000 (15:30 +0100)]
Only abort on certificate fail for CERT2_REQUESTED

Some servers seem to request the first certificate even when it isn't
needed. Don't abort XML mode for that.

Fixes: #417
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoRevert "GP: Fix the issue of a 0.0.0.0/0 "split"-include route by swapping the "split...
David Woodhouse [Mon, 25 Apr 2022 09:25:20 +0000 (10:25 +0100)]
Revert "GP: Fix the issue of a 0.0.0.0/0 "split"-include route by swapping the "split" route with the default netmask."

This reverts commit 99ae55aec1408a2905df72394dab99cb6fb41aed, which causes
regressions with existing NetworkManager-openconnect releases.

We can do it in NetworkManager-openconnect with
https://gitlab.gnome.org/GNOME/NetworkManager-openconnect/-/merge_requests/36

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoobs: switch version format to 'tag+n_commits_over_tag+gHASH'
Luca Boccassi [Wed, 27 Apr 2022 13:24:49 +0000 (14:24 +0100)]
obs: switch version format to 'tag+n_commits_over_tag+gHASH'

Note that this is just a copy of the configuration, the OBS
package is maintained on OBS.

Signed-off-by: Luca Boccassi <bluca@debian.org>
3 years agoChange "openconnect" to "OpenConnect"
Dimitri Papadopoulos [Tue, 26 Apr 2022 13:19:00 +0000 (15:19 +0200)]
Change "openconnect" to "OpenConnect"

To be consistent with the way it is written in similar strings.

@scootergrisen, thank you for the original patch against NetworkManager-openconnect.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoobs workflow: trigger release repository rebuilds when a tag is pushed
Luca Boccassi [Mon, 25 Apr 2022 15:27:02 +0000 (17:27 +0200)]
obs workflow: trigger release repository rebuilds when a tag is pushed

Signed-off-by: Luca Boccassi <bluca@debian.org>
3 years agowww: link OBS setup instructions in packages.xml
Luca Boccassi [Thu, 21 Apr 2022 10:35:25 +0000 (12:35 +0200)]
www: link OBS setup instructions in packages.xml

Signed-off-by: Luca Boccassi <bluca@debian.org>
3 years agowww: remove link to PPA, not updated anymore
Luca Boccassi [Thu, 21 Apr 2022 10:26:52 +0000 (12:26 +0200)]
www: remove link to PPA, not updated anymore

Signed-off-by: Luca Boccassi <bluca@debian.org>
3 years agoAdd changelog for STRAP
David Woodhouse [Sat, 23 Apr 2022 16:14:49 +0000 (17:14 +0100)]
Add changelog for STRAP

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoAlways send STRAP pubkey even when we don't change it
David Woodhouse [Fri, 22 Apr 2022 22:17:16 +0000 (23:17 +0100)]
Always send STRAP pubkey even when we don't change it

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMake all STRAP support conditional on HPKE
David Woodhouse [Fri, 22 Apr 2022 16:02:08 +0000 (17:02 +0100)]
Make all STRAP support conditional on HPKE

We really don't care about STRAP; we only did it for the external browser
support. The only case we've seen STRAP failing is when we *did* advertise
it and then didn't really do it, so omitting it completely seems harmless
for now.

And older GnuTLS such as on CentOS doesn't have some of the functions we
are using to obtain the Finished message or export the privkey, so just
disable it all. We *could* support the basic STRAP from GnuTLS 3.4.0 on
but there's not a lot of point.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoSilence static-analyser warning about redundant assignment to 'sep'
David Woodhouse [Fri, 22 Apr 2022 15:14:17 +0000 (16:14 +0100)]
Silence static-analyser warning about redundant assignment to 'sep'

I did this for a reason. The *compiler* is clever enough not to bother
actually doing the assignment (not that it would matter anyway, since it
is hardly a fast path). But *developers*, including myself, are much less
likely to spot that it needs to be added in the 'deflate' case if we add
a new case at the end. So now in order to shut the tools up, I have to
turn a non-bug into a latent *actual* bug.

I suppose I could leave it there with a comment, or refactor it into a
loop over tuples of the form { COMPR_LZ4, "oc-lz4" }…  but it probably
doesn't matter as we're unlikely to be adding more. Just suck it up.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoRevert "append_compr_types: removed unnecessary assignment"
David Woodhouse [Fri, 22 Apr 2022 14:43:19 +0000 (15:43 +0100)]
Revert "append_compr_types: removed unnecessary assignment"

This reverts commit 3cde372235c0616e4769a09dd8774b6fb2c95209.

The assignment *was* necessary. The point was that the first time 'sep'
was used, it's a space. And *after* that, it's a comma. Using a comma
every time ends up sending headers which look like this:
  X-DTLS-Accept-Encoding:,lzs

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoExport STRAP private key with AnyConnect cookie
David Woodhouse [Fri, 22 Apr 2022 14:39:14 +0000 (15:39 +0100)]
Export STRAP private key with AnyConnect cookie

For STRAP we need to reconnect using the same private key as the auth
process did. Thankfully we already have precedent for this; we can put
multiple 'cookies' into the opaque string that is passed from auth to
connection process, and use internal_split_cookies() to parse them.

So encode the privkey into an 'openconnect_strapkey' cookie which we
handle specially on ingestion.

Fix up a few places where vpninfo->cookie was handled directly, to make
it all work.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoAttempt to implement AnyConnect Session Token Re-use Anchor Protocol (STRAP)
David Woodhouse [Thu, 21 Apr 2022 21:14:00 +0000 (22:14 +0100)]
Attempt to implement AnyConnect Session Token Re-use Anchor Protocol (STRAP)

In order to implement the external-browser SAML support we had to send
the X-AnyConnect-STRAP-Pubkey: header, even though we didn't really know
what that was.

That turns out to cause a regression for some user (issue #410), as the
server then rejects us we don't include a valid X-AnyConnect-STRAP-Verify:
header in our CONNECT request.

That header is supposed to contain our Finished message from the TLS
handshake, hashed and signed with our STRAP-Pubkey. Or if we rekey, it's
a signed hash of the Finished message concatenated with the (DER) public
key that we also send in a new X-AnyConnect-STRAP-Pubkey: header.

Lightly tested, as we can't actually work out how to make *our* servers
reject the connections for this offence, and Cisco's documentation is
very sparse. But it shouldn't make things worse for anyone.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoFix typo found by codespell
Dimitri Papadopoulos [Thu, 21 Apr 2022 00:29:36 +0000 (02:29 +0200)]
Fix typo found by codespell

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoImport translations from GNOME
David Woodhouse [Thu, 21 Apr 2022 08:16:43 +0000 (09:16 +0100)]
Import translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoFix lost translations for PRId64 → PRIu64 change
David Woodhouse [Thu, 21 Apr 2022 08:15:17 +0000 (09:15 +0100)]
Fix lost translations for PRId64 → PRIu64 change

When we make changes like this, we should fix the translations too, to avoid
losing them.

Fixes: 7d8747806c ("The format specifier for uint64_t is PRIu64")
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'GP_internal_no_flag_for_issue_246' into 'master'
Daniel Lenski [Wed, 20 Apr 2022 23:30:38 +0000 (23:30 +0000)]
Merge branch 'GP_internal_no_flag_for_issue_246' into 'master'

GP: add 'internal=no' flag to the login and configuration requests

See merge request openconnect/openconnect!337

3 years agoUpdate changelog
Daniel Lenski [Fri, 8 Apr 2022 03:43:00 +0000 (20:43 -0700)]
Update changelog

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoGP: add 'internal=no' flag to the login and configuration requests
Daniel Lenski [Fri, 11 Feb 2022 18:13:46 +0000 (10:13 -0800)]
GP: add 'internal=no' flag to the login and configuration requests

Without these flags, one user reports consistently hitting the "Matching
client config not found" error in response to the /ssl-vpn/getconfig.esp
request.  See https://gitlab.com/openconnect/openconnect/-/issues/246

I *suspect* that 'internal=no' is the implicit default if unspecified
(https://gitlab.com/openconnect/openconnect/-/issues/246#note_836128670),
but we should get more testing on other GlobalProtect VPNs to confirm that
this works fine with them. If there is variation in whether this parameter
is allowed/expected, then we need a way to automatically detect the correct
value.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoFix initial client request XML structure when announcing multicert capability
Daniel Lenski [Wed, 20 Apr 2022 03:43:27 +0000 (20:43 -0700)]
Fix initial client request XML structure when announcing multicert capability

Having a separate 'announce_multicert_capability' function wasn't ideal:

1. Building the initial '<config-auth>' XML was more spread out and complex
   than necessary due to an extra layer of functions.
2. When multicert auth is offered by the client, the resultant XML actually
   contained *two* nested capabilities/auth-method tags:

       <config-auth client="vpn" type="init">
         <capabilities>
           <auth-method>single-sign-on</auth-method>
           <auth-method>single-sign-on-v2</auth-method>
         </capabilities>
         <capabilities>
           <auth-method>multiple-cert</auth-method>
         </capabilities>
       </config-auth>

What Cisco clients appear to send is a *single* '<capabilities>' tag
containing multiple '<auth-method>', as shown in the MITM capture in the
comments of
f51ecb36bedcd370086586295978627daeabade4 ("Converse the multiple certificate authentication (multicert) protocol."),
which introduced this structural mistake.

With the non-repeated '<capabilities>' tag, we can also fix the multicert
auth tests, where the check that the client was offering multicert was
disabled in
45da3b07dfc8f808e7b0d0bf80fbf7e73b1b0721 ("fake-cisco-server.py: Disable check for `multiple-cert` support"),
probably due to confusion over the XML structure and xmltodict's handling
of it.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoMerge branch 'DWORD_PRId32_PRIo32' into 'master'
David Woodhouse [Wed, 20 Apr 2022 15:54:20 +0000 (15:54 +0000)]
Merge branch 'DWORD_PRId32_PRIo32' into 'master'

MinGW warning: the format specifier for DWORD is "%lu"

Closes #365

See merge request openconnect/openconnect!361

3 years agoMerge branch 'field_precision_specifier_expects_int' into 'master'
David Woodhouse [Wed, 20 Apr 2022 15:54:01 +0000 (15:54 +0000)]
Merge branch 'field_precision_specifier_expects_int' into 'master'

MinGW warning: field precision specifier '.*' expects argument of type 'int'

See merge request openconnect/openconnect!362

3 years agoThe format specifier for uint64_t is PRIu64
Dimitri Papadopoulos [Wed, 20 Apr 2022 11:22:04 +0000 (13:22 +0200)]
The format specifier for uint64_t is PRIu64

Switch from PRId64 (int64_t) to PRIu64 (uint64_t).

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoThe format specifier for DWORD is "%lu"
Dimitri Papadopoulos [Wed, 20 Apr 2022 10:43:06 +0000 (12:43 +0200)]
The format specifier for DWORD is "%lu"

DWORD is unsigned, so PRIu32 would be the proper format specifier for
DWORD, not PRId32. Except DWORD is defined as 'unsigned long int', while
PRIu32 is defined as u, and "%u" is the format specifier for 'unsigned int'.

What a mess! It looks like the only viable format specifier is "%lu".

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoFix MinGW compiler warning
Dimitri Papadopoulos [Wed, 20 Apr 2022 11:22:04 +0000 (13:22 +0200)]
Fix MinGW compiler warning

The compiler warning is:
field precision specifier '.*' expects argument of type 'int'

So we cast '(c - _pgmptr + 1)' from ptrdiff_t (long long int) to int.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoMerge branch 'align' into 'master'
David Woodhouse [Wed, 20 Apr 2022 10:16:16 +0000 (10:16 +0000)]
Merge branch 'align' into 'master'

Align output of openconnect --help

See merge request openconnect/openconnect!360

3 years agoAlign output of openconnect --help
Dimitri Papadopoulos [Tue, 19 Apr 2022 17:14:35 +0000 (19:14 +0200)]
Align output of openconnect --help

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoUse 'open' to spawn browser on OSX
David Woodhouse [Mon, 18 Apr 2022 21:37:05 +0000 (22:37 +0100)]
Use 'open' to spawn browser on OSX

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'master' of gitlab.com:openconnect/openconnect
David Woodhouse [Mon, 18 Apr 2022 19:32:49 +0000 (20:32 +0100)]
Merge branch 'master' of gitlab.com:openconnect/openconnect

3 years agoImport translations from GNOME
David Woodhouse [Mon, 18 Apr 2022 19:32:09 +0000 (20:32 +0100)]
Import translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'vhost-portable' of gitlab.com:openconnect/openconnect
David Woodhouse [Mon, 18 Apr 2022 14:42:06 +0000 (15:42 +0100)]
Merge branch 'vhost-portable' of gitlab.com:openconnect/openconnect

3 years agoAttempt to make posix_spawn() work on OSX
David Woodhouse [Mon, 18 Apr 2022 14:38:57 +0000 (15:38 +0100)]
Attempt to make posix_spawn() work on OSX

Fixes: #409
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'obs' into 'master'
David Woodhouse [Sat, 16 Apr 2022 07:55:34 +0000 (07:55 +0000)]
Merge branch 'obs' into 'master'

OBS: remove ancient requires on vpnc from RPM

See merge request openconnect/openconnect!359

3 years agoFix hogweed/gmp library linkage for HPKE by actually using $(HPKE_LIBS)
David Woodhouse [Sat, 16 Apr 2022 06:25:29 +0000 (07:25 +0100)]
Fix hogweed/gmp library linkage for HPKE by actually using $(HPKE_LIBS)

I can't type HPKE or HKDF reliably. Fix a different random combination of
letters that escaped my fingers.

Fixes: 02ca865d ("Add GnuTLS crypto support for HPKE") and hopefully #409
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoImport translations from GNOME
David Woodhouse [Fri, 15 Apr 2022 19:46:41 +0000 (20:46 +0100)]
Import translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoReduce the 'bus factor' for translation sync a bit
David Woodhouse [Fri, 15 Apr 2022 12:25:46 +0000 (13:25 +0100)]
Reduce the 'bus factor' for translation sync a bit

This is mostly just what NMo's import-strings.sh does, but now
it's a bit more obvious and accessible for other OpenConnect
developers.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoOBS: remove ancient requires on vpnc from RPM
Luca Boccassi [Thu, 14 Apr 2022 18:52:53 +0000 (20:52 +0200)]
OBS: remove ancient requires on vpnc from RPM

Signed-off-by: Luca Boccassi <bluca@debian.org>
3 years agoIncrease server delay for fake server tests
David Woodhouse [Thu, 14 Apr 2022 15:36:31 +0000 (16:36 +0100)]
Increase server delay for fake server tests

Doesn't look like 1 second is enough of a delay in all cases.
Increase it and hopefully the tests will stop being so flaky.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'obs' of gitlab.com:bluca/openconnect
David Woodhouse [Thu, 14 Apr 2022 15:26:57 +0000 (16:26 +0100)]
Merge branch 'obs' of gitlab.com:bluca/openconnect

3 years agoMerge branch 'errors' into 'master'
David Woodhouse [Thu, 14 Apr 2022 15:24:28 +0000 (15:24 +0000)]
Merge branch 'errors' into 'master'

Fix Linux kernel coding style error and warnings reported by checkpatch.pl

See merge request openconnect/openconnect!357

3 years agoobs: remove libpskc-dev dependency from libopenconnect-dev
Luca Boccassi [Thu, 14 Apr 2022 13:57:12 +0000 (15:57 +0200)]
obs: remove libpskc-dev dependency from libopenconnect-dev

It is not available on older Ubuntu releases, it is only needed to make
pkg-config work correctly, but it can be installed manually

Signed-off-by: Luca Boccassi <bluca@debian.org>