Blame | Last modification | View Log | RSS feed
EASY-RSA Version 2.0-rc1This is a small RSA key management package, based on the opensslcommand line tool, that can be found in the easy-rsa subdirectoryof the OpenVPN distribution. While this tool is primary concernedwith key management for the SSL VPN application space, it can alsobe used for building web certificates.These are reference notes. For step-by-step instructions, see theHOWTO:http://openvpn.net/howto.htmlThis package is based on the ./pkitool script. Run ./pkitoolwithout arguments for a detailed help message (which is also pastedbelow).Release Notes for easy-rsa-2.0* Most functionality has been consolidated into the pkitoolscript. For compatibility, all previous scripts from 1.0 suchas build-key and build-key-server are provided as stubswhich call pkitool to do the real work.* pkitool has a --batch flag (enabled by default) which generateskeys/certs without needing any interactive input. pkitoolcan still generate certs/keys using interactive prompting byusing the --interact flag.* The inherit-inter script has been provided for creatinga new PKI rooted on an intermediate certificate built within ahigher-level PKI. See comments in the inherit-inter scriptfor more info.* The openssl.cnf file has been modified. pkitool will notwork with the openssl.cnf file included with previouseasy-rsa releases.* The vars file has been modified -- the following extravariables have been added: EASY_RSA, CA_EXPIRE,KEY_EXPIRE.* The make-crl and revoke-crt scripts have been removed andare replaced by the revoke-full script.* The "Organizational Unit" X509 field can be set usingthe KEY_OU environmental variable before calling pkitool.* This release only affects the Linux/Unix version of easy-rsa.The Windows version (written to use the Windows shell) is unchanged.* Use the revoke-full script to revoke a certificate, and generate(or update) the crl.pem file in the keys directory (as set by thevars script). Then use "crl-verify crl.pem" in your OpenVPN serverconfig file, so that OpenVPN can reject any connections coming fromclients which present a revoked certificate. Usage for the script is:revoke-full <common-name>Note this this procedure is primarily designed to revoke clientcertificates. You could theoretically use this method to revokeserver certificates as well, but then you would need to propagatethe crl.pem file to all clients as well, and have them include"crl-verify crl.pem" in their configuration files.* PKCS#11 support was added.* For those interested in using this tool to generate web certificates,A variant of the easy-rsa package that allows the creation of multi-domaincertificates with subjectAltName can be obtained from here:http://www.bisente.com/proyectos/easy-rsa-subjectaltname/INSTALL easy-rsa1. Edit vars.2. Set KEY_CONFIG to point to the correct openssl-<version>.cnffile included in this distribution.3. Set KEY_DIR to point to a directory which willcontain all keys, certificates, etc. Thisdirectory need not exist, and if it does,it will be deleted with rm -rf, so BECAREFUL how you set KEY_DIR.4. (Optional) Edit other fields in varsper your site data. You may want toincrease KEY_SIZE to 2048 if you areparanoid and don't mind slower keyprocessing, but certainly 1024 isfine for testing purposes. KEY_SIZEmust be compatible across both peersparticipating in a secure SSL/TLSconnection.5. (Optional) If you intend to use PKCS#11,install openssl >= 0.9.7, install thefollowing components from www.opensc.org:- opensc >= 0.10.0- engine_pkcs11 >= 0.1.3Update the openssl.cnf to load the engine:- Uncomment pkcs11 under engine_section.- Validate path at dynamic_path under pkcs11_section.6. . vars7. ./clean-all8. As you create certificates, keys, andcertificate signing requests, understand thatonly .key files should be kept confidential..crt and .csr files can be sent over insecurechannels such as plaintext email.IMPORTANTTo avoid a possible Man-in-the-Middle attack where an authorizedclient tries to connect to another client by impersonating theserver, make sure to enforce some kind of server certificateverification by clients. There are currently four different waysof accomplishing this, listed in the order of preference:(1) Build your server certificates with specific key usage andextended key usage. The RFC3280 determine that the followingattributes should be provided for TLS connections:Mode Key usage Extended key usage---------------------------------------------------------------------------Client digitalSignature TLS Web Client AuthenticationkeyAgreementdigitalSignature, keyAgreementServer digitalSignature, keyEncipherment TLS Web Server AuthenticationdigitalSignature, keyAgreementNow add the following line to your client configuration:remote-cert-tls serverThis will block clients from connecting to anyserver which lacks the required extension designationin its certificate, even if the certificate has beensigned by the CA which is cited in the OpenVPN configurationfile (--ca directive).(3) Use the --tls-remote directive on the client toaccept/reject the server connection based on the commonname of the server certificate.(3) Use a --tls-verify script or plugin to accept/reject theserver connection based on a custom test of the servercertificate's embedded X509 subject details.(4) Sign server certificates with one CA and client certificateswith a different CA. The client config "ca" directive shouldreference the server-signing CA while the server config "ca"directive should reference the client-signing CA.NOTESShow certificate fields:openssl x509 -in cert.crt -textPKITOOL documentationpkitool 2.0Usage: pkitool [options...] [common-name]Options:--batch : batch mode (default)--keysize : Set keysizesize : size (default=1024)--interact : interactive mode--server : build server cert--initca : build root CA--inter : build intermediate CA--pass : encrypt private key with password--csr : only generate a CSR, do not sign--sign : sign an existing CSR--pkcs12 : generate a combined PKCS#12 file--pkcs11 : generate certificate on PKCS#11 tokenlib : PKCS#11 libraryslot : PKCS#11 slotid : PKCS#11 object id (hex string)label : PKCS#11 object labelStandalone options:--pkcs11-slots : list PKCS#11 slotslib : PKCS#11 library--pkcs11-objects : list PKCS#11 token objectslib : PKCS#11 libraryslot : PKCS#11 slot--pkcs11-init : initialize PKCS#11 token DANGEROUS!!!lib : PKCS#11 libraryslot : PKCS#11 slotlabel : PKCS#11 token labelNotes:Please edit the vars script to reflect your configuration,then source it with "source ./vars".Next, to start with a fresh PKI configuration and to delete anyprevious certificates and keys, run "./clean-all".Finally, you can run this tool (pkitool) to build certificates/keys.In order to use PKCS#11 interface you must have opensc-0.10.0 or higher.Generated files and corresponding OpenVPN directives:(Files will be placed in the $KEY_DIR directory, defined in ./vars)ca.crt -> root certificate (--ca)ca.key -> root key, keep secure (not directly used by OpenVPN).crt files -> client/server certificates (--cert).key files -> private keys, keep secure (--key).csr files -> certificate signing request (not directly used by OpenVPN)dh1024.pem or dh2048.pem -> Diffie Hellman parameters (--dh)Examples:pkitool --initca -> Build root certificatepkitool --initca --pass -> Build root certificate with password-protected keypkitool --server server1 -> Build "server1" certificate/keypkitool client1 -> Build "client1" certificate/keypkitool --pass client2 -> Build password-protected "client2" certificate/keypkitool --pkcs12 client3 -> Build "client3" certificate/key in PKCS#12 formatpkitool --csr client4 -> Build "client4" CSR to be signed by another CApkitool --sign client4 -> Sign "client4" CSRpkitool --inter interca -> Build an intermediate key-signing certificate/keyAlso see ./inherit-inter script.pkitool --pkcs11 /usr/lib/pkcs11/lib1 0 010203 "client5 id" client5-> Build "client5" certificate/key in PKCS#11 tokenTypical usage for initial PKI setup. Build myserver, client1, and client2 cert/keys.Protect client2 key with a password. Build DH parms. Generated files in ./keys :[edit vars with your site-specific info]source ./vars./clean-all./build-dh -> takes a long time, consider backgrounding./pkitool --initca./pkitool --server myserver./pkitool client1./pkitool --pass client2Typical usage for adding client cert to existing PKI:source ./vars./pkitool client-new