User Tools

Site Tools


networking:openvpn:openvpn-setup

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
networking:openvpn:openvpn-setup [2026/11/28 09:34] – oscarnetworking:openvpn:openvpn-setup [2026/11/28 10:08] (current) – [Deploy Certificates & Keys] oscar
Line 145: Line 145:
 === Generate client private key === === Generate client private key ===
 In this step, you will first generate the client key and certificate pair. If you have more than one client, you can repeat this process for each one. Please note, though, that you will need to pass a unique name value to the script for every client. Throughout this tutorial, the first certificate/key pair is referred to as `myvpnclient`. In this step, you will first generate the client key and certificate pair. If you have more than one client, you can repeat this process for each one. Please note, though, that you will need to pass a unique name value to the script for every client. Throughout this tutorial, the first certificate/key pair is referred to as `myvpnclient`.
 +<code>
 +$ /usr/share/easy-rsa/easyrsa gen-req myvpnclient nopass
 +--------------------------------------------------------
  
-  $ /usr/share/easy-rsa/easyrsa gen-req myvpnclient nopass+Notice 
 +------ 
 +Private-Key and Public-Certificate-Request files created. 
 +Your files are: 
 +* req: /tmp/certs/pki/reqs/myvpnclient.req 
 +* key: /tmp/certs/pki/private/myvpnclient.key 
 +</code> 
 +This will: 
 +  * Generate a private key (//pki/private/myvpnclient.key//) for the entity named //myvpnclient//. 
 +  * Creates a certificate signing request (//pki/reqs/myvpnclient.req//) containing the corresponding public key and requested identity fields (such as Common Name). 
 +  * nopass skips key encryption: Leaves the private key unencrypted on disk so automated services (like a VPN server daemon) can start unattended without prompting for a passphrase. Omit nopass if you want a passphrase-protected key (common for client keys or sensitive CA keys).
  
-This will create a private key for the client and a certificate request file called MyClientName.req. Then sign the request by running easyrsa with the sign-req option, followed by the request type and the common name. The request type can either be client or server, so for the OpenVPN server’s certificate request, be sure to use the server request type.+=== Sign client key === 
 +This will create a private key for the client and a certificate request file called myvpnclient.req. Then sign the request by running easyrsa with the sign-req option, followed by the request type and the common name. The request type can either be client or server, so for the OpenVPN client certificate request, be sure to use the client request type. 
 +<code> 
 +$ /usr/share/easy-rsa/easyrsa sign-req client myvpnclient 
 +---------------------------------------------------------
  
-  $ /usr/share/easy-rsa/easyrsa sign-req server myvpnclient+Notice 
 +------ 
 +Certificate created at: 
 +* /tmp/certs/pki/issued/myvpnclient.crt 
 +</code> 
 +In the output, you’ll be asked to verify that the request comes from a trusted source. Type yes and press ENTER to confirm this.  
 +This will: 
 +  * Reads the request from //pki/reqs/myvpnclient.req//. 
 +  * Applies the client profile/extension set, marking the resulting certificate for client authentication (and typically setting EKU attributes appropriate for a TLS/VPN server rather than a client). 
 +  * Signs with the CA using your CA private key and CA certificate (//pki/ca.crt//), producing the signed server certificate at //pki/issued/myvpnclient.crt//. (Easy-RSA usually prompts you to confirm the request details and enter your CA passphrase, if one is set.)
  
-In the output, you’ll be asked to verify that the request comes from a trusted source. Type yes and press ENTER to confirm this.  
-   
      
 ===== Deploy Certificates & Keys ===== ===== Deploy Certificates & Keys =====
Line 163: Line 187:
 |ca.key |key signing machine only |Root CA key |YES| |ca.key |key signing machine only |Root CA key |YES|
 |dh2048.pem |server only |Diffie Hellman parameters |NO| |dh2048.pem |server only |Diffie Hellman parameters |NO|
-|MyServerName.crt |server only |Server Certificate |NO| +|myvpnserver.crt |server only |Server Certificate |NO| 
-|MyServerName.key |server only |Server Key |YES| +|myvpnserver.key |server only |Server Key |YES| 
-|MyClientName.crt |client1 only |Client1 Certificate |NO| +|myvpnclient.crt |client1 only |Client1 Certificate |NO| 
-|MyClientName.key |client1 only |Client1 Key |YES|+|myvpnclient.key |client1 only |Client1 Key |YES|
  
 === Server Deployment === === Server Deployment ===
Line 182: Line 206:
  
   - **ca.cert** --> insert contents --> between the <ca></ca>. Including the "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----" lines.   - **ca.cert** --> insert contents --> between the <ca></ca>. Including the "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----" lines.
-  - **MyClientName.key** --> insert contents --> between the <key></key>. Including the "-----BEGIN PRIVATE KEY-----" and "-----END PRIVATE KEY-----" lines. +  - **myvpnclient.key** --> insert contents --> between the <key></key>. Including the "-----BEGIN PRIVATE KEY-----" and "-----END PRIVATE KEY-----" lines. 
-  - **MyClientName.crt** --> insert contents --> between the <cert></cert>. Including everything.+  - **myvpnclient.crt** --> insert contents --> between the <cert></cert>. Including everything.
   - **ta.key** --> insert contents --> between the <tls-auth></tls-auth>. Including everything.   - **ta.key** --> insert contents --> between the <tls-auth></tls-auth>. Including everything.
  
networking/openvpn/openvpn-setup.1795858471.txt.gz · Last modified: by oscar