Skip to content

Commit 46a78a7

Browse files
authored
Merge pull request #296689 from cherylmc/Linux-VPN
New Linux article
2 parents f1a7045 + d41f6a8 commit 46a78a7

File tree

4 files changed

+82
-53
lines changed

4 files changed

+82
-53
lines changed

articles/virtual-wan/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@
203203
- name: .pem files
204204
items:
205205
- name: Linux - OpenSSL
206-
href: ../vpn-gateway/point-to-site-certificates-linux-openssl.md
206+
href: point-to-site-certificates-linux-openssl.md
207207
- name: Linux - strongSwan
208208
href: ../vpn-gateway/vpn-gateway-certificates-point-to-site-linux.md
209209
- name: Install client certificates
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: 'Generate and export certificates for User VPN: Linux - OpenSSL'
3+
description: Learn how to create a self-signed root certificate, export the public key, and generate client certificates using OpenSSL for Virtual WAN User VPN connections.
4+
titleSuffix: Azure Virtual WAN
5+
author: cherylmc
6+
ms.service: azure-virtual-wan
7+
ms.custom: linux-related-content
8+
ms.topic: how-to
9+
ms.date: 03/20/2025
10+
ms.author: cherylmc
11+
---
12+
# User VPN - Generate and export certificates - Linux - OpenSSL
13+
14+
This article helps you create a self-signed root certificate and generate client certificate **.pem** files using OpenSSL. If you need *.pfx* and *.cer* files instead, see the [Windows- PowerShell](certificates-point-to-site.md) instructions. To upload the self-signed certificate to Azure, see the [User VPN configuration steps](virtual-wan-point-to-site-portal.md#p2sconfig).
15+
16+
[!INCLUDE [Steps](../../includes/vpn-gateway-vwan-generate-certificates-linux-openssl.md)]
17+
18+
## Next steps
19+
20+
* To continue Virtual WAN configuration steps, see [Create a P2S User VPN connection](../virtual-wan/virtual-wan-point-to-site-portal.md).

articles/vpn-gateway/point-to-site-certificates-linux-openssl.md

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,64 +6,15 @@ author: cherylmc
66
ms.service: azure-vpn-gateway
77
ms.custom: linux-related-content
88
ms.topic: how-to
9-
ms.date: 02/26/2025
9+
ms.date: 03/20/2025
1010
ms.author: cherylmc
1111
---
1212
# Generate and export certificates - Linux - OpenSSL
1313

1414
This article helps you create a self-signed root certificate and generate client certificate **.pem** files using OpenSSL. If you need *.pfx* and *.cer* files instead, see the [Windows- PowerShell](vpn-gateway-certificates-point-to-site.md) instructions.
1515

16-
## Prerequisites
17-
18-
To use this article, you must have a computer running OpenSSL.
19-
20-
## Self-signed root certificate
21-
22-
This section helps you generate a self-signed root certificate. After you generate the certificate, you export root certificate public key data file.
23-
24-
1. The following example helps you generate the self-signed root certificate.
25-
26-
```CLI
27-
openssl genrsa -out caKey.pem 2048
28-
openssl req -x509 -new -nodes -key caKey.pem -subj "/CN=VPN CA" -days 3650 -out caCert.pem
29-
```
30-
31-
1. Print the self-signed root certificate public data in base64 format. This is the format that's supported by Azure. Upload this certificate to Azure as part of your [P2S configuration](point-to-site-certificate-gateway.md#uploadfile) steps.
32-
33-
```CLI
34-
openssl x509 -in caCert.pem -outform der | base64 -w0 && echo
35-
```
36-
37-
## Client certificates
38-
39-
> [!NOTE]
40-
> Microsoft recommends that you use the most secure authentication flow available. The authentication flow described in this procedure requires a very high degree of trust in the application, and carries risks that are not present in other flows. You should only use this flow when other more secure flows, such as managed identities, aren't viable.
41-
42-
In this section, you generate the user certificate (client certificate). Certificate files are generated in the local directory in which you run the commands. You can use the same client certificate on each client computer, or generate certificates that are specific to each client. It's crucial that the client certificate is signed by the root certificate.
43-
44-
1. To generate a client certificate, use the following examples.
45-
46-
```CLI
47-
export PASSWORD="password"
48-
export USERNAME=$(hostnamectl --static)
49-
50-
# Generate a private key
51-
openssl genrsa -out "${USERNAME}Key.pem" 2048
52-
53-
# Generate a CSR (Certificate Sign Request)
54-
openssl req -new -key "${USERNAME}Key.pem" -out "${USERNAME}Req.pem" -subj "/CN=${USERNAME}"
55-
56-
# Sign the CSR using the CA certificate and CA key
57-
openssl x509 -req -days 365 -in "${USERNAME}Req.pem" -CA caCert.pem -CAkey caKey.pem -CAcreateserial -out "${USERNAME}Cert.pem" -extfile <(echo -e "subjectAltName=DNS:${USERNAME}\nextendedKeyUsage=clientAuth")
58-
```
59-
60-
1. To verify the client certificate, use the following example.
61-
62-
```CLI
63-
openssl verify -CAfile caCert.pem caCert.pem "${USERNAME}Cert.pem"
64-
```
16+
[!INCLUDE [Steps](../../includes/vpn-gateway-vwan-generate-certificates-linux-openssl.md)]
6517

6618
## Next steps
6719

68-
* To continue VPN Gateway configuration steps, see [Point-to-site certificate authentication](point-to-site-certificate-gateway.md#uploadfile).
69-
* To continue Virtual WAN configuration steps, see [Create a P2S User VPN connection](../virtual-wan/virtual-wan-point-to-site-portal.md).
20+
* To continue VPN Gateway configuration steps, see [Point-to-site certificate authentication](point-to-site-certificate-gateway.md#uploadfile).
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
author: cherylmc
3+
ms.author: cherylmc
4+
ms.date: 03/20/2025
5+
ms.service: azure-virtual-wan
6+
ms.topic: include
7+
This is for both VPN Gateway and Virtual WAN
8+
---
9+
10+
## Prerequisites
11+
12+
To use this article, you must have a computer running OpenSSL.
13+
14+
## Self-signed root certificate
15+
16+
This section helps you generate a self-signed root certificate. After you generate the certificate, you export root certificate public key data file.
17+
18+
1. The following example helps you generate the self-signed root certificate.
19+
20+
```CLI
21+
openssl genrsa -out caKey.pem 2048
22+
openssl req -x509 -new -nodes -key caKey.pem -subj "/CN=VPN CA" -days 3650 -out caCert.pem
23+
```
24+
25+
1. Print the self-signed root certificate public data in base64 format. This is the format that's supported by Azure.
26+
27+
```CLI
28+
openssl x509 -in caCert.pem -outform der | base64 -w0 && echo
29+
```
30+
31+
## Client certificates
32+
33+
> [!NOTE]
34+
> Microsoft recommends that you use the most secure authentication flow available. The authentication flow described in this procedure requires a very high degree of trust in the application, and carries risks that aren't present in other flows. You should only use this flow when other more secure flows, such as managed identities, aren't viable.
35+
36+
In this section, you generate the user certificate (client certificate). Certificate files are generated in the local directory in which you run the commands. You can use the same client certificate on each client computer, or generate certificates that are specific to each client. It's crucial that the client certificate is signed by the root certificate.
37+
38+
1. To generate a client certificate, use the following examples.
39+
40+
```CLI
41+
export PASSWORD="password"
42+
export USERNAME=$(hostnamectl --static)
43+
44+
# Generate a private key
45+
openssl genrsa -out "${USERNAME}Key.pem" 2048
46+
47+
# Generate a CSR (Certificate Sign Request)
48+
openssl req -new -key "${USERNAME}Key.pem" -out "${USERNAME}Req.pem" -subj "/CN=${USERNAME}"
49+
50+
# Sign the CSR using the CA certificate and CA key
51+
openssl x509 -req -days 365 -in "${USERNAME}Req.pem" -CA caCert.pem -CAkey caKey.pem -CAcreateserial -out "${USERNAME}Cert.pem" -extfile <(echo -e "subjectAltName=DNS:${USERNAME}\nextendedKeyUsage=clientAuth")
52+
```
53+
54+
1. To verify the client certificate, use the following example.
55+
56+
```CLI
57+
openssl verify -CAfile caCert.pem caCert.pem "${USERNAME}Cert.pem"
58+
```

0 commit comments

Comments
 (0)