]> www.infradead.org Git - users/dwmw2/openconnect.git/log
users/dwmw2/openconnect.git
10 months agohttp: print proper log message on empty response
Simon Ser [Tue, 25 Jun 2024 16:14:13 +0000 (18:14 +0200)]
http: print proper log message on empty response

The same log message was used for both an error HTTP status and an
empty HTTP response. Use different messages for each case.

Signed-off-by: Simon Ser <contact@emersion.fr>
10 months agoMerge branch 'pschyska' into 'master'
Nikos Mavrogiannopoulos [Wed, 5 Jun 2024 18:24:26 +0000 (18:24 +0000)]
Merge branch 'pschyska' into 'master'

Initialize 'vpninfo->authgroup' to allow 'xmlpost_initial_req' to set '<group-select>'

See merge request openconnect/openconnect!554

10 months agoInitialize 'vpninfo->authgroup' to allow 'xmlpost_initial_req' to set '<group-select>'
Paul Schyska [Thu, 28 Mar 2024 18:57:30 +0000 (19:57 +0100)]
Initialize 'vpninfo->authgroup' to allow 'xmlpost_initial_req' to set '<group-select>'

Signed-off-by: Paul Schyska <pschyska@gmail.com>
11 months agoMerge branch 'tmp-reenable-ci' into 'master'
Nikos Mavrogiannopoulos [Fri, 10 May 2024 20:05:49 +0000 (20:05 +0000)]
Merge branch 'tmp-reenable-ci' into 'master'

.gitlab-ci.yml: use saas-linux-small-amd64 as tag

See merge request openconnect/openconnect!552

11 months ago.gitlab-ci.yml: use saas-linux-small-amd64 as tag
Nikos Mavrogiannopoulos [Fri, 10 May 2024 18:29:44 +0000 (20:29 +0200)]
.gitlab-ci.yml: use saas-linux-small-amd64 as tag

The linux and shared tags are deprecated:
https://docs.gitlab.com/ee/update/deprecations.html?removal_milestone=17.0#removal-of-tags-from-small-saas-runners-on-linux

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
12 months agoMerge branch 'Fedora_ppp-over-tls' into 'master'
David Woodhouse [Fri, 5 Apr 2024 10:07:08 +0000 (10:07 +0000)]
Merge branch 'Fedora_ppp-over-tls' into 'master'

Verbose logs to debug and fix ppp-over-tls

Closes #720

See merge request openconnect/openconnect!548

12 months agoVerbose socat logs for debugging, Add '-4' to listen on Legacy IP (for sockwrap)
Dimitri Papadopoulos Orfanos [Mon, 1 Apr 2024 13:58:56 +0000 (15:58 +0200)]
Verbose socat logs for debugging, Add '-4' to listen on Legacy IP (for sockwrap)

Signed-off-by: Dimitri Papadopoulos Orfanos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
12 months agoMerge branch 'LOAD_LIBRARY_SEARCH_SYSTEM32' into 'master'
Dimitri Papadopoulos Orfanos [Sun, 31 Mar 2024 11:32:29 +0000 (11:32 +0000)]
Merge branch 'LOAD_LIBRARY_SEARCH_SYSTEM32' into 'master'

Search wintun.dll in the application directory only

See merge request openconnect/openconnect!541

13 months agoSearch wintun.dll in the application directory only
Dimitri Papadopoulos [Wed, 28 Feb 2024 06:31:00 +0000 (07:31 +0100)]
Search wintun.dll in the application directory only

Now that wintun.dll is installed in the application directory by
both openconnect and openconnect-gui packages, we can get rid of
LOAD_LIBRARY_SEARCH_SYSTEM32.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
13 months agoMerge branch 'rekey' into master
Daniel Lenski [Wed, 28 Feb 2024 05:42:32 +0000 (21:42 -0800)]
Merge branch 'rekey' into master

Fix logging of rekey / trojan invocation delay

See merge request openconnect/openconnect!539

13 months agoUpdate changelog
Daniel Lenski [Tue, 27 Feb 2024 23:39:53 +0000 (15:39 -0800)]
Update changelog

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
13 months agoFix logging of rekey / trojan invocation delay
Wade Cline [Wed, 28 Feb 2024 03:19:00 +0000 (19:19 -0800)]
Fix logging of rekey / trojan invocation delay

Closes #677

The rekey / trojan invocation is supposed to happen in the future.
Therefore subtract current time from expected time of rekey / invocation,
not the reverse.

These delays have been shown incorrectly ever since the SIGUSR1 handler was
added in b156b581e894b03e7169827b9e293ca2f13e1366.

Originally submitted at
https://lists.infradead.org/pipermail/openconnect-devel/2024-February/005400.html

Signed-off-by: Cline, Wade <wade.cline@intel.com>
Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
13 months agoMerge branch 'tmp-build-mingw' into 'master'
Daniel Lenski [Sun, 25 Feb 2024 19:13:39 +0000 (19:13 +0000)]
Merge branch 'tmp-build-mingw' into 'master'

MinGW build improvements

See merge request openconnect/openconnect!537

14 months agoMinGW build improvements
Marios Paouris [Thu, 22 Feb 2024 10:03:01 +0000 (12:03 +0200)]
MinGW build improvements

- Decoupled wintun and vpnc-script-win.js from building installer.
- Added required dependencies for downloading wintun and vpnc-script-win.js.
- Install wintun, vpnc-script-win.js and list-system-keys by default.
- Added configure option to disable building installer (doesn't work in
  msys/mingw builds, can also speedup build when no installer required).

Signed-off-by: Marios Paouris <mspaourh@gmail.com>
14 months agoMerge branch 'tmp-fix-openssl-3.0.6' into 'master'
Daniel Lenski [Thu, 22 Feb 2024 22:15:20 +0000 (22:15 +0000)]
Merge branch 'tmp-fix-openssl-3.0.6' into 'master'

Fix compatibility with openssl 3.1 and later versions

See merge request openconnect/openconnect!536

14 months agoUpdate changelog
Daniel Lenski [Thu, 22 Feb 2024 21:58:48 +0000 (13:58 -0800)]
Update changelog

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
14 months agoopenssl-dtls: use DTLS 1.2 for PSK-NEGOTIATE
Nikos Mavrogiannopoulos [Wed, 21 Feb 2024 21:24:56 +0000 (22:24 +0100)]
openssl-dtls: use DTLS 1.2 for PSK-NEGOTIATE

Avoid reducing the security level for PSK-NEGOTIATE by
setting DTLS 1.2. This works well because all PSK-NEGOTIATE
ocserv servers are using gnutls that supports DTLS 1.2.

This addresses a previously undetermined issue with DTLS on centos7.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
14 months ago.gitlab-ci.yml: use fedora39 for all builds
Nikos Mavrogiannopoulos [Wed, 21 Feb 2024 20:59:20 +0000 (21:59 +0100)]
.gitlab-ci.yml: use fedora39 for all builds

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
14 months agoopenssl-dtls: set security level to zero when negotiating DTLS 1.0 or earlier
Nikos Mavrogiannopoulos [Wed, 21 Feb 2024 20:56:03 +0000 (21:56 +0100)]
openssl-dtls: set security level to zero when negotiating DTLS 1.0 or earlier

This addresses the issue of openssl 3.1 running in fedora39.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
14 months agoMerge branch 'tmp-fix-dtls-disable' into 'master'
Nikos Mavrogiannopoulos [Wed, 21 Feb 2024 20:01:22 +0000 (20:01 +0000)]
Merge branch 'tmp-fix-dtls-disable' into 'master'

openconnect_disable_dtls: allow disabling DTLS unless already connected

Closes #697

See merge request openconnect/openconnect!523

14 months agoopenconnect_disable_dtls: allow disabling DTLS unless already connected
Nikos Mavrogiannopoulos [Thu, 11 Jan 2024 13:07:37 +0000 (14:07 +0100)]
openconnect_disable_dtls: allow disabling DTLS unless already connected

The openconnect client disables DTLS if it fails to
connect. Openconnect-gui couldn't do that because of
the restrictions of openconnect_disable_dtls(). This
MR removes those restrictions and allows disabling DTLS
even if we attempted connection before.

Resolves: #697

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
14 months agoMerge branch 'priority' into 'master'
Daniel Lenski [Tue, 20 Feb 2024 19:27:59 +0000 (19:27 +0000)]
Merge branch 'priority' into 'master'

GlobalProtect: Add priority-rule set support

Closes #663

See merge request openconnect/openconnect!498

14 months agoUpdate changelog
Daniel Lenski [Sat, 30 Sep 2023 04:36:37 +0000 (21:36 -0700)]
Update changelog

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
14 months agoModify `fake-gp-server.py` to add regionalized priority-rules to the gateway list
Daniel Lenski [Fri, 29 Sep 2023 20:51:07 +0000 (13:51 -0700)]
Modify `fake-gp-server.py` to add regionalized priority-rules to the gateway list

The fake GP server will now assign the connecting user to a random planet in
its portal prelogin response, then randomly and haphazardly prioritize the
gateways by planet.

For example, start fake-gp-server.py, then configure it with 3 gateways:

    $ curl -k https://localhost:8080/CONFIGURE -d gateways=Red,Orange,Yellow
    $ curl -k https://localhost:8080/CONFIGURE
    Current configuration of fake GP server configuration:
    TestConfiguration(gateways=['Red', 'Orange', 'Yellow'], ...)

Then attempt to connect to it:

    $ openconnect --protocol=gp --dump-http-traffic localhost:8080
    ...
    Greetings, user from MERCURY. Please login to this fake GP VPN portal
    Username: bar
    Password:
    POST https://localhost:8080/global-protect/getconfig.esp
    ...
    < <?xml version="1.0" encoding="UTF-8" ?>
    < <policy><version> 6.7.8-9 </version><gateways><external><list>
    < <entry name="localhost:8080">
    <   <description>Red</description>
    <   <priority-rule>
    <     <entry name="VENUS"><priority>1</priority></entry>
    <     <entry name="Any"><priority>99</priority></entry>
    <   </priority-rule>
    < </entry>
    < <entry name="localhost:8080">
    <   <description>Orange</description>
    <   <priority-rule>
    <     <entry name="JUPITER"><priority>2</priority></entry>
    <     <entry name="MARS"><priority>1</priority></entry>
    <   </priority-rule>
    < </entry>
    < <entry name="localhost:8080">
    <   <description>Yellow</description>
    <   <priority-rule>
    <     <entry name="MERCURY"><priority>1</priority></entry>
    <     <entry name="EARTH"><priority>2</priority></entry>
    <   </priority-rule>
    < </entry></list>
    < </external></gateways>
    < <hip-collection><hip-report-interval>600</hip-report-interval></hip-collection>
    < </policy>
    Portal reports GlobalProtect version 6.7.8-9; we will report the same client version.
    Portal set HIP report interval to 10 minutes).
    5 gateway servers available:
      Red (localhost:8080) [priority 99]
      Orange (localhost:8080) [unprioritized]
      Yellow (localhost:8080) [priority 1]
    Please select GlobalProtect gateway.
    GATEWAY: [Yellow|Red|Orange]:

Note that the gateways are now presented to the user in the priority order
for the user's "region" of MERCURY.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
14 months agoGlobalProtect: Add priority-rule set support
Jan-Michael Brummer [Thu, 28 Sep 2023 17:46:32 +0000 (19:46 +0200)]
GlobalProtect: Add priority-rule set support

Starting from version 8.0, PAN GlobalProtect portal servers are able to send
a priority rule list for each gateway.  Per
https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA10g000000ClSsCAK,
the gateways can be prioritized by geographic region.

The gateways should then be presented to the user in order of geographic
priority, rather than just in their order of appearance in
policy/gateways/external/list (from the portal config XML).

How does the client know which geographic region it is in?

1. The client itself may have some way to figure out which region it is
   connecting from (e.g. geolocation, not implemented yet for OpenConnect).
2. The client may have an option to explicitly specifiy the desired region
   (not implemented yet in OpenConnect).
3. The *server* tells the client which region it thinks the client is
   connecting from, in the portal *prelogin* response, and the client
   follows that (implemented here).

Fixes: https://gitlab.com/openconnect/openconnect/-/issues/663
[DRL fixed a small mistake in qsort usage, and tweaked code structure,
comments, and log messages.]

Signed-off-by: Jan-Michael Brummer <jan-michael.brummer1@volkswagen.de>
Signed-off-by: Daniel Lenski <dlenski@gmail.com>
14 months agoMerge branch 'fix_gp_IPv6_split_include' into 'master'
Daniel Lenski [Tue, 20 Feb 2024 06:14:03 +0000 (22:14 -0800)]
Merge branch 'fix_gp_IPv6_split_include' into 'master'

14 months agoUpdate changelog
Daniel Lenski [Tue, 20 Feb 2024 06:12:20 +0000 (22:12 -0800)]
Update changelog

This bug in GlobalProtect IPv6 split-include handling was introduced in
https://gitlab.com/openconnect/openconnect/-/commit/a2b8134edf8e5f8e942dedf105e2813a0824b919;
see also
https://gitlab.com/openconnect/openconnect/-/merge_requests/367#note_1780223796.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
14 months agoFix GlobalProtect config-parsing bug that misidentified IPv6 split-include routes...
Daniel Loxtermann [Tue, 20 Feb 2024 01:59:47 +0000 (17:59 -0800)]
Fix GlobalProtect config-parsing bug that misidentified IPv6 split-include routes as split-exclude

As reported on the mailing list at
https://lists.infradead.org/pipermail/openconnect-devel/2024-January/005386.html,
the relevant code wasn't handling the IPv6 case correctly.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
14 months agoSend 'cas-support=yes' in GlobalProtect prelogin request
Daniel Lenski [Mon, 25 Sep 2023 14:14:37 +0000 (07:14 -0700)]
Send 'cas-support=yes' in GlobalProtect prelogin request

Per https://gitlab.com/openconnect/openconnect/-/issues/651, some newer GP
servers are responding to prelogin.esp requests with an error:

    CAS is not supported by the client.  Minimum client version is 6.0

It appears that CAS ("Central Authentication Server";
https://apereo.github.io/cas/index.html) is a standardized single-sign-on
protocol requiring an external browser.

Per https://gitlab.com/openconnect/openconnect/-/issues/651#note_1576596243,
the field 'cas-support=yes' needs to be sent in the POST *body* of the
prelogin request, in order to avoid this error message; the error message's
claim that a specific client software version is necessary isn't very
helpful.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
14 months agoReal GlobalProtect SAML authentication forms won't work without JavaScript
Daniel Lenski [Tue, 26 Sep 2023 19:08:45 +0000 (12:08 -0700)]
Real GlobalProtect SAML authentication forms won't work without JavaScript

This adds a 'saml_needs_js' option to fake-gp-server.py.  If set, the fake
SAML login form that it generates won't work correctly without JavaScript
execution, just like a "real" GlobalProtect SAML server.

See 64a0ba69e53d065f4d2ba4e89e6ff10926d6c895 for the use case for this fake
SAML authentication endpoint.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
14 months agoMerge branch 'JScript' into 'master'
Dimitri Papadopoulos Orfanos [Sat, 10 Feb 2024 13:20:34 +0000 (13:20 +0000)]
Merge branch 'JScript' into 'master'

Force the Windows script host to use the JScript engine

Closes #703

See merge request openconnect/openconnect!534

14 months agoMerge branch 'xmlstarlet' into 'master'
Dimitri Papadopoulos Orfanos [Mon, 5 Feb 2024 07:42:16 +0000 (07:42 +0000)]
Merge branch 'xmlstarlet' into 'master'

Force final newline in xmlstarlet

See merge request openconnect/openconnect!535

14 months agoForce final newline in xmlstarlet
Jon DeVree [Sat, 3 Feb 2024 17:09:58 +0000 (12:09 -0500)]
Force final newline in xmlstarlet

By default xmlstarlet does not include a final newline on the output.
Because POSIX says that all lines must end in a newline, this causes the
final line of output to be skipped by the 'while read ...' loop in bash.
Adding a '-n' after the '-v ...' causes xmlstarlet to include a final
newline at the end of its output.

Signed-off-by: Jon DeVree <nuxi@vault24.org>
14 months agoForce the Windows script host to use the JScript engine
Dimitri Papadopoulos Orfanos [Fri, 2 Feb 2024 10:31:50 +0000 (11:31 +0100)]
Force the Windows script host to use the JScript engine

This bypasses rogue programs that register as handlers
for the ".js" file extension but fail to run the script.

Signed-off-by: Dimitri Papadopoulos Orfanos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
14 months agoMerge branch 'gcc14-fix' into 'master'
Dimitri Papadopoulos Orfanos [Wed, 31 Jan 2024 09:04:17 +0000 (09:04 +0000)]
Merge branch 'gcc14-fix' into 'master'

Fix implicit declaration of function 'malloc'

See merge request openconnect/openconnect!533

Signed-off-by: default avatarBrahmajit Das <brahmajit.xyz@gmail.com>
14 months agoMerge branch 'main' into 'master'
Dimitri Papadopoulos Orfanos [Wed, 31 Jan 2024 08:59:26 +0000 (08:59 +0000)]
Merge branch 'main' into 'master'

main() signature compliant with C standard

See merge request openconnect/openconnect!516

14 months agoMerge branch 'tmp-external-browser' into 'master'
Nikos Mavrogiannopoulos [Wed, 31 Jan 2024 08:48:05 +0000 (08:48 +0000)]
Merge branch 'tmp-external-browser' into 'master'

configure.ac: print external browser and vpnc script

See merge request openconnect/openconnect!531

14 months agoMove <stdlib.h> around, match existing ordering
Dimitri Papadopoulos [Wed, 31 Jan 2024 08:39:17 +0000 (09:39 +0100)]
Move <stdlib.h> around, match existing ordering

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
14 months agoFix implicit declaration of function 'malloc'
Brahmajit Das [Mon, 29 Jan 2024 17:58:53 +0000 (23:28 +0530)]
Fix implicit declaration of function 'malloc'

First observed on Gentoo Linux with GCC 14. This is due to GCC 14
enabling -Werror=implicit-function-declaration by default.
Thus resulting in errors such as:

openconnect-internal.h: In function 'alloc_pkt':
openconnect-internal.h:911:27: error: implicit declaration of function 'malloc' [-Werror=implicit-function-declaration]
  911 |         struct pkt *pkt = malloc(alloc_len);
      |                           ^~~~~~

Plese refer gentoo bug: https://bugs.gentoo.org/923173
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
14 months agoImport translations from GNOME
David Woodhouse [Mon, 29 Jan 2024 17:46:01 +0000 (09:46 -0800)]
Import translations from GNOME

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
14 months agoMerge branch 'AppVeyor' into 'master'
Dimitri Papadopoulos Orfanos [Mon, 29 Jan 2024 16:10:18 +0000 (16:10 +0000)]
Merge branch 'AppVeyor' into 'master'

Fix compiler warnings when buliding on AppVeyor

See merge request openconnect/openconnect!532

14 months agoFix compiler warnings when buliding on AppVeyor
Dimitri Papadopoulos Orfanos [Sun, 28 Jan 2024 19:43:03 +0000 (20:43 +0100)]
Fix compiler warnings when buliding on AppVeyor

../mtucalc.c: In function 'calculate_mtu':
../mtucalc.c:75:33: warning: passing argument 4 of 'getsockopt' from incompatible pointer type [-Wincompatible-pointer-types]
   75 |                                 &mss, &mss_size)) {
      |                                 ^~~~
      |                                 |
      |                                 int *
In file included from ../openconnect-internal.h:31,
                 from ../mtucalc.c:20:
C:/msys64/mingw64/include/winsock2.h:1010:82: note: expected 'char *' but argument is of type 'int *'
 1010 |   WINSOCK_API_LINKAGE int WSAAPI getsockopt(SOCKET s,int level,int optname,char *optval,int *optlen);
      |                                                                            ~~~~~~^~~~~~
  CC       libopenconnect_la-lzo.lo

../cstp.c: In function 'calculate_dtls_mtu':
../cstp.c:134:33: warning: passing argument 4 of 'getsockopt' from incompatible pointer type [-Wincompatible-pointer-types]
  134 |                                 &mss, &mss_size)) {
      |                                 ^~~~
      |                                 |
      |                                 int *
In file included from ../openconnect-internal.h:31,
                 from ../cstp.c:21:
C:/msys64/mingw64/include/winsock2.h:1010:82: note: expected 'char *' but argument is of type 'int *'
 1010 |   WINSOCK_API_LINKAGE int WSAAPI getsockopt(SOCKET s,int level,int optname,char *optval,int *optlen);
      |                                                                            ~~~~~~^~~~~~

Signed-off-by: Dimitri Papadopoulos Orfanos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
14 months agoconfigure.ac: print external browser and vpnc script
Nikos Mavrogiannopoulos [Sat, 27 Jan 2024 09:55:03 +0000 (10:55 +0100)]
configure.ac: print external browser and vpnc script

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
15 months agoMerge branch 'openconnect-gui' into 'master'
Nikos Mavrogiannopoulos [Thu, 25 Jan 2024 08:28:43 +0000 (08:28 +0000)]
Merge branch 'openconnect-gui' into 'master'

Update URL of OpenConnect-gui home page

See merge request openconnect/openconnect!530

15 months agoUpdate URL of OpenConnect-gui home page
Dimitri Papadopoulos Orfanos [Thu, 25 Jan 2024 08:12:00 +0000 (09:12 +0100)]
Update URL of OpenConnect-gui home page

Signed-off-by: Dimitri Papadopoulos Orfanos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
15 months agoMerge branch 'mingw-test-fix' into 'master'
Nikos Mavrogiannopoulos [Sun, 21 Jan 2024 09:17:43 +0000 (09:17 +0000)]
Merge branch 'mingw-test-fix' into 'master'

Added WINEPATH to fix MinGW CI tests

Closes #689

See merge request openconnect/openconnect!529

15 months agoAdded WINEPATH to fix MinGW CI tests
Marios Paouris [Sat, 20 Jan 2024 08:43:12 +0000 (10:43 +0200)]
Added WINEPATH to fix MinGW CI tests

Signed-off-by: Marios Paouris <mspaourh@gmail.com>
15 months agoMerge branch 'fortinet_chunk-size' into 'master'
Dimitri Papadopoulos Orfanos [Fri, 19 Jan 2024 10:54:31 +0000 (10:54 +0000)]
Merge branch 'fortinet_chunk-size' into 'master'

Be lenient when parsing HTTP chunk-size

Closes #698

See merge request openconnect/openconnect!524

15 months agoMerge branch 'tmp-nsi-merge' into 'master'
Nikos Mavrogiannopoulos [Fri, 19 Jan 2024 05:18:07 +0000 (05:18 +0000)]
Merge branch 'tmp-nsi-merge' into 'master'

nsis: create a self-contained nsi file

See merge request openconnect/openconnect!522

15 months agomain() signature compliant with C standard
Dimitri Papadopoulos Orfanos [Fri, 29 Dec 2023 10:58:21 +0000 (11:58 +0100)]
main() signature compliant with C standard

Signed-off-by: Dimitri Papadopoulos Orfanos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
15 months agoMerge branch 'report-android-as-android' into 'master'
Nikos Mavrogiannopoulos [Thu, 18 Jan 2024 05:01:17 +0000 (05:01 +0000)]
Merge branch 'report-android-as-android' into 'master'

Correctly report Android and iOS for globalprotect

See merge request openconnect/openconnect!527

15 months agoCorrectly report Android and iOS for globalprotect
Art Pinch [Tue, 16 Jan 2024 17:37:06 +0000 (20:37 +0300)]
Correctly report Android and iOS for globalprotect

Signed-off-by: Art Pinch <leonardo906@mail.ru>
15 months agoMerge branch 'tmp-latest-fedora' into 'master'
Nikos Mavrogiannopoulos [Mon, 15 Jan 2024 16:55:19 +0000 (16:55 +0000)]
Merge branch 'tmp-latest-fedora' into 'master'

Run openconnect on latest fedora (39)

See merge request openconnect/openconnect!504

15 months agoUse latest fedora (39) for CI
Nikos Mavrogiannopoulos [Tue, 21 Nov 2023 14:09:53 +0000 (15:09 +0100)]
Use latest fedora (39) for CI

This moves all CI images to Fedora39 except OpenSSL builds
that still use Fedora38 due to compatibility issues.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
15 months agoBe lenient when parsing HTTP chunk-size
Dimitri Papadopoulos Orfanos [Fri, 12 Jan 2024 16:15:10 +0000 (17:15 +0100)]
Be lenient when parsing HTTP chunk-size

Fortinet servers appear to be abusing RFC 9112:

     chunk          = chunk-size [ chunk-ext ] CRLF
                      chunk-data CRLF

     chunk-size     = 1*HEXDIG

     chunk-ext      = *( BWS ";" BWS chunk-ext-name
                         [ BWS "=" BWS chunk-ext-val ] )

They add spaces (BWS) at the end of chunk-size, even in the absence of chunk-ext.

Be lenient when parsing chunk:
1. Accept bogus chunk-ext, with ";" not followed by chunk-ext-name.
2. Discard leading/trailing spaces in chunk-size, strtol() will do that for us.

Signed-off-by: Dimitri Papadopoulos Orfanos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
15 months agonsis: create self-contained nsi file
Nikos Mavrogiannopoulos [Wed, 10 Jan 2024 19:51:37 +0000 (20:51 +0100)]
nsis: create self-contained nsi file

Including from a relative path is interpreted differently
depending on where the caller is started. This allows running
nsis on the output nsi even if not located at the build directory.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
15 months agoMerge branch 'nsis_keywords' into 'master'
Nikos Mavrogiannopoulos [Sat, 6 Jan 2024 21:42:08 +0000 (21:42 +0000)]
Merge branch 'nsis_keywords' into 'master'

Avoid warnings while building the NSIS installer

See merge request openconnect/openconnect!513

15 months agoMerge branch 'bad_dtls_test' into 'master'
Nikos Mavrogiannopoulos [Sat, 6 Jan 2024 21:27:50 +0000 (21:27 +0000)]
Merge branch 'bad_dtls_test' into 'master'

bad_dtls_test: set security level to 0

See merge request openconnect/openconnect!478

15 months agoAvoid warnings while building the NSIS installer
Dimitri Papadopoulos Orfanos [Fri, 22 Dec 2023 10:53:18 +0000 (11:53 +0100)]
Avoid warnings while building the NSIS installer

warning 9100: Generating version information for language
              "1033-English" without standard key "FileVersion"
warning 9100: Generating version information for language
              "1033-English" without standard key "FileDescription"

Signed-off-by: Dimitri Papadopoulos Orfanos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
15 months agoMerge branch 'bugfix/win-external-browser-flag' into 'master'
Nikos Mavrogiannopoulos [Sat, 6 Jan 2024 20:40:09 +0000 (20:40 +0000)]
Merge branch 'bugfix/win-external-browser-flag' into 'master'

Support --external-browser flag on _WIN32 systems

See merge request openconnect/openconnect!489

15 months agoMerge branch 'libxml/parser' into 'master'
Dimitri Papadopoulos Orfanos [Sat, 6 Jan 2024 20:16:42 +0000 (20:16 +0000)]
Merge branch 'libxml/parser' into 'master'

Include <libxml/tree.h> from a single place

See merge request openconnect/openconnect!507

15 months agoMerge branch 'tmp-android-fixes' into 'master'
Nikos Mavrogiannopoulos [Sat, 6 Jan 2024 18:16:00 +0000 (18:16 +0000)]
Merge branch 'tmp-android-fixes' into 'master'

.gitlab-ci.yml: specify the toolchain image used

See merge request openconnect/openconnect!520

15 months agoInclude <libxml/tree.h> from a single place
Dimitri Papadopoulos Orfanos [Sat, 6 Jan 2024 15:48:28 +0000 (16:48 +0100)]
Include <libxml/tree.h> from a single place

<libxml/tree.h> used to be included both by "openconnect-internal.h"
and from *.c source files. We don't need both. Let's settle on including
from "openconnect-internal.h" only.

Signed-off-by: Dimitri Papadopoulos Orfanos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
15 months ago.gitlab-ci.yml: specify the toolchain image used
Nikos Mavrogiannopoulos [Sat, 6 Jan 2024 15:38:46 +0000 (16:38 +0100)]
.gitlab-ci.yml: specify the toolchain image used

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
15 months agoMerge branch 'stricter_chunked_encoding_error_detection' into 'master'
Nikos Mavrogiannopoulos [Sat, 6 Jan 2024 12:11:27 +0000 (12:11 +0000)]
Merge branch 'stricter_chunked_encoding_error_detection' into 'master'

Stricter chunked-encoding error detection

See merge request openconnect/openconnect!468

15 months agoMerge branch 'asctime_newline' into 'master'
Nikos Mavrogiannopoulos [Sat, 6 Jan 2024 12:06:05 +0000 (12:06 +0000)]
Merge branch 'asctime_newline' into 'master'

Remove trailing new line returned by ctime()

Closes #598

See merge request openconnect/openconnect!469

15 months agoMerge branch 'change_default_UA_string_to_be_compatible_with_newer_Cisco_servers...
Nikos Mavrogiannopoulos [Sat, 6 Jan 2024 10:39:30 +0000 (10:39 +0000)]
Merge branch 'change_default_UA_string_to_be_compatible_with_newer_Cisco_servers' into 'master'

Change default user-agent string to be compatible with newer Cisco servers

Closes #544, #593, #602, #618, #635, #657, #662, and #665

See merge request openconnect/openconnect!497

15 months agoMerge branch 'reading' into 'master'
Nikos Mavrogiannopoulos [Sat, 6 Jan 2024 10:34:38 +0000 (10:34 +0000)]
Merge branch 'reading' into 'master'

Get rid of repeated "reading" in comment

See merge request openconnect/openconnect!510

15 months agoMerge branch 'mailmap' into 'master'
Nikos Mavrogiannopoulos [Sat, 6 Jan 2024 10:32:41 +0000 (10:32 +0000)]
Merge branch 'mailmap' into 'master'

Update .mailmap

See merge request openconnect/openconnect!512

15 months agoMerge branch 'doc_vpnc-script' into 'master'
Nikos Mavrogiannopoulos [Sat, 6 Jan 2024 10:29:30 +0000 (10:29 +0000)]
Merge branch 'doc_vpnc-script' into 'master'

Remove extraneous period from the documentation

See merge request openconnect/openconnect!515

15 months agoMerge branch 'tmp-update-uris' into 'master'
Dimitri Papadopoulos Orfanos [Fri, 5 Jan 2024 23:43:06 +0000 (23:43 +0000)]
Merge branch 'tmp-update-uris' into 'master'

www: updated links to ocserv web pages

See merge request openconnect/openconnect!517

15 months agoMerge branch 'mingw-fix' into 'master'
Dimitri Papadopoulos Orfanos [Fri, 5 Jan 2024 22:44:32 +0000 (22:44 +0000)]
Merge branch 'mingw-fix' into 'master'

use the unsigned printf qualifier for size_t : fixes MinGW{32,64} build

See merge request openconnect/openconnect!506

15 months agoMerge branch 'bugfix/cstp_sso_detect_done' into 'master'
Dimitri Papadopoulos Orfanos [Fri, 5 Jan 2024 22:41:04 +0000 (22:41 +0000)]
Merge branch 'bugfix/cstp_sso_detect_done' into 'master'

cstp: Check if uri is NULL in sso_detect_done

See merge request openconnect/openconnect!511

15 months agoRemove extraneous period from the documentation
Dimitri Papadopoulos Orfanos [Mon, 25 Dec 2023 19:47:41 +0000 (20:47 +0100)]
Remove extraneous period from the documentation

Be consistent, other ttles don't end with a period.

Signed-off-by: Dimitri Papadopoulos Orfanos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
15 months agoMerge branch 'xmlReadMemory' into 'master'
Dimitri Papadopoulos Orfanos [Fri, 5 Jan 2024 22:38:31 +0000 (22:38 +0000)]
Merge branch 'xmlReadMemory' into 'master'

include <libxml/parser.h> : fix xmlReadMemory build error

Closes #685

See merge request openconnect/openconnect!505

15 months agoUpdate .mailmap
Dimitri Papadopoulos [Fri, 22 Dec 2023 10:43:23 +0000 (11:43 +0100)]
Update .mailmap

One more address to consolidate

Signed-off-by: Dimitri Papadopoulos Orfanos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
15 months agoGet rid of repeated "reading" in comment
Dimitri Papadopoulos [Sun, 17 Dec 2023 17:23:49 +0000 (18:23 +0100)]
Get rid of repeated "reading" in comment

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
15 months agowww: updated links to ocserv web pages
Nikos Mavrogiannopoulos [Fri, 5 Jan 2024 15:49:25 +0000 (16:49 +0100)]
www: updated links to ocserv web pages

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
15 months agoMerge branch 'tmp-skip-mingw-failures' into 'master'
Nikos Mavrogiannopoulos [Fri, 5 Jan 2024 22:20:04 +0000 (22:20 +0000)]
Merge branch 'tmp-skip-mingw-failures' into 'master'

Avoid mingw/openssl failures

See merge request openconnect/openconnect!518

15 months ago.gitlab-ci.yml: make bad_dtls_test XFAIL in fedora mingw
Nikos Mavrogiannopoulos [Fri, 5 Jan 2024 18:17:17 +0000 (19:17 +0100)]
.gitlab-ci.yml: make bad_dtls_test XFAIL in fedora mingw

This makes the CI not failing, allowing to bring new patches.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
15 months agowintun: Use it from the CI image when available
Nikos Mavrogiannopoulos [Fri, 5 Jan 2024 19:49:05 +0000 (20:49 +0100)]
wintun: Use it from the CI image when available

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
16 months agocstp: Check if uri is NULL in sso_detect_done
Rahul Rameshbabu [Thu, 21 Dec 2023 20:46:08 +0000 (12:46 -0800)]
cstp: Check if uri is NULL in sso_detect_done

Passing a NULL value to strcmp is undefined behavior. Some web engines
might have events where cookies are enumerated, but the event does not
contain a uri enumeration. An example is QtWebEngine where it has discrete
signals, QWebEngineView::urlChanged and QWebEngineCookieStore::cookieAdded.
Add a check similar to the one found in gpst_sso_detect_done for the uri
member of struct oc_webview_result.

Signed-off-by: Rahul Rameshbabu <sergeantsagara@protonmail.com>
16 months agoMerge branch 'bugfix/cstp_sso_detect_done' into 'master'
Dimitri Papadopoulos Orfanos [Wed, 13 Dec 2023 23:03:37 +0000 (23:03 +0000)]
Merge branch 'bugfix/cstp_sso_detect_done' into 'master'

cstp: Check if cookies is NULL in sso_detect_done

See merge request openconnect/openconnect!449

16 months agoMerge branch 'cscript' into 'master'
Dimitri Papadopoulos Orfanos [Wed, 13 Dec 2023 23:00:42 +0000 (23:00 +0000)]
Merge branch 'cscript' into 'master'

Remove spurious "cscript "

See merge request openconnect/openconnect!491

16 months agoMerge branch 'script_setenv_NULL' into 'master'
Dimitri Papadopoulos Orfanos [Wed, 13 Dec 2023 20:56:34 +0000 (20:56 +0000)]
Merge branch 'script_setenv_NULL' into 'master'

script_setenv: fix append with val == NULL

See merge request openconnect/openconnect!445

16 months agoscript_setenv: fix append with val == NULL
Dimitri Papadopoulos Orfanos [Wed, 13 Dec 2023 20:56:34 +0000 (20:56 +0000)]
script_setenv: fix append with val == NULL

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
16 months agouse the unsigned printf qualifier for size_t : fixes MinGW{32,64} build
Timothee 'TTimo' Besset [Sun, 26 Nov 2023 16:13:05 +0000 (10:13 -0600)]
use the unsigned printf qualifier for size_t : fixes MinGW{32,64} build

Signed-off-by: Timothee Besset <ttimo@ttimo.net>
16 months agoinclude <libxml/parser.h> : fix xmlReadMemory build error
Timothee 'TTimo' Besset [Sun, 26 Nov 2023 14:34:21 +0000 (08:34 -0600)]
include <libxml/parser.h> : fix xmlReadMemory build error

Signed-off-by: Timothee Besset <ttimo@ttimo.net>
17 months agoMerge branch 'coverity_fixes' into 'master'
Dimitri Papadopoulos Orfanos [Thu, 9 Nov 2023 13:05:28 +0000 (13:05 +0000)]
Merge branch 'coverity_fixes' into 'master'

Fix assorted Coverity Scan issues

See merge request openconnect/openconnect!502

17 months agoFix resource leak identified by Coverity Scan
Dimitri Papadopoulos [Mon, 6 Nov 2023 12:52:59 +0000 (13:52 +0100)]
Fix resource leak identified by Coverity Scan

Isn't it possible that gpst_xml_or_error(), called by gpst_login(),
is called twice?

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
17 months agoFix dead code identified by Coverity Scan
Dimitri Papadopoulos [Mon, 6 Nov 2023 11:10:24 +0000 (12:10 +0100)]
Fix dead code identified by Coverity Scan

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
17 months agoFix resource leak identified by Coverity Scan
Dimitri Papadopoulos [Mon, 6 Nov 2023 11:07:37 +0000 (12:07 +0100)]
Fix resource leak identified by Coverity Scan

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
18 months agoGet rid of non-reentrant functions
Dimitri Papadopoulos [Tue, 25 Apr 2023 10:22:46 +0000 (13:22 +0300)]
Get rid of non-reentrant functions

Because we know the code in `main.c` is executed in a single-threaded
environment, we don't need to modify non-reentant functions in this file,
unless some linter complains in the future:
* localtime()
* getpwnam()

The only remaining non-entrant function is:
* getpwuid()

Using constant 2049 instead of sysconf(_SC_GETPW_R_SIZE_MAX) might not
be the best idea. I want to avoid dynamic allocation. On Ubuntu 18.04,
sysconf(_SC_GETPW_R_SIZE_MAX) is 1024, so 2049 "ought to be enough".

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
18 months agoGet rid of the trailing new line added by ctime()
Dimitri Papadopoulos [Mon, 24 Apr 2023 12:56:55 +0000 (15:56 +0300)]
Get rid of the trailing new line added by ctime()

From the POSIX documentation of ctime:
The ctime() function shall convert the time pointed to
by clock [...] to local time in the form of a string.
It shall be equivalent to:

        asctime(localtime(clock))

From the POSIX documentation of asctime:
The asctime() function shall convert the broken-down time
in the structure pointed to by timeptr into a string in the
form:

Sun Sep 16 01:03:52 1973\n\0

We need to get rid of that new line otherwise it appears in the log.

The POSIX documentation goes on:
These functions are included only for compatibility with older
implementations. They have undefined behavior if the resulting
string would be too long, so the use of these functions should
be discouraged. On implementations that do not detect output
string length overflow, it is possible to overflow the output
buffers in such a way as to cause applications to fail, or
possible system security violations. Also, these functions do
not support localized date and time formats. To avoid these
problems, applications should use strftime() to generate
strings from broken-down times.

Because we have already been using strftime() with gmtime() elsewhere,
using strftime() with locatime() here makes sense.

The i1On mechanisme we currently use to print dates is non-sensical:
we force the format string to "%a, %d %b %Y %H:%M:%S" which might not
make sense in some locales. We shall fix i10n in a different merge
request or commit.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
18 months agoRemove spurious "cscript "
Dimitri Papadopoulos [Thu, 31 Aug 2023 14:02:14 +0000 (17:02 +0300)]
Remove spurious "cscript "

Do not add "cscript " in main.c, instead rely on "cscript.exe " being
added in script.c.

This spurious "cscript " had been forgotten in f3b06b62.

Signed-off-by: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com>
18 months agoChange default user-agent string to be compatible with newer Cisco servers
Daniel Lenski [Tue, 26 Sep 2023 22:29:48 +0000 (15:29 -0700)]
Change default user-agent string to be compatible with newer Cisco servers

See https://gitlab.com/openconnect/openconnect/-/issues/665 for a summary of
this issue.

This implements the simplest reasonable solution to the problem: Just Change
The Defaultâ„¢ UA string.

Short summary: Cisco did something stupidly backwards-incompatible in their
authentication flow.  It's hard to tell if it was due to incompetence or due
to malice towards unofficial clients
(https://gitlab.com/openconnect/openconnect/-/issues/635#note_1451782874)
but it doesn't really matter.

If merged, this should fix #544, #593, #602, #618, #635, #657, #662,
and #665.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
18 months agoBugfix GP XML config: always include portal
Daniel Lenski [Sat, 30 Sep 2023 05:02:33 +0000 (22:02 -0700)]
Bugfix GP XML config: always include portal

Ever since 8e7efd51f, the GlobalProtect *portal* has been included in the
newly-written XML config (`<ServerList>`) only if the portal config XML
contained a `<portal-name>` tag.

We should include the portal even if it doesn't have a name for itself.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
19 months agoGlobalProtect SAML completion pages sometimes have the SAML fields only in comments
Daniel Lenski [Fri, 22 Sep 2023 16:54:11 +0000 (09:54 -0700)]
GlobalProtect SAML completion pages sometimes have the SAML fields only in comments

This modifies the fake GP server to have a 'saml_comments_only' option.  If
set, the SAML completion fields ('saml-username', 'prelogin-cookie', etc.)
will be sent to the client *only* in a blob of XML wrapped in HTML comments,
and *not* in HTTP headers.

Some real GP servers are known to behave like this, and authentication
handlers like 'gp-saml-gui' need to be able to handle this case correctly
(see https://github.com/dlenski/gp-saml-gui/issues/51 and
https://github.com/dlenski/gp-saml-gui/pull/59).

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
19 months agoUpdate docs on implementing new protocols
Daniel Lenski [Sun, 10 Sep 2023 18:09:11 +0000 (11:09 -0700)]
Update docs on implementing new protocols

Signed-off-by: Daniel Lenski <dlenski@amazon.com>
19 months agoBump fallback GlobalProtect version number
Dimitri Papadopoulos [Sat, 9 Sep 2023 09:07:03 +0000 (12:07 +0300)]
Bump fallback GlobalProtect version number

Some GlobalProtect servers complain about old versions of the client
software connecting to them.

In the case of a connection via the GlobalProtect "portal" interface,
we capture the preferred software version from the portal and parrot it back,
as of https://gitlab.com/openconnect/openconnect/-/commit/c0d2daeaa85f69ed2f89330a53d97ae7eafdffb1?merge_request_iid=333.

However, we should update the GlobalProtect software version used as a fallback
in the case of a direct connection to the "gateway" interface.

Signed-off-by: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com>
Signed-off-by: Daniel Lenski <dlenski@amazon.com>