By niranga12
Hi, I want to have both Server and client authentication for the same certificate and i am using easy-rsa. Can anyone help me on that? TIA
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Heya,
To configure a single certificate for both server and client authentication using Easy-RSA, you’ll need to modify the configuration for your certificates to specify the desired Enhanced Key Usage (EKU) extensions. Easy-RSA is a simple script that helps you manage a PKI (Public Key Infrastructure) based on OpenSSL. Below are the steps to create a certificate with both server and client authentication EKUs.
Initialize the PKI (Public Key Infrastructure):
/usr/share/easy-rsa or /etc/easy-rsa../easyrsa init-pki
Configure Easy-RSA Variables:
vars file (usually located in the Easy-RSA directory) to set up the certificate parameters. Find and edit the following lines:set_var EASYRSA_KEY_SIZE 2048
set_var EASYRSA_CA_EXPIRE 3650
set_var EASYRSA_CERT_EXPIRE 365
Build the Certificate Authority (CA):
./easyrsa build-ca
Modify the OpenSSL Configuration for Enhanced Key Usage (EKU):
openssl-easyrsa.cnf file (usually located in the Easy-RSA directory or the pki subdirectory) in a text editor.[ server_cert ] section, and add the following lines to specify both client and server authentication for the EKU:extendedKeyUsage = serverAuth, clientAuth
Generate the Server/Client Certificate:
./easyrsa build-server-full server_client_name nopass
The ‘nopass’ option generates a keypair without a passphrase. Verify the Certificate:
After you’ve created the certificate, you should verify that the EKU settings are correct. To do this, you can run:
openssl x509 -in pki/issued/server_client_name.crt -text -noout
This should display the details of the certificate, including the X509v3 Extended Key Usage section, which should show both TLS Web Server Authentication and TLS Web Client Authentication.
Deploy the Certificate:
Once you have verified that the certificate has been created with the desired EKUs, you can deploy this certificate to your server or client. The private key will be in pki/private/ and the certificate will be in pki/issued/ in the Easy-RSA directory.
Please note that while using the same certificate for both server and client authentication can be convenient, it may not be the most secure configuration, especially in a production environment. In a typical production setting, you might have separate certificates for servers and clients, each with their own appropriate usage constraints.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.