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.
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)
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.
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
.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.
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.
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
Daniel Lenski [Tue, 28 Jul 2020 21:38:31 +0000 (14:38 -0700)]
enable csd-wrapper.sh/csd-post.sh to run insecurely (no cert validation) for compatibility with ancient cURL
cURL <7.39 doesn't have `--pinnedpubkey` option. Falling back to insecure connection to CSD server (as we did until 4385272562d8e01166f31207938a08bec0a6fc4f) is the easiest band-aid.
CentOS 7 is affected, as described in https://lists.infradead.org/pipermail/openconnect-devel/2020-July/004886.html
Daniel Lenski [Thu, 21 Dec 2017 06:56:58 +0000 (22:56 -0800)]
Protocols should try explicitly request the same IP addresses on reconnect, since they will abort if new addresses are sent by the server.
* GlobalProtect:
- Supported and used by official clients (POST /ssl-vpn/getconfig.esp with preferred-ip form field).
- GlobalProtect servers often give different IP addresses on reconnect if this mechanism is *not* used,
so this mechanism is necessary.
- Same mechanism appears to exist for IPv6 (preferred-ipv6) and was added to OpenConnect in d6db0ec03394234d41fbec7ffc794ceeb486a8f0, even though IPv6 support is not yet complete.
* AnyConnect:
- Not (yet) supported by ocserv
- It appears that *some* AnyConnect server will try to provide the IP address provided in the X-CSTP-Address
*request* header along with the CONNECT request, but other servers appear not to
- This patch reproduces the behavior of GPST: attempt to request same IPv4 and IPv6 addresses on reconnect,
via CONNECT headers.
* Juniper:
- There does not appear to be any way to provide this using the Juniper NC protocol.
- No known reports of Juniper servers giving out different IP address on reconnect.
Daniel Lenski [Tue, 13 Oct 2020 02:26:10 +0000 (19:26 -0700)]
handle errors on initial TLS connection identically to subsequent reconnection
In order to write OpenConnect wrapper scripts that decouple the
authentication phase and tunnel phase, while caching authentication cookies,
we need to be able to reliably distinguish errors from invalid/expired
cookies from other errors. This makes that possible.
Nikos Mavrogiannopoulos [Sat, 31 Oct 2020 11:58:55 +0000 (12:58 +0100)]
gnutls: try multiple hashes when checking for pub/priv key match
This also ensures that we don't take into account the state of the
algorithm (e.g., marked as insecure), because it does matter for
checking whether the keys match.
Previously a change in Fedora release would result to several weeks or
months of broken CI. Fix on a specific version so that the CI is stable,
even if that comes at the cost of a manual update of the fedora CI.
This removes dtls-psk from XFAIL in centos8 as it is no longer applicable,
adds crypto policies script from missing targets, and checks for both
devices prior to adding routes in dtls-psk.
Sergei Trofimovich [Fri, 8 May 2020 14:39:41 +0000 (10:39 -0400)]
gnutls: prevent buffer overflow in get_cert_name
The test suite for ocserv calls openconnect with a certificate that has
a name that is 84 bytes in length. The buffer passed to get_cert_name is
currently 80 bytes.
The gnutls_x509_crt_get_dn_by_oid function will update the buffer size
parameter if the buffer is too small.
RETURNS
GNUTLS_E_SHORT_MEMORY_BUFFER if the provided buffer is not long
enough, and in that case the buf_size will be updated with the
required size. GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE if there are no
data in the current index. On success 0 is returned.
Use a temporary variable to avoid clobbering the namelen variable that is
passed to get_cert_name.
Bug: https://bugs.gentoo.org/721570 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> Signed-off-by: Mike Gilbert <floppym@gentoo.org>