问题原文
原帖链接 · yurtesen · CC BY-SA 4.0
If I understand correctly from OpenVPN 2.4 manual, if one is using
ECDH TLS cipher suitesthen they can setdh none. This will have same security level (or better) as using dh key, is this a correct assumption?About the tls-auth, the manual says "Use –tls-crypt instead if you want to use the key file to not only authenticate, but also encrypt the TLS control channel.".
Currently I do NOT have tls-auth or tls-crypt setup in configuration but in logs I see
Control Channel: TLSv1.2, cipher TLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384, 521 bit EC, curve: secp521r1
Does that mean that tls-crypt option is NOT necessary if elliptic curve is used? or what additional security does tls-crypt add if control channel is already encrypted even without this option? and does it make any difference if one is using UDP or TCP?
Thanks!
已采纳解答
原帖链接 · Piotr P. Karwasz · CC BY-SA 4.0
ECDHandDHare both variants of the Diffie-Hellman key exchange and require an abelian group with computationally complex division. However:Generating good finite fields for the
DHalgorithm is relatively easy (though time consuming), so OpenVPN asks you to do it withopenssl dhparamand provide the result withdh <filename>. This way you don't use the predefined groups that might be subject to the Logjam attack, which is within NSA budget. However, factorization in finite fields is a well understood subject, soDHis slower thanECDHwith a comparable level of security.Generating good elliptic curves is difficult, so you must use the predefined ones and there is no
ecdh <filename>option. As for thedhoption, you can usedh nonewith elliptic curves. Division on an elliptic curve is not very well developed, so to have a similar level of security asDHnowadays you need smaller curves.
Even without the
tls-authortls-cryptoptions, your data will always be encrypted. TheTLSprotocol encrypts data with a key obtained in a key exchange, as in the previous point. These options control what to do with the 4 packets of the TLS Handshake:Usually (as in the
HTTPSprotocol) they are unencrypted since the peers don't have any prior knowledge of each other. But with OpenVPN you have an advantage: you can configure on the server and all authorized clients a common symmetric key, which will sign or encrypt these 4 packets.This will allow the server to drop all not signed
ClientHellomessages, before even allocating resources for the computationally heavyTLSprotocol. Hence, it will more easily survive aDDoSattack, where an attacker initiates thousands of connections at once.Using
tls-authis similar to configuring a commonWEPkey on a Wi-Fi network, together with a per-clientWPA-Enterpriseauthentication. The main difference is thatWEPencryption is heavily broken, whereasHMACsignatures orAESencryption isn't. Therefore you won't be able to reproduce the aforementioned configuration on a Wi-Fi network (it is not supported by software).The
UDPvsTCPchoice is a no brainer: useUDPwhenever possible.TCPguarantees that all emitted IP packets will not be lost and will arrive in the order they were sent.This sounds nice, but your
VPNtunnel will also transport innerTCPconnections. If a packet is lost, both theOpenVPNclient and the program that established the innerTCPconnection will start retransmitting. However the retransmitted packets from the inner connection will arrive to their destination after those retransmitted byOpenVPNwere delivered. This causes unnecessary network traffic.
Edit: A comparison between the strength of DH and ECDH is available e.g. on Keylength.com:
the required size of the
DHgroup is in the columnDiscrete Logarithm Group,the size of an elliptic curve with equivalent strength is in the column
Elliptic Curve,
For example the following configuration for elliptic curves:
ecdh-curve prime256v1
is equivalent to generating DH parameters with openssl dhparam -out /etc/openvpn/dh.pem 3072 and using:
dh /etc/openvpn/dh.pem
The values provided by the NIST Recommendations correspond roughly to OpenSSL security levels. The default security level is level 1, which means a minimum of 2048 bits for the DH groups and 224 bits for elliptic curves. You can increase it using the tls-cipher option (cf. OpenSSL documentation for the format). E.g. setting:
tls-cipher DEFAULT:@SECLEVEL=4
will cause OpenVPN connections to fail, until you adjust the two settings above to the required group sizes (7680 for DH and 384 for ECDH).
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
