]> www.infradead.org Git - users/dwmw2/openconnect.git/log
users/dwmw2/openconnect.git
4 years agoimplement `auth_expiration` for Pulse protocol
Daniel Lenski [Wed, 9 Dec 2020 03:24:00 +0000 (19:24 -0800)]
implement `auth_expiration` for Pulse protocol

We have many examples of this field (AVP 0x583/0xd5c) being multiples of 60 or 3600,
strongly suggesting that it's the remaining auth lifetime:

- https://gitlab.com/openconnect/openconnect/-/issues/98: `AVP 0x583/0xd5c: 00 01 fa 40` (0x1fa40 seconds = 36 hours)
- private communication: `AVP 0x583/0xd5c: 00 00 a9 ec` (0xa9ec seconds = 12 hours)
- private communication: `AVP 0x583/0xd5c: 00 00 0a 70` (0xa70 seconds = 44 minutes)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoAdd `openconnect_get_auth_expiration` function to library and JNI
Daniel Lenski [Thu, 24 Sep 2020 23:54:57 +0000 (16:54 -0700)]
Add `openconnect_get_auth_expiration` function to library and JNI

This allows protocols to save the moment when a session's authentication
(`vpninfo->cookie`) is expected to expire and no longer be useful for
reconnection.

The motivation is to eventually allow front-ends to know whether
reauthentication is needed, or whether they should try using a cached
cookie.

Current state:

- AnyConnect protocol: expiration is determined from the CONNECT
  response header `X-CSTP-Session-Timeout-Remaining` (with
  `X-CSTP-Session-Timeout` or `X-CSTP-Lease-Duration` as upper bounds in its
  absence)
- GlobalProtect protocol: expiration is determined from the `<lifetime>` tag of
  the XML config.
- Juniper Network Connect protocol: no currently known way to determine
  expiration. The `DSID` cookie is a standard HTTP cookie, so perhaps its
  expiration timestamp is intended for this purpose; however, I can find
  no real-world case where it has an expiration timestamp set.
- None of the currently-supported protocols provide the expiration
  timestamp until the connection phase, so it can't be obtained for
  export by the `--authenticate` option.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'GP_IPv6_baby_steps' into 'master'
Daniel Lenski [Wed, 9 Dec 2020 18:03:38 +0000 (18:03 +0000)]
Merge branch 'GP_IPv6_baby_steps' into 'master'

GP: ESP debug messages and more IPv6 baby steps

See merge request openconnect/openconnect!155

4 years agochangelog
Daniel Lenski [Tue, 8 Dec 2020 22:23:30 +0000 (14:23 -0800)]
changelog

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoGP: explicitly warn when server has a missing ESP configuration
Daniel Lenski [Mon, 30 Nov 2020 22:21:21 +0000 (14:21 -0800)]
GP: explicitly warn when server has a missing ESP configuration

I'm tired of OpenConnect getting blamed for lack of ESP connectivity when in
fact literally every example that has been investigated since 2017 turned
out to be due to a missing server configuration, broken server
configuration, or network UDP blockage.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agolittle bit more GP IPv6 support
Daniel Lenski [Mon, 30 Nov 2020 20:59:14 +0000 (12:59 -0800)]
little bit more GP IPv6 support

Process <dns-v6>, <access-routes-v6>, and <exclude-access-routes-v6> tags, and only
show the long-winded "please report" message once.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'more_logging_around_Trojan_script_invocation' into 'master'
Daniel Lenski [Thu, 3 Dec 2020 23:34:07 +0000 (23:34 +0000)]
Merge branch 'more_logging_around_Trojan_script_invocation' into 'master'

more logging around Trojan script invocation (CSD/HIP/TNCC)

See merge request openconnect/openconnect!152

4 years agomore logging around Trojan script invocation (CSD/HIP/TNCC)
Daniel Lenski [Mon, 30 Nov 2020 06:41:12 +0000 (22:41 -0800)]
more logging around Trojan script invocation (CSD/HIP/TNCC)

See #203 for a recent example of where it wasn't clear that a problem was
caused by a CSD script being invoked and never returning, due to the lack of
logging.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'bugfix_MR_143' into 'master'
Daniel Lenski [Tue, 1 Dec 2020 16:41:21 +0000 (16:41 +0000)]
Merge branch 'bugfix_MR_143' into 'master'

bugfix for !143

See merge request openconnect/openconnect!153

4 years agofix undefined pointer error from !143
Daniel Lenski [Mon, 30 Nov 2020 20:35:17 +0000 (12:35 -0800)]
fix undefined pointer error from !143

Caught by static analyzer run.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'clarify_some_error_messages_which_apply_equally_to_TLS_and_DTLS_sockets...
Daniel Lenski [Mon, 30 Nov 2020 19:26:34 +0000 (19:26 +0000)]
Merge branch 'clarify_some_error_messages_which_apply_equally_to_TLS_and_DTLS_sockets' into 'master'

clarify some error messages which apply equally to TLS and DTLS sockets

See merge request openconnect/openconnect!149

4 years agoMerge branch 'GP_finesse_URL_decoding' into 'master'
Daniel Lenski [Mon, 30 Nov 2020 19:24:40 +0000 (19:24 +0000)]
Merge branch 'GP_finesse_URL_decoding' into 'master'

finesse the URL-decoding of the GP login args

See merge request openconnect/openconnect!143

4 years agoclarify some error messages which apply equally to TLS and DTLS sockets
Daniel Lenski [Mon, 30 Nov 2020 03:09:15 +0000 (19:09 -0800)]
clarify some error messages which apply equally to TLS and DTLS sockets

Clarifies #157 (but doesn't actually fix it)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'tmp-fix-centos7-failure' into 'master'
Nikos Mavrogiannopoulos [Thu, 19 Nov 2020 22:03:38 +0000 (22:03 +0000)]
Merge branch 'tmp-fix-centos7-failure' into 'master'

dtls-psk: use ping -6 to ping an ipv6 address

Closes #200

See merge request openconnect/openconnect!147

4 years ago.gitlab-ci.yml: CentosOS7/OpenSSL: mark failing test as XFAIL
Nikos Mavrogiannopoulos [Thu, 19 Nov 2020 21:24:51 +0000 (22:24 +0100)]
.gitlab-ci.yml: CentosOS7/OpenSSL: mark failing test as XFAIL

That's because the test was not functional until now (due to missing
'which' application).

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
4 years agodtls-psk: use ping -6 to ping an ipv6 address
Nikos Mavrogiannopoulos [Thu, 19 Nov 2020 20:55:56 +0000 (21:55 +0100)]
dtls-psk: use ping -6 to ping an ipv6 address

This is necessary in centos7 images.

Resolves: #200

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
4 years agoMerge branch 'GP_demangle_default_route_as_split_route' into 'master'
Daniel Lenski [Thu, 19 Nov 2020 18:23:16 +0000 (18:23 +0000)]
Merge branch 'GP_demangle_default_route_as_split_route' into 'master'

GP: Fix the issue of a 0.0.0.0/0 "split"-include route by swapping the "split" route with the default netmask.

See merge request openconnect/openconnect!118

4 years agoMerge branch 'GP_unexpected_value_of_connected-gw-ip' into 'master'
Daniel Lenski [Thu, 19 Nov 2020 18:19:38 +0000 (18:19 +0000)]
Merge branch 'GP_unexpected_value_of_connected-gw-ip' into 'master'

GP: ask user to report unexpected value of <connected-gw-ip>

See merge request openconnect/openconnect!144

4 years agoMerge branch 'enable_insecure_debugging' into 'master'
Daniel Lenski [Tue, 17 Nov 2020 20:29:22 +0000 (20:29 +0000)]
Merge branch 'enable_insecure_debugging' into 'master'

Enable insecure debugging

See merge request openconnect/openconnect!112

4 years agoMerge branch 'delay_tunnel_and_close' into 'master'
Daniel Lenski [Tue, 17 Nov 2020 20:26:55 +0000 (20:26 +0000)]
Merge branch 'delay_tunnel_and_close' into 'master'

delay_tunnel_reason and delay_close

See merge request openconnect/openconnect!117

4 years agoMerge branch 'tmp-add-scan-build' into 'master'
Nikos Mavrogiannopoulos [Tue, 17 Nov 2020 20:22:25 +0000 (20:22 +0000)]
Merge branch 'tmp-add-scan-build' into 'master'

Add clang's static analyzer to CI

See merge request openconnect/openconnect!139

4 years agoGP: ask user to report unexpected value of <connected-gw-ip>
Daniel Lenski [Sun, 15 Nov 2020 23:32:08 +0000 (15:32 -0800)]
GP: ask user to report unexpected value of <connected-gw-ip>

We don't know what this one means, but it seems likely that we need to do
some special processing if this differs from the VPN server's external IP
address.

See https://gitlab.com/openconnect/openconnect/-/issues/193#note_447466255
for an example of this field observed "in the wild".

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'less_confusing_output_when_authentication_fails' into 'master'
Daniel Lenski [Tue, 17 Nov 2020 19:41:31 +0000 (19:41 +0000)]
Merge branch 'less_confusing_output_when_authentication_fails' into 'master'

less confusing output when authentication fails

See merge request openconnect/openconnect!146

4 years agointernal_parse_url: fix memory leak
Nikos Mavrogiannopoulos [Mon, 16 Nov 2020 22:10:48 +0000 (23:10 +0100)]
internal_parse_url: fix memory leak

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
4 years agontlm_manual_challenge: initialize hash to zero
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 15:18:04 +0000 (16:18 +0100)]
ntlm_manual_challenge: initialize hash to zero

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agognutls: removed unused assignments, and use gnutls_calloc()
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 15:15:17 +0000 (16:15 +0100)]
gnutls: removed unused assignments, and use gnutls_calloc()

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agoopenconnect_set_token_mode: propagate error code
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 15:07:30 +0000 (16:07 +0100)]
openconnect_set_token_mode: propagate error code

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agooncp_connect: avoid code without side-effects
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 15:06:15 +0000 (16:06 +0100)]
oncp_connect: avoid code without side-effects

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agoprocess_http_response: removed default error code
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 15:04:47 +0000 (16:04 +0100)]
process_http_response: removed default error code

It was not used by any of the code paths.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agooncp_connect: bail on error
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 15:04:04 +0000 (16:04 +0100)]
oncp_connect: bail on error

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agodecrypt_stoken: avoid code without side effects
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 15:03:10 +0000 (16:03 +0100)]
decrypt_stoken: avoid code without side effects

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agoappend_compr_types: removed unnecessary assignment
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 15:01:30 +0000 (16:01 +0100)]
append_compr_types: removed unnecessary assignment

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agobuf_tlv: corrected TLV decoding
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 15:00:24 +0000 (16:00 +0100)]
buf_tlv: corrected TLV decoding

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agodtls_detect_mtu: removed unnecessary initialization
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 14:58:26 +0000 (15:58 +0100)]
dtls_detect_mtu: removed unnecessary initialization

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agoparse_prelogin_xml: removed unnecessary initialization
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 14:57:51 +0000 (15:57 +0100)]
parse_prelogin_xml: removed unnecessary initialization

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agodo_https_request: removed unused assignment
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 14:55:31 +0000 (15:55 +0100)]
do_https_request: removed unused assignment

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agostart_cstp_connection: avoid unused assignment
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 14:54:19 +0000 (15:54 +0100)]
start_cstp_connection: avoid unused assignment

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agocleanup_gssapi_auth: avoid null pointer dereference
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 14:48:30 +0000 (15:48 +0100)]
cleanup_gssapi_auth: avoid null pointer dereference

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agoprocess_http_response: avoid memory leak
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 14:47:25 +0000 (15:47 +0100)]
process_http_response: avoid memory leak

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agorun_hip_script: made error handling consistent
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 14:36:06 +0000 (15:36 +0100)]
run_hip_script: made error handling consistent

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agoparse_hex: avoid zero length allocation
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 13:59:33 +0000 (14:59 +0100)]
parse_hex: avoid zero length allocation

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years ago.gitlab-ci.yml: added clang's static analyzer
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 13:44:32 +0000 (14:44 +0100)]
.gitlab-ci.yml: added clang's static analyzer

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agoMerge branch 'tmp-add-ubsan-asan' into 'master'
Nikos Mavrogiannopoulos [Tue, 17 Nov 2020 12:52:50 +0000 (12:52 +0000)]
Merge branch 'tmp-add-ubsan-asan' into 'master'

Add support for address and undefined sanitizers in the CI

See merge request openconnect/openconnect!140

4 years agoless confusing output when authentication fails
Daniel Lenski [Mon, 16 Nov 2020 22:00:47 +0000 (14:00 -0800)]
less confusing output when authentication fails

* "Failed to obtain WebVPN cookie" → "Failed to complete authentication"
  (WebVPN is Cisco-specific and unclear to end users)
* GlobalProtect shouldn't treat a SAML-required login response as a failure to *parse*
  the login response. This results in unnecessary and confusing logging. (ping #197)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agochangelog
Daniel Lenski [Thu, 15 Oct 2020 01:40:48 +0000 (18:40 -0700)]
changelog

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoreduce level of delay_tunnel/delay_close logging
Daniel Lenski [Thu, 21 May 2020 17:09:58 +0000 (10:09 -0700)]
reduce level of delay_tunnel/delay_close logging

See https://gitlab.com/openconnect/openconnect/-/merge_requests/117#note_346745240

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years ago-b/--background: check for error when fork()ing
Daniel Lenski [Mon, 16 Nov 2020 21:37:37 +0000 (13:37 -0800)]
-b/--background: check for error when fork()ing

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agouse setup_tun callback to defer printing connection status AND backgrounding until...
Daniel Lenski [Wed, 20 May 2020 05:06:34 +0000 (22:06 -0700)]
use setup_tun callback to defer printing connection status AND backgrounding until tun_is_up

This will make scripted use of OpenConnect a lot less sensitive to timing of the tunnel
coming up, if a script is trying to use the tunnel as soon as the main process exits.
(See https://gitlab.com/openconnect/openconnect/-/issues/117 for examples.)

Here's a log of OpenConnect connecting to a GlobalProtect server where ESP
fails to start succesfully due to a firewall blocking UDP. With this
change, it doesn't print the connection status or go to background until after the
attempt to connect ESP has failed, and the tunnel has been started.

    $ echo PASSWORD | sudo ./openconnect -u USERNAME vpn.company.com/gateway --prot=gp --passwd-on-stdin -b \
                           -s 'echo +++ vpnc-script called with reason $reason'
    POST https://vpn.company.com/ssl-vpn/prelogin.esp?tmp=tmp&clientVer=4100&clientos=Linux
    Connected to 1.2.3.4:443
    SSL negotiation with vpn.company.com
    Connected to HTTPS on vpn.company.com with ciphersuite (TLS1.2)-(RSA)-(AES-256-GCM)
    Enter login credentials
    POST https://vpn.company.com/ssl-vpn/login.esp
    POST https://vpn.company.com/ssl-vpn/getconfig.esp
    Session will expire after 1440 minutes.
    Tunnel timeout (rekey interval) is 180 minutes.
    Idle timeout is 180 minutes.
    No MTU received. Calculated 1214 for ESP tunnel
    POST https://vpn.company.com/ssl-vpn/hipreportcheck.esp
    Delaying tunnel for 1000 ms with reason: awaiting GPST ESP connection
    Delaying tunnel for 1000 ms with reason: awaiting GPST ESP connection
    Delaying tunnel for 1000 ms with reason: awaiting GPST ESP connection
    Delaying tunnel for 1000 ms with reason: awaiting GPST ESP connection
    Delaying tunnel for 1000 ms with reason: awaiting GPST ESP connection
    Delaying tunnel for 1000 ms with reason: awaiting GPST ESP connection
    Failed to connect ESP tunnel; using HTTPS instead.
    Connected as 10.0.1.2, using SSL, with ESP unsuccessful
    Continuing in background; pid 1234
    +++ vpnc-script called with reason pre-init
    +++ vpnc-script called with reason connect
    $

Here's an example of attempted DTLS connecting on an AnyConnect VPN, where DTLS
never succeeds. This right away gives us some good feedback that we could probably
reduce the duration of the loop:

    Connected to 1.2.3.4:443
    SSL negotiation with vpn.company.com
    Server certificate verify failed: signer not found
    Connected to HTTPS on vpn.company.com with ciphersuite (TLS1.2)-(ECDHE-RSA-SECP384R1)-(AES-256-GCM)
    Got CONNECT response: HTTP/1.1 200 OK
    CSTP connected. DPD 30, Keepalive 20
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    DTLS handshake failed: Resource temporarily unavailable, try again.
    Delaying tunnel for 1000 ms with reason: DTLS MTU detection
    Connected as 10.0.1.2, using SSL, with DTLS in progress

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agofactor out print_connection_info()
Daniel Lenski [Wed, 20 May 2020 05:04:23 +0000 (22:04 -0700)]
factor out print_connection_info()

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agowe should still try to cleanly close the session if tun device creation fails
Daniel Lenski [Sun, 17 May 2020 00:09:24 +0000 (17:09 -0700)]
we should still try to cleanly close the session if tun device creation fails

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agouse delay_tunnel_reason for OC DTLS MTU detection and GPST ESP connection delays
Daniel Lenski [Wed, 20 May 2020 06:28:55 +0000 (23:28 -0700)]
use delay_tunnel_reason for OC DTLS MTU detection and GPST ESP connection delays

As suggested here: https://gitlab.com/openconnect/openconnect/-/commit/55ffb457010974c05096a78ac917692b7fac664b#note_343873848

There's no clear rationale for using with Pulse/oNCP ESP setup (yet):
- We don't do any MTU detection
- Unlike GPST, we can start sending and receiving packets via the TLS tunnel
  immediately, while attempting to connect ESP as well.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoadd delay_tunnel_reason and delay_close
Daniel Lenski [Sun, 17 May 2020 00:06:10 +0000 (17:06 -0700)]
add delay_tunnel_reason and delay_close

- As long as the protocol-specific mainloop sets delay_tunnel_reason to a non-NULL value, tunnel
  device creation will be delayed.

- If delay_close is set, mainloop will continue to iterate even if cancel_cmd or pause_cmd is set.

  A protocol should set DELAY_CLOSE_IMMEDIATE_CALLBACK for the case where its mainloop needs an
  immediate callback (e.g. to send some kind of termination request), and DELAY_CLOSE_WAIT for the
  case where its mainloop is waiting to receive something (e.g. a termination acknowledgement).

openconnect_mainloop() will unset both delay_tunnel_reason and delay_close on each iteration. A
protocol mainloop must thus affirmatively extend a delay in order for it to continue.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agomain: avoid unnecessary memory copy (and leak)
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 14:45:35 +0000 (15:45 +0100)]
main: avoid unnecessary memory copy (and leak)

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years ago.gitlab-ci.yml: added address and undefined sanitizer runs
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 16:09:36 +0000 (17:09 +0100)]
.gitlab-ci.yml: added address and undefined sanitizer runs

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agoFree memory obtained from openconnect_get_peer_cert_DER
Nikos Mavrogiannopoulos [Thu, 12 Nov 2020 16:53:00 +0000 (17:53 +0100)]
Free memory obtained from openconnect_get_peer_cert_DER

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agoMerge branch 'Windows_tuntap_fix_196' into 'master'
Nikos Mavrogiannopoulos [Mon, 16 Nov 2020 20:04:11 +0000 (20:04 +0000)]
Merge branch 'Windows_tuntap_fix_196' into 'master'

Windows tuntap driver: accept modified ComponentId ('root\tap0901' instead of just 'tap0901')

Closes #196

See merge request openconnect/openconnect!145

4 years agoWindows tuntap driver: accept modified ComponentId ('root\tap0901' instead of just...
Daniel Lenski [Mon, 16 Nov 2020 17:00:03 +0000 (09:00 -0800)]
Windows tuntap driver: accept modified ComponentId ('root\tap0901' instead of just 'tap0901')

Closes #196

See https://patchwork.openvpn.net/patch/555/#1144 for the similar patch
applied by OpenVPN itself, and discussion thereof.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'coverity' into 'master'
Daniel Lenski [Mon, 16 Nov 2020 16:27:35 +0000 (16:27 +0000)]
Merge branch 'coverity' into 'master'

.gitlab-ci.yml: use centos8 build for coverity

See merge request openconnect/openconnect!142

4 years agofinesse the URL-decoding of the GP login args
Daniel Lenski [Thu, 15 Oct 2020 05:01:34 +0000 (22:01 -0700)]
finesse the URL-decoding of the GP login args

Unsurprisingly, it's messier than I thought it was.  Some of them definitely
need to be URL-decoded, and some definitely shouldn't be.
https://gitlab.com/openconnect/openconnect/-/issues/147#note_429943037

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years ago.gitlab-ci.yml: use centos8 build for coverity
Nikos Mavrogiannopoulos [Sat, 14 Nov 2020 21:10:52 +0000 (22:10 +0100)]
.gitlab-ci.yml: use centos8 build for coverity

This removes the need to keep a fedora31 image.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
4 years agoMerge branch 'vpninfo-port' into 'master'
Nikos Mavrogiannopoulos [Sat, 14 Nov 2020 19:51:59 +0000 (19:51 +0000)]
Merge branch 'vpninfo-port' into 'master'

setup default port 443 in openconnect_vpninfo_new

See merge request openconnect/openconnect!141

4 years agocheck that port is in valid range
Lukáš Karas [Sat, 14 Nov 2020 19:20:09 +0000 (20:20 +0100)]
check that port is in valid range

Signed-off-by: Lukas Karas <lukas.karas@centrum.cz>
4 years agoremove port setup in ssl connect
Lukáš Karas [Sat, 14 Nov 2020 19:15:40 +0000 (20:15 +0100)]
remove port setup in ssl connect

Signed-off-by: Lukas Karas <lukas.karas@centrum.cz>
4 years agosetup default port 443 in openconnect_vpninfo_new
Lukáš Karas [Sat, 14 Nov 2020 16:18:28 +0000 (17:18 +0100)]
setup default port 443 in openconnect_vpninfo_new

Signed-off-by: Lukas Karas <lukas.karas@centrum.cz>
4 years agoMerge branch 'bugfix_TUNDEV' into 'master'
Daniel Lenski [Thu, 12 Nov 2020 17:12:08 +0000 (17:12 +0000)]
Merge branch 'bugfix_TUNDEV' into 'master'

bugfix: ensure vpnc-script receives TUNDEV even without -i option

Closes #192

See merge request openconnect/openconnect!138

4 years agoMerge branch 'add_secure_cookie_protocol_field' into 'master'
Daniel Lenski [Thu, 12 Nov 2020 17:09:03 +0000 (17:09 +0000)]
Merge branch 'add_secure_cookie_protocol_field' into 'master'

add secure_cookie protocol field

See merge request openconnect/openconnect!137

4 years agobugfix: ensure vpnc-script receives TUNDEV even without -i option
Daniel Lenski [Wed, 11 Nov 2020 21:56:31 +0000 (13:56 -0800)]
bugfix: ensure vpnc-script receives TUNDEV even without -i option

Closes #192; corrects !122.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoThe resurrection of --no-cert-check was not met with universal acclaim
Daniel Lenski [Fri, 15 May 2020 20:42:28 +0000 (13:42 -0700)]
The resurrection of --no-cert-check was not met with universal acclaim

How about `--servercert=ACCEPT`, along with the usual exhortation to use the real `--servercert` option?

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoAdd `./configure --enable-insecure-debugging` option.
Daniel Lenski [Fri, 15 May 2020 16:16:51 +0000 (09:16 -0700)]
Add `./configure --enable-insecure-debugging` option.

This re-enables --no-cert-check (removed in v7.08 as insecure), and makes SIGINT / Control-C not logout the session.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoremove --no-cert-check from options list
Daniel Lenski [Fri, 15 May 2020 17:15:32 +0000 (10:15 -0700)]
remove --no-cert-check from options list

Pretty sure it was only inadvertently still in there.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoadd secure_cookie protocol field to suppress other protocols' cookies from --dump...
Daniel Lenski [Fri, 15 May 2020 17:00:03 +0000 (10:00 -0700)]
add secure_cookie protocol field to suppress other protocols' cookies from --dump-http-traffic as well

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'tmp-use-presaved-images' into 'master'
Nikos Mavrogiannopoulos [Wed, 11 Nov 2020 20:56:14 +0000 (20:56 +0000)]
Merge branch 'tmp-use-presaved-images' into 'master'

.gitlab-ci.yml: use prebuilt images from project's registry

See merge request openconnect/openconnect!135

4 years agoMerge branch 'tmp-link-vpnc-script-gitlab' into 'master'
Nikos Mavrogiannopoulos [Wed, 11 Nov 2020 20:27:55 +0000 (20:27 +0000)]
Merge branch 'tmp-link-vpnc-script-gitlab' into 'master'

www: updated links to vpnc-script

See merge request openconnect/openconnect!136

4 years agowindows builds: run the right openconnect executable
Nikos Mavrogiannopoulos [Wed, 11 Nov 2020 13:10:24 +0000 (14:10 +0100)]
windows builds: run the right openconnect executable

Also disable certain tests which fail due to wine failing to
start.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agowww: updated links to vpnc-script
Nikos Mavrogiannopoulos [Wed, 11 Nov 2020 13:37:45 +0000 (14:37 +0100)]
www: updated links to vpnc-script

These now point to gitlab.com.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years ago.gitlab-ci.yml: use prebuilt images from project's registry
Nikos Mavrogiannopoulos [Wed, 11 Nov 2020 11:37:04 +0000 (12:37 +0100)]
.gitlab-ci.yml: use prebuilt images from project's registry

This removes the dependency to dockerhub which imposed limits
and avoids the installation of packages during test time speeding
up the CI process.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
4 years agoGP: Fix the issue of a 0.0.0.0/0 "split"-include route by swapping the "split" route...
Daniel Lenski [Sun, 24 May 2020 18:47:37 +0000 (11:47 -0700)]
GP: Fix the issue of a 0.0.0.0/0 "split"-include route by swapping the "split" route with the default netmask.

GlobalProtect VPNs always or almost always send `<netmask>255.255.255.255</netmask>` (host route). If they
wish to include a true IPv4 default route (`0.0.0.0/0`), they send it a "split"-include route.

This interferes with NetworkManager users’ ability to use the "Use only for
resources on this connection" feature of NM's VPN plugins.  (Which basically
tells NM to use only split routes from the connection, and ignore a default route.)

This patch detects the case of a 0.0.0.0/0 IPv4 "split"-include route, and swaps it to become the default
default route.

See: https://gitlab.gnome.org/GNOME/NetworkManager-openconnect/-/merge_requests/12#note_818780

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'explicitly_allow_3DES-CBC_for_GnuTLS' into 'master'
Daniel Lenski [Wed, 4 Nov 2020 22:13:39 +0000 (22:13 +0000)]
Merge branch 'explicitly_allow_3DES-CBC_for_GnuTLS' into 'master'

add --allow-insecure-crypto, and tests so that we don't break on old crypto

Closes #145

See merge request openconnect/openconnect!114

4 years agoadd obsolete-server-crypto and pfs tests
Daniel Lenski [Mon, 18 May 2020 21:59:40 +0000 (14:59 -0700)]
add obsolete-server-crypto and pfs tests

These are designed to ensure that we don't inadvertently break compatibility
with legacy/obsolete server crypto, and also that we don't *inadvertently
connect* to less-secure crypto than requested.

Current checks:

- connect to a server whose only ciphers are 3DES and/or RC4 [if and only
  if] `--allow-insecure-crypto` is specified
- connect to a server whose only KX is RSA KX [if and only if] `--pfs` is
  [not specified]

Tricky parts:

- Override GnuTLS system crypto policy in obsolete-server-crypto test config,
  because this may be needed for newer versions of GnuTLS to obey it. (per nmav:
  https://gitlab.com/openconnect/openconnect/-/issues/145#note_346497960)
- OpenSSL 1.1.0+ removes 3DES and RC4 from the default build
  (https://www.openssl.org/blog/blog/2016/08/24/sweet32), so there is no way
  to re-enable without rebuilding from source.  Therefore, obsolete-server-crypto
  test is marked as XFAIL on all CI builds using it.
- Recent GnuTLS versions which support TLS1.3 implicitly allow non-RSA KX (due to
  VERS-TLS1.3 ciphersuites) even when -KX-ALL:+RSA is in the priority string; in
  order to actually test RSA-only KX, we need to ensure that TLS1.3 is disabled.
  See #149.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agomodify tests/common.sh so that launch_simple_sr_server() → test → cleanup() can be...
Daniel Lenski [Mon, 18 May 2020 22:57:00 +0000 (15:57 -0700)]
modify tests/common.sh so that launch_simple_sr_server() → test → cleanup() can be used repeatedly in a single script

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoadd --allow-insecure-crypto, and corresponding API functions, to explicitly enable...
Daniel Lenski [Mon, 18 May 2020 17:54:03 +0000 (10:54 -0700)]
add --allow-insecure-crypto, and corresponding API functions, to explicitly enable 3DES/RC4/SHA1

This closes #145, and adds tests intended to prevent similar situations from recurring.

Allowing the ancient, broken 3DES and RC4 ciphers is insecure; we do not
want to (re-)enable them by default.  (See discussion:
https://gitlab.com/openconnect/openconnect/-/issues/145#note_344687335)

However, some still-in-use VPN servers can't do any better. So instead, we
explicitly disable them, unless explicitly enabled with the
`--allow-insecure-crypto` option, or corresponding API functions.

Also attempts to future-proof --allow-obsolete-crypto a bit, by setting
`%VERIFY_ALLOW_SIGN_WITH_SHA1` (per nmav:
https://gitlab.com/openconnect/openconnect/-/merge_requests/114#note_346496796),
and explicitly enabling SHA1 (which was moved to GnuTLS “bad hashes list” in
1d75e116b1681d0e6b140d7530e7f0403088da88)

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'token_input_in_second_password_in_Juniper_frmLogin' into 'master'
Daniel Lenski [Wed, 4 Nov 2020 21:41:41 +0000 (21:41 +0000)]
Merge branch 'token_input_in_second_password_in_Juniper_frmLogin' into 'master'

Token input in second password in Juniper frmLogin

See merge request openconnect/openconnect!121

4 years agostyle nitpicks, expand clarifying comment, changelog
Daniel Lenski [Wed, 24 Jun 2020 23:01:18 +0000 (16:01 -0700)]
style nitpicks, expand clarifying comment, changelog

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoJuniper: support password and 2FA fields in the same form
Ash Holland [Wed, 24 Jun 2020 21:26:28 +0000 (22:26 +0100)]
Juniper: support password and 2FA fields in the same form

Juniper login forms typically ask for the password in the first form,
then put the 2FA field in a later form. However, some use a second
password field in the first form (usually frmLogin) for the 2FA token.
We now assume password fields after the first in a frmLogin to be 2FA
fields to cope with this case.

Signed-off-by: Ash Holland <ash@sorrel.sh>
4 years agoMerge branch 'Juniper_form_action_remediate.cgi_indicates_TNCC_failure' into 'master'
Daniel Lenski [Wed, 4 Nov 2020 20:35:16 +0000 (20:35 +0000)]
Merge branch 'Juniper_form_action_remediate.cgi_indicates_TNCC_failure' into 'master'

Juniper unknown forms with action remediate.cgi seem to indicate TNCC/Host Checker failure

See merge request openconnect/openconnect!130

4 years agoJuniper unknown forms with action remediate.cgi seem to indicate TNCC/Host Checker...
Daniel Lenski [Fri, 7 Aug 2020 18:34:34 +0000 (11:34 -0700)]
Juniper unknown forms with action remediate.cgi seem to indicate TNCC/Host Checker failure: log error about this

Suggested at https://gitlab.com/openconnect/openconnect/-/issues/175#note_392561212

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'bump_emulated_GlobalProtect_version_number' into 'master'
Daniel Lenski [Wed, 4 Nov 2020 20:27:38 +0000 (20:27 +0000)]
Merge branch 'bump_emulated_GlobalProtect_version_number' into 'master'

bump emulated GlobalProtect version number

See merge request openconnect/openconnect!131

4 years agochangelog
Daniel Lenski [Thu, 15 Oct 2020 01:21:15 +0000 (18:21 -0700)]
changelog

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agobump emulated GlobalProtect version number
Daniel Lenski [Thu, 13 Aug 2020 17:00:58 +0000 (10:00 -0700)]
bump emulated GlobalProtect version number

Apparently some GlobalProtect servers complain about old versions of the client connecting to them, so we should periodically bump up the version number of the client that we emulate.

See https://gitlab.com/openconnect/openconnect/-/issues/176#note_395207613

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'master' into 'master'
Daniel Lenski [Wed, 4 Nov 2020 00:05:06 +0000 (00:05 +0000)]
Merge branch 'master' into 'master'

Make correct TUNDEV value available to vpnc-script during pre-init

See merge request openconnect/openconnect!122

4 years agoMerge branch 'coverity' into 'master'
Daniel Lenski [Tue, 3 Nov 2020 23:56:14 +0000 (23:56 +0000)]
Merge branch 'coverity' into 'master'

.gitlab-ci.yml: run coverity weekly with a scheduled run

See merge request openconnect/openconnect!127

4 years ago.gitlab-ci.yml: run coverity weekly with a scheduled run
Nikos Mavrogiannopoulos [Thu, 30 Jul 2020 15:19:25 +0000 (17:19 +0200)]
.gitlab-ci.yml: run coverity weekly with a scheduled run

This also fixes the image for coverity to fedora31 to avoid
gcc compatibility issues. The reason for moving to scheduled
runs is that there is a limit to coverity runs per project.

Signed-off-by: Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
4 years agoMerge branch 'fix_duplicate_bitfield_constant' into 'master'
Daniel Lenski [Tue, 3 Nov 2020 22:35:11 +0000 (22:35 +0000)]
Merge branch 'fix_duplicate_bitfield_constant' into 'master'

fix duplicate bitfield constant

See merge request openconnect/openconnect!115

4 years agofix duplicate bitfield constant
Daniel Lenski [Wed, 20 May 2020 00:47:30 +0000 (17:47 -0700)]
fix duplicate bitfield constant

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoMerge branch 'hipreport' into 'master'
Daniel Lenski [Tue, 3 Nov 2020 22:15:16 +0000 (22:15 +0000)]
Merge branch 'hipreport' into 'master'

hipreport.sh: Vary emulated report output by platform (Windows vs. Linux)

See merge request openconnect/openconnect!129

4 years agoAdded platform name to the HIP report script
Roberto Leinardi [Wed, 5 Aug 2020 08:31:25 +0000 (10:31 +0200)]
Added platform name to the HIP report script

It is now possible to send an optional platform to the script using the
parameter `--client-os` (defaults to `Windows` if parameter is missing).

We still don't know how the Mac XML looks like so, in case the platform
value is not `Linux`, it will be always defaulted to Windows.

Signed-off-by: Roberto Leinardi <leinardi@gmail.com>
4 years agoMerge branch 'fix_CI' into 'master'
Daniel Lenski [Tue, 3 Nov 2020 21:59:21 +0000 (21:59 +0000)]
Merge branch 'fix_CI' into 'master'

fix CI and coverage

See merge request openconnect/openconnect!134

4 years agore-add socket_wrapper and softhsm support to CentOS8 CI
Daniel Lenski [Thu, 21 May 2020 17:52:11 +0000 (10:52 -0700)]
re-add socket_wrapper and softhsm support to CentOS8 CI

It appears that a separate Power Tools repository needs to be enabled for `{uid,socket}_wrapper` in CentOS8.
See https://centos.pkgs.org/8/centos-powertools-x86_64/uid_wrapper-1.2.4-4.el8.x86_64.rpm.html and https://serverfault.com/questions/997896/how-to-enable-powertools-repository-in-centos-8

For softhsm, this should work per nmav: https://gitlab.com/openconnect/openconnect/-/issues/145#note_347864560

The auth-nonascii test, and DSA cert tests, are now failing again, and needs to be disabled.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agoGitlab has CI images for Ubuntu 18.04, so let's include those too.
Daniel Lenski [Fri, 22 May 2020 16:39:39 +0000 (09:39 -0700)]
Gitlab has CI images for Ubuntu 18.04, so let's include those too.

Signed-off-by: Daniel Lenski <dlenski@gmail.com>
4 years agofix CI
Daniel Lenski [Wed, 14 Oct 2020 23:27:20 +0000 (16:27 -0700)]
fix CI

- dtls-psk is frequently failing; add 1-second wait AFTER tunnel interface appears
- (already merged in !128) CentOS8 now has GnuTLS with client random bug fixed (remove XFAIL_TESTS="dtls-psk")
- (already merged in !128) Fedora 32 needs crypto-policies-scripts package for update-crypto-policies to work

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