]> www.infradead.org Git - users/dwmw2/openconnect.git/log
users/dwmw2/openconnect.git
3 years agoAdd cancellable_accept(), make cancellable_send() take a const buffer
David Woodhouse [Sat, 9 Apr 2022 21:45:49 +0000 (22:45 +0100)]
Add cancellable_accept(), make cancellable_send() take a const buffer

These will be needed for AnyConnect 'external browser' SAML mode.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoAnyConnect: Generate EC keys for X-AnyConnect-STRAP-{DH-,}Pubkey
David Woodhouse [Thu, 7 Apr 2022 21:22:36 +0000 (22:22 +0100)]
AnyConnect: Generate EC keys for X-AnyConnect-STRAP-{DH-,}Pubkey

These are needed for the external browser SAML support.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'remove_unnecessary_struct_member_to_quiet_Coverity' into 'master'
David Woodhouse [Mon, 11 Apr 2022 09:57:43 +0000 (09:57 +0000)]
Merge branch 'remove_unnecessary_struct_member_to_quiet_Coverity' into 'master'

Remove repeated flexible array member which is confusing Coverity

See merge request openconnect/openconnect!341

3 years agoMerge branch 'no_MTU_setting_in_openconnect_itself' into 'master'
David Woodhouse [Sun, 10 Apr 2022 20:48:09 +0000 (20:48 +0000)]
Merge branch 'no_MTU_setting_in_openconnect_itself' into 'master'

Don't try to set MTU on tunnel interface within (lib)openconnect itself

See merge request openconnect/openconnect!195

3 years agoMerge branch 'code_climate_deepsource' into 'master'
David Woodhouse [Sun, 10 Apr 2022 20:45:48 +0000 (20:45 +0000)]
Merge branch 'code_climate_deepsource' into 'master'

Improve code for future maintenance

Closes #342 and #341

See merge request openconnect/openconnect!303

3 years agoMerge branch 'const_char' into 'master'
David Woodhouse [Sun, 10 Apr 2022 20:38:56 +0000 (20:38 +0000)]
Merge branch 'const_char' into 'master'

Declare C string constants using array syntax

See merge request openconnect/openconnect!309

3 years agoMerge branch 'cast_char' into 'master'
David Woodhouse [Sun, 10 Apr 2022 14:06:37 +0000 (14:06 +0000)]
Merge branch 'cast_char' into 'master'

Do not cast `const char *` to `char *`

See merge request openconnect/openconnect!312

3 years agoMerge branch 'free_const_char' into 'master'
David Woodhouse [Sun, 10 Apr 2022 14:06:04 +0000 (14:06 +0000)]
Merge branch 'free_const_char' into 'master'

Silence compiler warnings [-Wdiscarded-qualifiers]

See merge request openconnect/openconnect!316

3 years agoMerge branch 'vpn_progress_wintun_version' into 'master'
David Woodhouse [Sun, 10 Apr 2022 14:04:46 +0000 (14:04 +0000)]
Merge branch 'vpn_progress_wintun_version' into 'master'

Silence compiler warning [-Wformat=]

See merge request openconnect/openconnect!317

3 years agoMerge branch 'gai_strerror' into 'master'
David Woodhouse [Sun, 10 Apr 2022 14:01:02 +0000 (14:01 +0000)]
Merge branch 'gai_strerror' into 'master'

Win32: gai_strerror → WSAGetLastError

See merge request openconnect/openconnect!322

3 years agoMerge branch 'sigaction' into 'master'
David Woodhouse [Sun, 10 Apr 2022 13:57:48 +0000 (13:57 +0000)]
Merge branch 'sigaction' into 'master'

Check return value of sigaction()

See merge request openconnect/openconnect!318

3 years agoMerge branch 'obs' into 'master'
David Woodhouse [Sun, 10 Apr 2022 13:54:02 +0000 (13:54 +0000)]
Merge branch 'obs' into 'master'

Add packaging and configuration files for OBS build

See merge request openconnect/openconnect!342

3 years agoMerge branch 'dump_buf_hex_performance' into 'master'
David Woodhouse [Sun, 10 Apr 2022 13:53:23 +0000 (13:53 +0000)]
Merge branch 'dump_buf_hex_performance' into 'master'

Skip dump_buf_hex() when the log level is low enough

Closes #395

See merge request openconnect/openconnect!348

3 years agoMerge branch 'man' into 'master'
David Woodhouse [Sun, 10 Apr 2022 13:51:09 +0000 (13:51 +0000)]
Merge branch 'man' into 'master'

Consistency in man page

See merge request openconnect/openconnect!350

3 years agoMerge branch 'reconnection_report_PRG_ERROR' into 'master'
David Woodhouse [Sun, 10 Apr 2022 13:50:41 +0000 (13:50 +0000)]
Merge branch 'reconnection_report_PRG_ERROR' into 'master'

Adjust verbosity level of Fortinet-related logging

Closes #402

See merge request openconnect/openconnect!352

3 years agoMerge branch 'master' into 'master'
David Woodhouse [Sun, 10 Apr 2022 13:50:14 +0000 (13:50 +0000)]
Merge branch 'master' into 'master'

Set loglevel as soon as it's known

Closes #401

See merge request openconnect/openconnect!351

3 years agoSilence compiler warnings [-Wdiscarded-qualifiers]
Dimitri Papadopoulos [Wed, 29 Dec 2021 13:10:53 +0000 (14:10 +0100)]
Silence compiler warnings [-Wdiscarded-qualifiers]

It's just a quirk that free takes non-const: it doesn't actually modify
the value pointed to, either conceptually or in practice, it merely looks
up the memory block using the pointer and deallocates it.

Unfortunately, the compiler will emit  warning when attempting to free()
a "const char *". So either switch to a pointer to non-const or cast to
(void *) when calling free() on a pointer to const.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoAdjust verbosity level of Fortinet-related logging
Dimitri Papadopoulos [Wed, 6 Apr 2022 07:49:30 +0000 (09:49 +0200)]
Adjust verbosity level of Fortinet-related logging

iBecause these messages do not convey an actual error status,
use PRG_INFO instead of PRG_ERR.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoDeclare C string constants using array syntax
Dimitri Papadopoulos [Wed, 8 Dec 2021 20:07:00 +0000 (21:07 +0100)]
Declare C string constants using array syntax

Avoid pointer syntax when possible.

They are different, the array syntax generates smaller, faster code.

See for example:
https://eklitzke.org/declaring-c-string-constants-the-right-way

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoNo need to cast `const char *` to `char *`
Dimitri Papadopoulos [Tue, 21 Dec 2021 14:24:59 +0000 (15:24 +0100)]
No need to cast `const char *` to `char *`

Function openconnect_vpninfo_new() expects a `const char *`, so why cast
the string literal to `char *`?

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoSkip dump_buf_hex() when the log level is low enough
Dimitri Papadopoulos [Sat, 26 Mar 2022 20:12:56 +0000 (21:12 +0100)]
Skip dump_buf_hex() when the log level is low enough

This is a performance fix.

Indeed, dump_buf_hex() is heavy enough to significantly slow down
OpenConnect. So avoid calling dump_buf_hex() when the log level does
not require it.

Before this patch, the whole body of dump_buf_hex() was executed,
even when vpn_progress() wouldn't print anything.

Same for dump_buf(), although the performance hit is less important.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agostoken: Fix const warnings
David Woodhouse [Wed, 6 Apr 2022 15:47:59 +0000 (16:47 +0100)]
stoken: Fix const warnings

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoesp: Close socket on error
David Woodhouse [Wed, 6 Apr 2022 15:43:42 +0000 (16:43 +0100)]
esp: Close socket on error

Previously we would just keep trying to read from it and consume all CPU.

Fixes: 389 (hopefully)
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoepoll: Handle EPOLLERR as 'readable'
David Woodhouse [Wed, 6 Apr 2022 15:42:09 +0000 (16:42 +0100)]
epoll: Handle EPOLLERR as 'readable'

When we use select(), an error event on a file descriptor causes it to
be reported as readable, and some of the handlers will only clean it up
if that happens. So set the 'readable' flag on EPOLLERR too.

This is part of #389.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoSet loglevel as soon as it's known
Maxim Storchak [Tue, 5 Apr 2022 10:23:06 +0000 (13:23 +0300)]
Set loglevel as soon as it's known

Fixes #401

Signed-off-by: Maxim Storchak <m.storchak@gmail.com>
3 years agoConsistency in man page
Dimitri Papadopoulos [Tue, 5 Apr 2022 05:28:25 +0000 (07:28 +0200)]
Consistency in man page

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoSilence compiler warning [-Wformat=]
Dimitri Papadopoulos [Wed, 29 Dec 2021 13:30:05 +0000 (14:30 +0100)]
Silence compiler warning [-Wformat=]

Because ver is a DWORD, the major and minor components of the version
are also DWORD (unsigned long) and should be printed with "%lu".

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoFix --reconnect-timeout documentation
Dimitri Papadopoulos [Tue, 29 Mar 2022 09:26:11 +0000 (11:26 +0200)]
Fix --reconnect-timeout documentation

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoMerge branch 'fix_388' into 'master'
Luca Boccassi [Mon, 14 Mar 2022 22:37:17 +0000 (22:37 +0000)]
Merge branch 'fix_388' into 'master'

Bugfix RSA SecurID token decryption and PIN entry forms

Closes #388

See merge request openconnect/openconnect!344

3 years agoFix GP fake server parameters so that gateway-interface 2FA is actually tested
Daniel Lenski [Mon, 7 Mar 2022 18:31:13 +0000 (10:31 -0800)]
Fix GP fake server parameters so that gateway-interface 2FA is actually tested

To match the actually-parsed parameters in tests/fake-gp-server.py, change
'gateway_2fa' → 'gw_2fa'.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoAdd changelog entry
Daniel Lenski [Tue, 8 Mar 2022 19:17:08 +0000 (11:17 -0800)]
Add changelog entry

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoBugfix RSA SecurID token decryption and PIN entry forms
Daniel Lenski [Mon, 7 Mar 2022 16:50:13 +0000 (08:50 -0800)]
Bugfix RSA SecurID token decryption and PIN entry forms

As of
https://gitlab.com/openconnect/openconnect/-/commit/386a6edb6d2d1d2cd3e9c9de8d85dc7bfda60d34,
all auth forms are required to have a non-NULL `auth_id`.

However, we forget to make stoken.c set the `auth_id` for the forms that it
creates for RSA SecurID token decryption and PIN entry.  Let's name these:

  - `_rsa_unlock`, for token decryption.
  - `_rsa_pin`, for PIN entry.  Also, rename the numeric PIN field to `pin`
    rather than `password`; there can't be any existing users relying on
    `--form-entry` to set its value, because that wouldn't work without the
    `auth_id`.

Fixes #388.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoAdd changelog entry
Daniel Lenski [Tue, 8 Mar 2022 19:20:17 +0000 (11:20 -0800)]
Add changelog entry

For 6a2ffbbcd1c4ef0b689cce3d17154f6d4c2e3bc0 ("Fix Windows tun setup crash")

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoStore OBS _service file
Luca Boccassi [Wed, 23 Feb 2022 23:35:28 +0000 (23:35 +0000)]
Store OBS _service file

This has to be added manually to an OBS project, but store it in
git for easier tracking and restoring

Signed-off-by: Luca Boccassi <bluca@debian.org>
3 years agoAdd OBS workflow configuration file
Luca Boccassi [Wed, 23 Feb 2022 23:05:03 +0000 (23:05 +0000)]
Add OBS workflow configuration file

Signed-off-by: Luca Boccassi <bluca@debian.org>
3 years agoAdd packaging files for OBS build
Luca Boccassi [Wed, 23 Feb 2022 22:39:28 +0000 (22:39 +0000)]
Add packaging files for OBS build

Signed-off-by: Luca Boccassi <bluca@debian.org>
3 years agoAdd --enable-docs option
Luca Boccassi [Wed, 2 Mar 2022 16:35:29 +0000 (16:35 +0000)]
Add --enable-docs option

Allow to explicitly disable building documentation. Some
platforms are too old (RHEL 7) and even if Python is available due
to build macros, building documentation fails. Allow to disable it
explicitly.

Signed-off-by: Luca Boccassi <bluca@debian.org>
3 years agoFix Windows tun setup crash
David Woodhouse [Sat, 26 Feb 2022 17:34:26 +0000 (17:34 +0000)]
Fix Windows tun setup crash

The intention was to use vpninfo->hostname, by passing it as a parameter
to the create_ifname_w() function. But that function still just uses
vpninfo->ifname unconditionally, ignoring the argument. And causing the
crash in #370.

Fix up some bogus formatting while we're at it. We don't do open braces
on the same line as the function declaration.

Fixes: 48bd28aadd ("Use hostname as Wintun ifname (if ifname not specified)")
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoDecorate with `@staticmethod` if `self` is not used
Dimitri Papadopoulos [Thu, 9 Dec 2021 10:23:59 +0000 (11:23 +0100)]
Decorate with `@staticmethod` if `self` is not used

Fixes Codacy alert:
Method could be a function

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoCondition `!dtlsver` is true after `else if (dtlsver)`
Dimitri Papadopoulos [Thu, 9 Dec 2021 10:09:09 +0000 (11:09 +0100)]
Condition `!dtlsver` is true after `else if (dtlsver)`

Fixes a Codacy alert:
Condition '!dtlsver' is always false

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoCondition `len>=0` is true after `if (len < 0)`
Dimitri Papadopoulos [Thu, 9 Dec 2021 09:37:33 +0000 (10:37 +0100)]
Condition `len>=0` is true after `if (len < 0)`

Fixes a Codacy alert:
Condition 'len>=0' is always true

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoRemove unused imports
Dimitri Papadopoulos [Thu, 9 Dec 2021 09:24:58 +0000 (10:24 +0100)]
Remove unused imports

This fixes Codacy alerts:
'sys.version_info' imported but unused
'urllib.parse.urlencode' imported but unused

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoAvoid assert statement outside of tests
Dimitri Papadopoulos [Sat, 20 Nov 2021 08:34:14 +0000 (09:34 +0100)]
Avoid assert statement outside of tests

This fixes DeepSource alerts:

Assert statement used outside of tests

Usage of assert statement in application logic is discouraged. assert is
removed with compiling to optimized byte code. Consider raising an
exception instead. Ideally, assert statement should be used only in tests.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoLocal variable redefined argument
Dimitri Papadopoulos [Sat, 20 Nov 2021 08:18:24 +0000 (09:18 +0100)]
Local variable redefined argument

This fixes a DeepSource alert:

Argument redefined from local

A local name is redefining an argument, which might suggest a potential
error. This is taken into account only for a handful of name binding
operations, such as for iterations, with statements, and exception
handler assignments.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoAvoid code complexity
Dimitri Papadopoulos [Wed, 22 Sep 2021 13:40:22 +0000 (15:40 +0200)]
Avoid code complexity

This fixes a CodeClimate alert.

Found and removed a duplicate test in the process.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoAvoid code duplication
Dimitri Papadopoulos [Wed, 22 Sep 2021 20:27:50 +0000 (22:27 +0200)]
Avoid code duplication

This fixes a CodeClimate alert.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoUse `()` and `{}` instead of `list()` and `dict()`
Dimitri Papadopoulos [Fri, 24 Sep 2021 21:31:25 +0000 (23:31 +0200)]
Use `()` and `{}` instead of `list()` and `dict()`

This fixes a DeepSource alert:

Consider using literal syntax to create the data structure

Using the literal syntax can give minor performance bumps compared to
using function calls to create dict, list and tuple.

This is because here, the name dict must be looked up in the global
scope in case it has been rebound. Same goes for the other two types
list() and tuple().

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoOverridden methods should have identical parameters
Dimitri Papadopoulos [Sun, 26 Sep 2021 08:47:01 +0000 (10:47 +0200)]
Overridden methods should have identical parameters

This fixes a DeepSource alert:

Mismatched parameters in overridden method

Python will allow this, but if the overridden method is intended to be
executed from external code, you may want to reconsider this.
Overriding a method without ensuring that both methods accept the
same number and type of parameters has the potential to cause an
error when the overriding method is called with a number of parameters
that is illegal for the overridden method. This violates the Liskov
substitution principle.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoProtect next() calls wit try/except inside generators
Dimitri Papadopoulos [Sun, 26 Sep 2021 12:45:39 +0000 (14:45 +0200)]
Protect next() calls wit try/except inside generators

This fixes a DeepSource alert:

Unguarded next inside generator

Calls to `next()` should be inside `try-except` block.

When the iterator is exhausted, `StopIteration` exception is raised. When
used inside a generator, this can cause unexpected behavior. If not
handled, it will propagate out of the generator causing termination.
PEP-479 has been accepted to fix this problem. It will modify the
behavior of `StopIteration` in generators.

Each call to `next()` should be wrapped in a `try-except` block to explicitly
handle `StopIteration` exceptions.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
 Veuillez saisir le message de validation pour vos modifications. Les lignes

3 years agoSquash two identical `if` branches
Dimitri Papadopoulos [Sun, 26 Sep 2021 13:06:35 +0000 (15:06 +0200)]
Squash two identical `if` branches

This fixes a DeepSource alert:

Branches of the `if` statement have similar implementation

For the highlighted `if` statements, all the `elif`/`else` branches have
the same body as `if`. It is recommended to refactor this snippet.

If the if-chain is performing the same action in every case, it shouldn't
be used there at all.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoDo not use `type` as a variable name
Dimitri Papadopoulos [Sun, 26 Sep 2021 13:15:36 +0000 (15:15 +0200)]
Do not use `type` as a variable name

This fixes a DeepSource alert:

Re-definition found for builtin function

Defining a local variable or function with the same name as a built-in
object makes the built-in object unusable within the current scope and
makes the code prone to bugs.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoFix Linux kernel coding style error and warnings
Dimitri Papadopoulos [Sat, 31 Jul 2021 07:27:11 +0000 (09:27 +0200)]
Fix Linux kernel coding style error and warnings

"foo * bar" should be "foo *bar"
"foo* bar" should be "foo *bar"
"(foo * )" should be "(foo *)"

Use the name ARRAY_SIZE() for a macro (as in Linux kernel).

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoCheck return value of sigaction()
Dimitri Papadopoulos [Thu, 30 Dec 2021 21:35:37 +0000 (22:35 +0100)]
Check return value of sigaction()

It shouldn't fail, but you never know. Check the return value and print
an error message. Yet do not bale out, as OpenConnect might still be
able to create the VPN connection.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoWin32: gai_strerror → WSAGetLastError
Dimitri Papadopoulos [Sat, 1 Jan 2022 19:28:03 +0000 (20:28 +0100)]
Win32: gai_strerror → WSAGetLastError

The Windows Sockets documentation recommends using WSAGetLastError()
instead of gai_strerror(), because the latter is not thread safe:
https://docs.microsoft.com/en-us/windows/win32/winsock/error-codes-errno-h-errno-and-wsagetlasterror-2

Properly decode the output using openconnect__win32_strerror().

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoMake buf_append_utf16le() robust against being passed NULL
David Woodhouse [Sat, 26 Feb 2022 14:55:49 +0000 (14:55 +0000)]
Make buf_append_utf16le() robust against being passed NULL

This should stop the crash in #370 slthough it would be good to know
precisely why it's happening.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoGP SAML: support legacy workflow
Luca Boccassi [Thu, 30 Dec 2021 22:50:09 +0000 (22:50 +0000)]
GP SAML: support legacy workflow

The legacy workflow (with no GUI registering open_webview) can still work,
simply detect whether the callback has been registered or not

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
3 years agoAC SAML: cookies might be empty
Luca Boccassi [Thu, 30 Dec 2021 17:45:22 +0000 (17:45 +0000)]
AC SAML: cookies might be empty

It has been reported that at least with Google's SAML
the error cookie can be present but empty.
Skip over them if so.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
3 years agoAC SAML: do not assume the cookie will be on the final page
Luca Boccassi [Thu, 30 Dec 2021 00:24:30 +0000 (00:24 +0000)]
AC SAML: do not assume the cookie will be on the final page

At least with Google's SAML, the cookie appears before the final page.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
3 years agoGP SAML: handle redirect case
Luca Boccassi [Tue, 12 Oct 2021 15:14:47 +0000 (16:14 +0100)]
GP SAML: handle redirect case

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
3 years agoGP SAML: fix some memory handling
Luca Boccassi [Tue, 12 Oct 2021 15:14:31 +0000 (16:14 +0100)]
GP SAML: fix some memory handling

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
3 years agoDocs: note that GP + SAML is supported by network-manager-openconnect
Luca Boccassi [Tue, 12 Oct 2021 15:13:46 +0000 (16:13 +0100)]
Docs: note that GP + SAML is supported by network-manager-openconnect

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
3 years agostart adding GP SSO support
Daniel Lenski [Tue, 5 Jan 2021 18:47:15 +0000 (10:47 -0800)]
start adding GP SSO support

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agosplit OC_FORM_OPT_SSO into _TOKEN and _USER versions, and don't open_webview until...
Daniel Lenski [Tue, 5 Jan 2021 18:44:12 +0000 (10:44 -0800)]
split OC_FORM_OPT_SSO into _TOKEN and _USER versions, and don't open_webview until after "normal" form processing

OC_FORM_OPT_SSO_USER will be needed for GlobalProtect SSO.

See https://gitlab.com/openconnect/openconnect/-/merge_requests/75#note_478078985
for why we (might )need to process the "normal" form fields before handling
the SSO parts.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoopenconnect_open_webview_vfn should return int, and accept callback data
Daniel Lenski [Tue, 5 Jan 2021 18:50:40 +0000 (10:50 -0800)]
openconnect_open_webview_vfn should return int, and accept callback data

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agomake .sso_detect_done a protocol-specific VFN, and use in openconnect_webview_load_ch...
Daniel Lenski [Tue, 5 Jan 2021 18:40:39 +0000 (10:40 -0800)]
make .sso_detect_done a protocol-specific VFN, and use in openconnect_webview_load_changed

Also changes the "keep going" return value to -EAGAIN.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoSupport AnyConnect single-sign-on-v2
Steven Walter [Wed, 18 Mar 2020 16:36:25 +0000 (12:36 -0400)]
Support AnyConnect single-sign-on-v2

Advertise support for auth-method single-sign-on-v2.  This, combined
with not sending X-AnyConnect-Platform and X-Support-HTTP-Auth, allows
one to complete a web-based SSO authentication.  Server replies with a
response like:

    <?xml version="1.0" encoding="UTF-8"?>
    <config-auth client="vpn" type="auth-request" aggregate-auth-version="2">
    <opaque is-for="sg">
    <tunnel-group>standard-group</tunnel-group>
    <auth-method>single-sign-on-v2</auth-method>
    <group-alias>Anyconnect</group-alias>
    <config-hash>1584128676139</config-hash>
    </opaque>
    <auth id="main">
    <title>Login</title>
    <message>Please complete the authentication process in the AnyConnect Login window.</message>
    <banner></banner>
    <sso-v2-login>https://SERVER_NAME/+CSCOE+/saml/sp/login?tgname=standard-group&#x26;acsamlcap=v2</sso-v2-login>
    <sso-v2-login-final>https://SERVER_NAME/+CSCOE+/saml_ac_login.html</sso-v2-login-final>
    <sso-v2-token-cookie-name>acSamlv2Token</sso-v2-token-cookie-name>
    <sso-v2-error-cookie-name>acSamlv2Error</sso-v2-error-cookie-name>
    <form>
    <input type="sso" name="sso-token"></input>
    <select name="group_list" label="GROUP:">
    <option selected="true">Anyconnect</option>
    </select>
    </form>
    </auth>
    </config-auth>

If either X-AnyConnect-Platform or X-Support-HTTP-Auth is present, then
this response is not received, and a 302 redirect to the "standard" auth
flow is given.  However, this auth flow does not work on my VPN server;
presumably it is administratively disabled.

Once you get the above response, you can open the URL from sso-v2-login
in an HTML viewer and complete the steps.  This requires an openconnect
front-end that supports the open_webview callback.  Eventually you end
up at the URL from sso-v2-login-final, and then you can extract the
cookie with the name in sso-v2-token-cookie-name (acSamlv2Token, in this
case).

Neither samlwebcookie nor openconnect-sso, mentioned in #84, worked for
me.

Signed-off-by: Steven Walter <steven@stevenwalter.org>
Co-authored-by: Luca Boccassi <luca.boccassi@microsoft.com>
3 years agoTag version 8.20 v8.20
David Woodhouse [Sun, 20 Feb 2022 18:42:32 +0000 (18:42 +0000)]
Tag version 8.20

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoFix EXTRA_DIST for ocserv config files
David Woodhouse [Sun, 20 Feb 2022 17:06:07 +0000 (17:06 +0000)]
Fix EXTRA_DIST for ocserv config files

We need to include the .config.in file in the tarball, not the file
that is generated from it. Not entirely show how this ever worked,
but some of the messing with how it's autogenerated has caused it
to hard-code usernames from my build/ship system in the tarballs
and cause koji builds to fail with unknown users in the config.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoAvoid printing spurious ENOENT error from EPOLL_CTL_DEL
David Woodhouse [Sun, 20 Feb 2022 16:38:37 +0000 (17:38 +0100)]
Avoid printing spurious ENOENT error from EPOLL_CTL_DEL

In openconnect_close_https() we always unmonitor the ssl_fd even if we are
still in the auth phase and hadn't actually monitored it yet. I think I'd
like to keep track of that better, with a flag to explicitly keep track
of whether a given fd is registered. Or maybe abusing a high bit of the
existing vpninfo->XXX_epoll variables that already keep state.

For the imminent release though, let's take the simple approach and just
ignore the harmless error. Not pretty, but safer.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoResync translations with sources
David Woodhouse [Sun, 20 Feb 2022 15:20:30 +0000 (15:20 +0000)]
Resync translations with sources

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoUpdate translations from GNOME
David Woodhouse [Sun, 20 Feb 2022 15:18:58 +0000 (15:18 +0000)]
Update translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'wip/dueno/tss2-rc' of gitlab.com:dueno/openconnect
David Woodhouse [Sun, 20 Feb 2022 15:09:47 +0000 (15:09 +0000)]
Merge branch 'wip/dueno/tss2-rc' of gitlab.com:dueno/openconnect

3 years agoRemove repeated flexible array member which is confusing Coverity
Daniel Lenski [Thu, 17 Feb 2022 16:34:17 +0000 (08:34 -0800)]
Remove repeated flexible array member which is confusing Coverity

A recent Coverity Scan run is complaining about buffer overruns
when accessing the `esp` header member of `struct pkt`:

> CID 379245:  Memory - corruptions  (OVERRUN)
> Overrunning struct type <unnamed> of 24 bytes by passing it to a function which accesses it at byte offset 25 using argument "len" (which evaluates to 26).

The unnecessary and duplicated `esp.payload` member of `struct pkt` appears
to be the source of confusion:

    struct pkt {
            int alloc_len;
            int len;
            struct pkt *next;
            union {
                    struct {
                            uint32_t spi;
                            uint32_t seq;
                            unsigned char iv[16];
                            unsigned char payload[];
                    } esp;
                    /* ...
                     * other protocols' packet headers
                     * ...
                     */

            };
            unsigned char data[];
    };

It's a flexible array member (`payload[]`), within a union, within a struct
that has another flexible array member (`data[]`); for how these are
supposed to work, see https://en.wikipedia.org/wiki/Flexible_array_member.

The `payload` member is both unused and unnecessary. Let's just remove it.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agohtml.py must run with either Python 2 or 3 to support COPR builds
Dimitri Papadopoulos [Fri, 4 Feb 2022 16:26:52 +0000 (17:26 +0100)]
html.py must run with either Python 2 or 3 to support COPR builds

The script starts with `#!/usr/bin/env python3` but COPR builds run it as
`/usr/bin/python2 "./html.py"`. In the long term we should phase out Python
2 and make sure Python 3 is used everywhere.  In the short term, let's
repair COPR builds first, then plan the Python 2 to 3 transition.

This reverts e83b646f.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoMerge branch 'tmp-fedora35' into 'master'
Daniel Lenski [Thu, 17 Feb 2022 18:13:35 +0000 (18:13 +0000)]
Merge branch 'tmp-fedora35' into 'master'

Move CI to fedora35

See merge request openconnect/openconnect!340

3 years agoMerge branch 'spelling' into 'master'
Nikos Mavrogiannopoulos [Sun, 13 Feb 2022 12:12:12 +0000 (12:12 +0000)]
Merge branch 'spelling' into 'master'

Spelling

See merge request openconnect/openconnect!311

3 years ago.gitlab-ci.yml: removed legacy references to rdrand
Nikos Mavrogiannopoulos [Sat, 12 Feb 2022 20:52:54 +0000 (21:52 +0100)]
.gitlab-ci.yml: removed legacy references to rdrand

These apply both to F35 and current F34 image.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
3 years ago.gitlab-ci.yml: remove unnecessary installations
Nikos Mavrogiannopoulos [Sat, 12 Feb 2022 20:46:54 +0000 (21:46 +0100)]
.gitlab-ci.yml: remove unnecessary installations

swtpm is now part of the CI image.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
3 years ago.gitlab-ci.yml: build on fedora35
Nikos Mavrogiannopoulos [Sat, 12 Feb 2022 19:33:13 +0000 (20:33 +0100)]
.gitlab-ci.yml: build on fedora35

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
3 years agoFix typos not found by codespell
Dimitri Papadopoulos [Sat, 12 Feb 2022 10:12:24 +0000 (11:12 +0100)]
Fix typos not found by codespell

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoUse ARRAY_SIZE(array) macro instead of hard-coded sizeof(array)/N
Dimitri Papadopoulos [Tue, 18 Jan 2022 08:30:14 +0000 (09:30 +0100)]
Use ARRAY_SIZE(array) macro instead of hard-coded sizeof(array)/N

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoIn dumb_socketpair(), delete Unix-domain socket path once no longer needed
Daniel Lenski [Thu, 3 Feb 2022 22:12:17 +0000 (14:12 -0800)]
In dumb_socketpair(), delete Unix-domain socket path once no longer needed

Small follow-up improvement to
https://gitlab.com/openconnect/openconnect/-/merge_requests/320, which made
dumb_socketpair() able to use Unix-domain sockets, on those Windows versions
that support them albeit only with named paths.

This was suggested as a way to prevent the Windows dumb_socketpair()
implementation from leaving behind size-0 files, even if normally only in
temporary directories.

See original suggestion at
https://github.com/microsoft/WSL/issues/4240#issuecomment-1027607891.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agolibopenconnect: add public interface stubs for SAML support
Luca Boccassi [Wed, 18 Mar 2020 16:36:25 +0000 (12:36 -0400)]
libopenconnect: add public interface stubs for SAML support

The SAML support is still work in progress and not merged yet.
Start adding the new public API to libopenconnect, so that
distributions can choose to ship with out-of-tree support to
let their users have the feature without breaking ABI
compatibility.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
Co-authored-by: Steven Walter <steven@stevenwalter.org>
3 years agoMerge branch 'pulse_IPv6_docs' into 'master'
Daniel Lenski [Thu, 10 Feb 2022 23:49:15 +0000 (23:49 +0000)]
Merge branch 'pulse_IPv6_docs' into 'master'

update Pulse, F5, Fortinet docs and diagnostic messages

See merge request openconnect/openconnect!272

3 years agoClarify Fortinet no-valid-cookie error paths
Daniel Lenski [Wed, 1 Sep 2021 00:49:27 +0000 (17:49 -0700)]
Clarify Fortinet no-valid-cookie error paths

When requesting connection options in XML format…

1. A redirect indicates invalid cookie only if it is to /remote/login
2. A 403 followed by a fetch of the HTML format connection options
   indicates an ancient FortiOS version only if the HTML fetch is actually
   *successful* (200)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoPrint warning if Fortinet server doesn't indicate support/no-support for reconnect...
Daniel Lenski [Tue, 31 Aug 2021 23:44:52 +0000 (16:44 -0700)]
Print warning if Fortinet server doesn't indicate support/no-support for reconnect-after-drop

FortiGate v6.2.1 and newer appear to support reconnect-after-drop without
reauth, but only if the tag and attribute
'<auth-ses tun-connect-without-reauth="1">' are present in the config.  As
of https://gitlab.com/openconnect/openconnect/-/merge_requests/292, we print
and act on this information.

We should also request feedback from users of Fortinet VPNs which don't
explicitly advertise either allowing or disallowing it.

See discussion at
https://gitlab.com/openconnect/openconnect/-/issues/297#note_664686767

Also, print the 'mr_num' field which is apparently part of some newer
Fortinet servers' version information.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoMention support for DTLSv1.2 in F5 BIG-IP v16 or newer
Daniel Lenski [Tue, 31 Aug 2021 23:30:36 +0000 (16:30 -0700)]
Mention support for DTLSv1.2 in F5 BIG-IP v16 or newer

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoPrint Pulse server's IPv6 internal gateway address (in addition to Legacy IP)
Daniel Lenski [Mon, 30 Aug 2021 04:41:12 +0000 (21:41 -0700)]
Print Pulse server's IPv6 internal gateway address (in addition to Legacy IP)

The existence of this attribute was noted in
https://gitlab.com/openconnect/openconnect/-/issues/254#note_595455571.  As
with its Legacy IP equivalent, an IPv6 "gateway" address is superfluous and
unnecessary for a tunnel connection.

Known Pulse servers consistently send an IPv6 internal gateway address which
falls in the fc00::/7 range of "unique local addresses"
(https://en.wikipedia.org/wiki/Unique_local_address), as in this example:

    $ openconnect -vv pulse.vpn.com
    ...
    Received internal Legacy IP address 10.200.200.2
    Received netmask 255.255.255.255
    Received internal gateway address 10.200.200.200        (Legacy IP)
    Received internal IPv6 address 2001:abc:123:4::567/128
    Received internal gateway IPv6 address fd00::ac8:c8c8   (IPv6)
    Received IPv6 split include ::/0

This patch also *renames* the 'cstp_options' entry for the Legacy IP gateway
address (was 'ipaddr', changed to 'gateway') so that any front-end which
uses this list won't confuse it with the VPN interface's assigned Legacy IP
address (which is named 'ipaddr' for all currently-supported protocols).

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoMention that some Pulse VPNs need to spoof official UA/OS to make IPv6 work
Daniel Lenski [Thu, 26 Aug 2021 19:43:54 +0000 (12:43 -0700)]
Mention that some Pulse VPNs need to spoof official UA/OS to make IPv6 work

As discussed in https://gitlab.com/openconnect/openconnect/-/issues/254#note_661398964

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoRemove already-disabled code copied from oncp.c into pulse.c
Daniel Lenski [Tue, 31 Aug 2021 23:15:25 +0000 (16:15 -0700)]
Remove already-disabled code copied from oncp.c into pulse.c

Also removes a comment about an unhandled field which is, in fact, already
handled (0x000f → IPv6 split-include).

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoPulse IPv6 is now known to work on real-world servers
Daniel Lenski [Thu, 26 Aug 2021 19:42:16 +0000 (12:42 -0700)]
Pulse IPv6 is now known to work on real-world servers

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoPrint detailed error information when opening cmd pipe/socketpair fails
Dimitri Papadopoulos [Sat, 25 Dec 2021 21:28:54 +0000 (22:28 +0100)]
Print detailed error information when opening cmd pipe/socketpair fails

Retrieve and print detailed information using GetLastError() and
strerror().

This should be more useful to end-users than the current message (simply
“Error opening cmd pipe”) and might have helped us to solve
https://gitlab.com/openconnect/openconnect/-/issues/228 more quickly.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoMerge branch 'pulse-config-on-9.1' into 'master'
Daniel Lenski [Mon, 7 Feb 2022 21:28:18 +0000 (13:28 -0800)]
Merge branch 'pulse-config-on-9.1' into 'master'

Pulse 9.1R14: handle 0x2e20f000 main configuration packet

Closes #58, #98, and #379

See merge request openconnect/openconnect!331

3 years agoUpdate changelog
Daniel Lenski [Mon, 7 Feb 2022 16:53:14 +0000 (08:53 -0800)]
Update changelog

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoPulse: handle 0x2e20f000 main configuration packet
David Overton [Fri, 28 Jan 2022 23:35:49 +0000 (23:35 +0000)]
Pulse: handle 0x2e20f000 main configuration packet

This packet type was received upon attempting to connect to a
Pulseb 9.1R14 server (with IPv6 enabled, though this may not
be relevant).

Upon receiving this packet we previously bailed out and failed
back to the user with:

    Unexpected IF-T/TLS packet when expecting configuration

The "new" config packet packs what appears to be a second
attributes section in front of the legacy routing block. It
is not yet clear what the single example attribute seen so
far (0x4025) is for (perhaps it is to indicate the presence
or absence of the legacy routing block?).

We now have two other reports that this fixes
https://gitlab.com/openconnect/openconnect/-/issues/379, allowing other
users to connect to Pulse 9.1R14 servers as well:

- https://gitlab.com/openconnect/openconnect/-/issues/379#note_833921090
- https://gitlab.com/openconnect/openconnect/-/issues/379#note_834059102

[ DL tweaked length checks and comments ]

Signed-off-by: David Overton <therealdave32@gmail.com>
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoFix memory leak in pulse.c
Daniel Lenski [Mon, 7 Feb 2022 02:01:41 +0000 (18:01 -0800)]
Fix memory leak in pulse.c

This issue was hidden by the oversight of Legacy IPv4 split routes in
3d845bc9b, which was subsequently fixed in
https://gitlab.com/openconnect/openconnect/-/merge_requests/330 / 52d1c674.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoBugfix Legacy IP split include/exclude routes for Pulse
David Overton [Fri, 28 Jan 2022 22:49:46 +0000 (22:49 +0000)]
Bugfix Legacy IP split include/exclude routes for Pulse

In 3d845bc9b, routing configuration was modified to use the `new_ip_info`
and `install_vpn_opts()`.  Pulse IPv6 split include/exclude handling were
modified accordingly in that commit, but Legacy IP split include/exclude
routes were overlooked.

Since `install_vpn_opts()` clobbers the split include/exclude routes, this
means Legacy IP split routes for Pulse have been ignored since then.

Closes https://gitlab.com/openconnect/openconnect/-/merge_requests/330

Signed-off-by: David Overton <therealdave32@gmail.com>
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
3 years agoUpdate translations from GNOME
David Woodhouse [Tue, 1 Feb 2022 10:02:09 +0000 (10:02 +0000)]
Update translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'doc_updates' into 'master'
Daniel Lenski [Sun, 30 Jan 2022 23:21:21 +0000 (23:21 +0000)]
Merge branch 'doc_updates' into 'master'

Documentation updates

See merge request openconnect/openconnect!327

3 years agoAdd jq as a build dependency to fix COPR builds
Dimitri Papadopoulos [Sat, 29 Jan 2022 16:35:27 +0000 (17:35 +0100)]
Add jq as a build dependency to fix COPR builds

OpenConnect is cross-compiled directly from Fedora in COPR builds, so
this build dependency is a native Fedora package.

The dependency on 'jq' was introduced in b8f79ce9, and the resulting
brokenness of the COPR builds was noted in
https://gitlab.com/openconnect/openconnect/-/issues/286#note_825611200

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