i am unclear how to create the certificates for use with the remote-cert-tls
(http://openvpn.net/index.php/open-sourc ... l#examples)To avoid a possible Man-in-the-Middle attack where an authorized client tries to connect to another client by impersonating the server, make sure to enforce some kind of server certificate verification by clients. There are currently five different ways of accomplishing this, listed in the order of preference:
[OpenVPN 2.1 and above] Build your server certificates with specific key usage and extended key usage. The RFC3280 determine that the following attributes should be provided for TLS connections:
Mode Key usage Extended key usage
Client
digitalSignature TLS Web Client Authentication
keyAgreement
digitalSignature, keyAgreement
Server
digitalSignature, keyEncipherment TLS Web Server Authentication
digitalSignature, keyAgreement
You can build your server certificates with the build-key-server script (see the easy-rsa documentation for more info). This will designate the certificate as a server-only certificate by setting the right attributes. Now add the following line to your client configuration:
remote-cert-tls server
and the manual says:
(http://openvpn.net/index.php/open-sourc ... pn-21.html)--remote-cert-tls client|server
Require that peer certificate was signed with an explicit key usage and extended key usage based on RFC3280 TLS rules.
This is a useful security option for clients, to ensure that the host they connect to is a designated server.
The --remote-cert-tls client option is equivalent to --remote-cert-ku 80 08 88 --remote-cert-eku "TLS Web Client Authentication"
The key usage is digitalSignature and/or keyAgreement.
The --remote-cert-tls server option is equivalent to --remote-cert-ku a0 88 --remote-cert-eku "TLS Web Server Authentication"
The key usage is digitalSignature and ( keyEncipherment or keyAgreement ).
This is an important security precaution to protect against a man-in-the-middle attack where an authorized client attempts to connect to another client by impersonating the server. The attack is easily prevented by having clients verify the server certificate using any one of --remote-cert-tls, --tls-remote, or --tls-verify.
this looks to me like the server certificate should have 2 "key usage" directives plus an extended directive of "TLS Web Server Authentication"
and the client certificate should have 3 "key usage" directives plus an extended directive of "TLS Web Client Authentication"
can someone please explain exactly which "key usage" directives go into the respective certificates to make this work?
sincerely,
proctor