]> www.infradead.org Git - users/dwmw2/openconnect.git/log
users/dwmw2/openconnect.git
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 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 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>
3 years agoobs workflow: add xdg-utils build-dep on openconnect.dsc too
Luca Boccassi [Thu, 14 Apr 2022 11:30:52 +0000 (13:30 +0200)]
obs workflow: add xdg-utils build-dep on openconnect.dsc too

Due to <reasons> we need to duplicate the list of build deps for Debian builds.

https://gitlab.com/openconnect/openconnect/-/commit/9b5a9e004af579bd3b24e115061fb99c94504bce
added this package to .obs/debian/control, also add it to .obs/openconnect.dsc

Signed-off-by: Luca Boccassi <bluca@debian.org>
3 years agoMerge branch 'insecure-openssl' into 'master'
David Woodhouse [Wed, 13 Apr 2022 08:05:23 +0000 (08:05 +0000)]
Merge branch 'insecure-openssl' into 'master'

openssl: allow ALL ciphers when allow-insecure-crypto is enabled

See merge request openconnect/openconnect!355

3 years agoFix Linux kernel coding style error and warnings
Dimitri Papadopoulos [Tue, 12 Apr 2022 19:31:01 +0000 (21:31 +0200)]
Fix Linux kernel coding style error and warnings

open brace '{' following struct go on the same line
open brace '{' following function definitions go on the next line

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

quoted string split across lines

please, no space before tabs
Statements should start on a tabstop

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
3 years agoMerge branch 'master' of gitlab.com:openconnect/openconnect
David Woodhouse [Tue, 12 Apr 2022 13:07:34 +0000 (15:07 +0200)]
Merge branch 'master' of gitlab.com:openconnect/openconnect

3 years agoAdd xdg-utils for xdg-open (default external browser)
David Woodhouse [Tue, 12 Apr 2022 13:05:12 +0000 (15:05 +0200)]
Add xdg-utils for xdg-open (default external browser)

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'errors' into 'master'
David Woodhouse [Tue, 12 Apr 2022 10:04:54 +0000 (10:04 +0000)]
Merge branch 'errors' into 'master'

Improve error reporting

See merge request openconnect/openconnect!319

3 years agofake-cisco-server.py: Disable check for `multiple-cert` support
David Woodhouse [Tue, 12 Apr 2022 09:56:26 +0000 (11:56 +0200)]
fake-cisco-server.py: Disable check for `multiple-cert` support

Now we support SSO, there are *multiple* auth-method nodes, not just one.
We should check that *one* of them contains 'multiple-cert'. Comment it
out for now.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoMerge branch 'multicert' of gitlab.com:openconnect/openconnect
David Woodhouse [Tue, 12 Apr 2022 09:05:46 +0000 (11:05 +0200)]
Merge branch 'multicert' of gitlab.com:openconnect/openconnect

3 years agoMerge branch 'obs' into 'master'
David Woodhouse [Tue, 12 Apr 2022 07:44:53 +0000 (07:44 +0000)]
Merge branch 'obs' into 'master'

obs workflow: rebuild on each push/merge to master

See merge request openconnect/openconnect!356

3 years agoFix translations mangled by sed
David Woodhouse [Mon, 11 Apr 2022 15:27:42 +0000 (17:27 +0200)]
Fix translations mangled by sed

Ah, the replacement didn't work when the translations were line-wrapped.
Or in the case where the translation didn't include the address at all!

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoUpdate translations from GNOME
David Woodhouse [Mon, 11 Apr 2022 15:10:17 +0000 (17:10 +0200)]
Update translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoFix translated wintun version strings
David Woodhouse [Mon, 11 Apr 2022 15:08:16 +0000 (17:08 +0200)]
Fix translated wintun version strings

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoNo embedded URLs in translatable strings
Dimitri Papadopoulos [Sat, 1 Jan 2022 13:51:10 +0000 (14:51 +0100)]
No embedded URLs in translatable strings

https://www.gnu.org/software/gettext/manual/gettext.html#Preparing-Strings

[dwmw2: Fix translations to match]
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoAdd openconnect_set_external_browser_callback() and defaults
David Woodhouse [Sun, 10 Apr 2022 21:11:39 +0000 (22:11 +0100)]
Add openconnect_set_external_browser_callback() and defaults

There is a little bit of duplication here since the *library* will spawn
the default (xdg-open) and the application (main.c) has basically the same
code, but that's because we don't want to *require* that the app register
the callback. With suitable default behaviour from the library, it will
work even with existing versions of the NM auth-dialog or other GUI tools.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoAnyConnect: Add support for external browser SSO
David Woodhouse [Thu, 7 Apr 2022 11:30:21 +0000 (12:30 +0100)]
AnyConnect: Add support for external browser SSO

For external browser SSO we need to listen on a local port to accept the
encoded token from the browser, as it's passed to us via a redirect to
http://localhost:29786/api/sso/<base64>

This implements a simple listening loop, accepting connections and decoding
the blob we get back.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoAdd GnuTLS crypto support for HPKE
David Woodhouse [Sat, 9 Apr 2022 21:49:56 +0000 (22:49 +0100)]
Add GnuTLS crypto support for HPKE

We'll need to explicitly link against libhogweed and maybe also libgmp.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
3 years agoAdd OpenSSL crypto support for HKPE
David Woodhouse [Sat, 9 Apr 2022 21:47:53 +0000 (22:47 +0100)]
Add OpenSSL crypto support for HKPE

We need ECDH derivation, HKDF-SHA256, and AES-256-GCM decryption.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
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 agoDo not XFAIL obsolete-server-crypto on Fedora/CentOS
Mike Gilbert [Sun, 10 Apr 2022 20:22:45 +0000 (16:22 -0400)]
Do not XFAIL obsolete-server-crypto on Fedora/CentOS

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
3 years agoobs workflow: rebuild on each push/merge to master
Luca Boccassi [Mon, 11 Apr 2022 10:53:29 +0000 (11:53 +0100)]
obs workflow: rebuild on each push/merge to master

Signed-off-by: Luca Boccassi <bluca@debian.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 agoopenssl: allow ALL ciphers when allow-insecure-crypto is enabled
Mike Gilbert [Sun, 10 Apr 2022 16:21:57 +0000 (12:21 -0400)]
openssl: allow ALL ciphers when allow-insecure-crypto is enabled

Previously, the cipher list was set to "DEFAULT:+3DES:+RC4". However,
according to ciphers(1), the DEFAULT keyword cannot be combined with
other strings using the + characters. In other words, ":+3DES:+RC4" gets
ignored.

The user is opting into insecure behavior, so let's keep it simple and
just allow everything.

This change fixes the obsolete-server-crypto test when openconnect is
built against openssl-1.1.x.

Signed-off-by: Mike Gilbert <floppym@gentoo.org>
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>