Topics for today's community meeting
Hi,
We're having an IRC meeting on Thursday, starting at 18:00 UTC on #[email protected]... Current topic list is here:
<https://community.openvpn.net/openvpn/wiki/Topics-2014-04-24>
If you have any other things you'd like to bring up, respond to this mail, send me mail privately or add them to the list yourself.
In case you can't attend the meeting, please feel free to make comments on the topics by responding to this email or to the summary email sent after the meeting. Whenever possible, we'll also respond to existing, related email threads.
NOTE: It's required to use a registered Freenode IRC nickname to join #openvpn-devel - look here for details:
<https://community.openvpn.net/openvpn/wiki/GettingHelp#DeveloperIRCchannel>
Signature · 5 lines
Samuli Seppänen Community Manager OpenVPN Technologies, Inc irc freenode net: mattock
The tls_read_plaintext error discussion continued past the e-mail chains pointed to on the meeting topic.
I don't know if I'll be able to make the IRC meeting (and I'm just a user, not a developer), so here are a couple of notes:
Both the read_plaintext error (mine) and the george ross report appear to be due to TLS1.2's extra signing algorithms that use different hashes. The good luck is that their size is different - that's what's causing us to get errors.
Mine is caused by the windows crypto api, which doesn't know how to sign the client certificate with TLS1.2's hashes.
George's is not known - but the best guess is that he may be using another external key loader (such as pkcs11, or maybe an android/ios client. Or maybe the patch that provided macOS keyring support.) His log file showes that he is also sending a client certificate, and getting a digest size error.
For these, it is not necessary to go back to TLS1.0 - TLS1.1 suffices.
The question of how to do this is open.
James has suggested the tls-version-min/max options. Having the options seems like a good thing.
However, I think they should default to max = 'highest', and min = 1.0. (We can solve the known issues behind the scenes, with less impact.)
The main reason is that once a work-around is put into a config file, it tends to stick forever. So we don't want to have lower security be sticky.
The second reason is that it requires work and knowledge of people who write config files. Since the requirement for downgrading is transient, and option-dependent, this isn't simple to document. And teaching users what to do as things change will annoy them (and us.) So the tendency will be 'least common denominator' - which is lowest security.
To deal with the issues with external key loaders, I suggest that OpenVPN can do the right thing automagically. The approach is:
When starting to setup a tunnel:
Start with min = TLS1.0, max = highest.
Add required_min, required_max initialized to 3, highest.
In options.c (where options are parsed), when an option that invokes an external loader (or other dependency on 1.2) is used:
adjust required_min/max to the larger/smaller of the component's
requirements
That is, cryptoapicert would say 'max=tls1.0', so the required max
would be decreased to 1.0
When the context is initialized, the option flags are adjusted to the larger of (min, required_min) and the smaller of (max, required_max). If they are different, a note can be logged. (tls-version-max reduced because an option doesn't support version > 'max' yet) If there is no solution, an error is logged. (tls version requirements can't be satisfied: min > max)
The advantages of this approach:
o It's simple. (takes less code than these words) o It's automatic - people who write config files won't hardcode work-arounds of lower security o It only applies to situations where it's needed - so a client that uses cryptoapicert today will go to 1.1, but a client talking to the same server with a <cert> directive will use 1.2 o As the components with dependencies are upgraded to 1.2, nothing changes in config files; the improved security will take effect automatically.
o If other dependent components (options) are identified, it's easy to add their dependencies.
A fancier implementation could have the components register their SSL version support with a formal API - but that seems like more work than a quick patch.
Note: for the known issues, a 'max' is all that's required. I included 'min' for symmetry and as a hedge for future cases.
I hope this note is helpful.
Quoted 20 lines · Samuli Seppänen
Hi,
We're having an IRC meeting on Thursday, starting at 18:00 UTC on #[email protected]... Current topic list is here:
<https://community.openvpn.net/openvpn/wiki/Topics-2014-04-24>
If you have any other things you'd like to bring up, respond to this mail, send me mail privately or add them to the list yourself.
In case you can't attend the meeting, please feel free to make comments on the topics by responding to this email or to the summary email sent after the meeting. Whenever possible, we'll also respond to existing, related email threads.
NOTE: It's required to use a registered Freenode IRC nickname to join #openvpn-devel - look here for details:
<https://community.openvpn.net/openvpn/wiki/GettingHelp#DeveloperIRCchannel>
Sorry, I'm in meeting mode at the moment. Just time to fire in a quick comment here...
Quoted 3 lines
George's is not known - but the best guess is that he may be using another external key loader (such as pkcs11, or maybe an android/ios client.
Nope. Just the following:
# TLS parameters
dh /etc/openvpn/dh1024.pem
tls-server
ca /etc/openvpn/EdUniRootCA.crt
cert /etc/openvpn/openvpn.crt+chain
extra-certs /etc/openvpn/openvpn.chain
key /etc/openvpn/openvpn.key
tls-verify /usr/lib/openvpn/dice-kx509-verify
tls-auth /etc/openvpn/tls.auth
SL6.something Linux on both ends, on a Dell server and a Dell laptop.
On our server side the certificate chain goes: University CA -> School CA -> service-signing CA -> service cert. The first two of these are kept off-line. On the client side it goes: University CA -> School CA -> KCA -> kx509-cert.
I wonder if that's just longer than most people use?
Signature · 7 lines
George D M Ross MSc PhD CEng MBCS CITP, University of Edinburgh, School of Informatics, 10 Crichton Street, Edinburgh, Scotland, EH8 9AB Mail: [email protected]... Voice: 0131 650 5147 Fax: 0131 650 6899 PGP: 1024D/AD758CC5 B91E D430 1E0D 5883 EF6A 426C B676 5C2B AD75 8CC5 The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
Quoted 6 lines · George Ross
On our server side the certificate chain goes: University CA -> School CA -> service-signing CA -> service cert. The first two of these are kept off-line. On the client side it goes: University CA -> School CA -> KCA -> kx509-cert.
I wonder if that's just longer than most people use?
That may be, but it's the size of the signature, not the size of the certificate chain that's at issue.
Thanks for the information. I'll do some more code browsing; it will help. But I'm not optimistic that we'll figure this out before tonight's meeting. I'm curious, but time-limited.
What happens is that the chain is hashed to form a fixed-length digest; the digest is then signed. This is done to validate that the chain hasn't been tampered with in-transit. Signing the hash means that the signature is over a fixed-length block, which prevents certain timing attacks.
In any case the signature (technically, digest+signature) size is independent of what's signed.
The error indicates that when signing the client certificate chain, the resulting digest is not the expected size. It's entirely a client side issue; as a result the server isn't getting the client certificate. (That's why only the client log has a useful error. The server asks for the client certificate, never gets it & times-out, causing the handshake failure.)
That can happen if the wrong algorithm is used. I still suspect that this is being triggered by using TLSV1.2.
When you're out of meeting mode, it will be useful to know whether forcing TLSV1.1 makes the problem disappear.
Any of the suggested patches should determine that. The quickest and simplest is in
src/openvpn/ssl_openssl.c
The first line of tls_ctx_set_options() looks like:
longsslopt=SSL_OP_SINGLE_DH_USE|SSL_OP_NO_TICKET|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3;
add | SSL_OP_NO_TLSv1_2
so it looks like
longsslopt=SSL_OP_SINGLE_DH_USE|SSL_OP_NO_TICKET|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3| SSL_OP_NO_TLSv1_2;
This will prevent TLSv1.2 from being used. [Likewise, | SSL_OP_NO_TLSv1_1 | SSL_OP_TLS_V1_2 disables 1.1 and 1.2].
In case code inspection doesn't produce quick results...a thought:
I'm not quite there yet, but one approach would be to start a client in a debugger - easy enough as it's Linux. How hard would it be to generate an expired /revoked certificate from your CA with a mismatched private key? That (with the CA & intermediate certs, which are not secret) should reproduce the problem. You'd get a different error on the server if the client cert ever arrived there, which it doesn't in this case.
Such a certificate/keypair wouldn't allow access to your systems, but if it does reproduce the client-side problem, it would enable us (the real developers, and me since I'm curious) to work on it independently. (The key mismatch would cause the signature not to validate; and expired + revoked should also refuse access. The server certificate isn't involved; we can use any existing server.)
Re: [Openvpn-devel] More on the George Ross failure
Having stolen a few minutes, a bit closer...
Backtracking, I believe George's error must be coming from openssl/ssl/s3_clnt.c: ssl3_send_client_verify(), the block of code starting 36 lines in, shown below.
There is a call to EVP_SignFinal, that I believe will turn out to dispatch to RSA_sign (openssl/crypto/rsa/rsa_sign.c ). There is an intermediate maze of twisty passages that abstracts the signature mechanisms, but I'm pretty sure that's where we'll end up.
RSA_sign emits RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY when the size of the signature generated by i2d_X509_SIG is larger than the size allocated for it in the RSA structure.
Again, this is dependent (indirectly) on TLS version (the check is for md5_sha1 digest, which is used before TLS1.2). The TLS1.1 path is too well-worn to be likely. The code (abbreviated) goes like this:
if(type == NID_md5_sha1) {
...
i = SSL_SIG_LENGTH;
s = m;
} else {
...
i=i2d_X509_SIG(&sig,NULL);
}
j=RSA_size(rsa);
if (i > (j-RSA_PKCS1_PADDING_SIZE))
{
RSAerr(RSA_F_RSA_SIGN,RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY);
return(0);
}This leaves the question of why the RSA structure doesn't have enough space.
Getting further back would be a lot easier with a reproducer and a debugger...
The ssl3_send_client_verify +36:
if (TLS1_get_version(s) >= TLS1_2_VERSION)
{
long hdatalen = 0;
void *hdata;
const EVP_MD *md = s->cert->key->digest;
hdatalen = BIO_get_mem_data(s->s3->handshake_buffer,
&hdata);
if (hdatalen <= 0 || !tls12_get_sigandhash(p, pkey, md))
{
SSLerr(SSL_F_SSL3_SEND_CLIENT_VERIFY,
ERR_R_INTERNAL_ERROR);
goto err;
}
p += 2;
#ifdef SSL_DEBUG
fprintf(stderr, "Using TLS 1.2 with client alg %s\n",
EVP_MD_name(md));
#endif
if (!EVP_SignInit_ex(&mctx, md, NULL)
|| !EVP_SignUpdate(&mctx, hdata, hdatalen)
|| !EVP_SignFinal(&mctx, p + 2, &u,
pkey)) <===== breakpoint goes here
{
SSLerr(SSL_F_SSL3_SEND_CLIENT_VERIFY,
ERR_R_EVP_LIB);
goto err;
}
s2n(u,p);
n = u + 4;
if (!ssl3_digest_cached_records(s))
goto err;
}.
Timothe Litt
ACM Distinguished Engineer
--------------------------
This communication may not represent the ACM or my employer's views, if any, on the matters discussed.
This communication may not represent my employer's views, if any, on the matters discussed.
Quoted 5 lines
Any of the suggested patches should determine that. The quickest and simplest is in
src/openvpn/ssl_openssl.c
...
OK, with the attached patch it does appear to work for me. I'll give it some more exercise tomorrow morning, but in a quick test the tunnel does now appear to come up properly.
src/openvpn/ssl_openssl.c renamed from src/openvpn/ssl_openssl.c.dist +1 -0
@@ -208,6 +208,7 @@/* process SSL options including minimum TLS version we will accept from peer */ {long sslopt =SSL_OP_SINGLE_DH_USE |SSL_OP_NO_TICKET | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3; + sslopt |= SSL_OP_NO_TLSv1_2;const int tls_version_min = (ssl_flags >>SSLF_TLS_VERSION_SHIFT ) &SSLF_TLS_VERSION_MASK ;if (tls_version_min >TLS_VER_1_0 ) sslopt |= SSL_OP_NO_TLSv1;
George D M Ross MSc PhD CEng MBCS CITP, University of Edinburgh, School of Informatics, 10 Crichton Street, Edinburgh, Scotland, EH8 9AB
Mail: [email protected]... Voice: 0131 650 5147 Fax: 0131 650 6899
PGP: 1024D/AD758CC5 B91E D430 1E0D 5883 EF6A 426C B676 5C2B AD75 8CC5
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336.
Hi,
Quoted 3 lines · George Ross
OK, with the attached patch it does appear to work for me. I'll give it some more exercise tomorrow morning, but in a quick test the tunnel does now appear to come up properly.
Thanks. That confirms the theory "it's the TLS negotiation patch", and in particular "TLS 1.1 works, TLS 1.2 breaks".
Now the even more interesting question is "why is it breaking for you in particular, while it works for other Linux users just fine" (half of my testbed is Linux...)
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Quoted 3 lines
"why is it breaking for you
in particular, while it works for other Linux users just fine" (half of my testbed is Linux...)
Indeed, that is the interesting question. This has to do with how the client certificate is signed by the client, which in TLS1.2 is negotiated between the client and server - and depends on the available/selected ciphers.
As I wrote here: http://sourceforge.net/p/openvpn/mailman/message/32265218/, I believe I know where this is coming from, just not why. I'd like to set a breakpoint in the client and forward/back track to find out.
George: One way to do that would be what I suggested here: http://sourceforge.net/p/openvpn/mailman/message/32264919/
Is this feasible? At this point, I think it would be the most efficient way to proceed.
I could give you instructions for creating a process dump - but a dump file would have more secrets in it than what I suggested.
The two referenced mail messages are as far as I got by inspection.
Quoted 14 lines · Gert Doering
Hi,
Quoted 3 lines · George Ross
OK, with the attached patch it does appear to work for me. I'll give it some more exercise tomorrow morning, but in a quick test the tunnel does now appear to come up properly.
Thanks. That confirms the theory "it's the TLS negotiation patch", and in particular "TLS 1.1 works, TLS 1.2 breaks".
Now the even more interesting question is "why is it breaking for you in particular, while it works for other Linux users just fine" (half of my testbed is Linux...)
gert