Skip to content

Commit a306ea8

Browse files
authored
Merge pull request #229108 from stegag/patch-46
Update vpn-gateway-strongswan-install-include.md
2 parents 3a03457 + 2b0b4b8 commit a306ea8

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

articles/vpn-gateway/point-to-site-vpn-client-cert-linux.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,17 @@ This section walks you through the configuration using the strongSwan CLI.
113113

114114
1. From the VPN client profile configuration files **Generic** folder, copy or move the **VpnServerRoot.cer** to **/etc/ipsec.d/cacerts**.
115115

116-
1. Copy or move **cp client.p12** to **/etc/ipsec.d/private/**. This file is the client certificate for the VPN gateway.
116+
1. Copy or move the p12 file you generated to **/etc/ipsec.d/private/**. This file is the client certificate for the VPN gateway. Use the following command:
117+
118+
```
119+
sudo cp "${USERNAME}.p12" /etc/ipsec.d/private/
120+
```
121+
122+
1. Run the following command to take note of your hostname. You’ll use this value in the next step.
123+
124+
```
125+
hostnamectl --static
126+
```
117127

118128
1. Open the **VpnSettings.xml** file and copy the `<VpnServer>` value. You’ll use this value in the next step.
119129

@@ -126,25 +136,31 @@ This section walks you through the configuration using the strongSwan CLI.
126136
leftfirewall=yes
127137
left=%any
128138
leftauth=eap-tls
129-
leftid=%client # use the DNS alternative name prefixed with the %
130-
right= Enter the VPN Server value here# Azure VPN gateway address
131-
rightid=% # Enter the VPN Server value here# Azure VPN gateway FQDN with %
139+
leftid=%client # use the hostname of your machine with % character prepended. Example: %client
140+
right= #Azure VPN gateway address. Example: azuregateway-xxx-xxx.vpn.azure.com
141+
rightid=% #Azure VPN gateway FQDN with % character prepended. Example: %azuregateway-xxx-xxx.vpn.azure.com
132142
rightsubnet=0.0.0.0/0
133143
leftsourceip=%config
134144
auto=add
135145
```
146+
147+
136148

137-
1. Add the following values to **/etc/ipsec.secrets**.
149+
1. Add the secret values to **/etc/ipsec.secrets**.
138150

151+
The name of the p.12 file must match what you have used earlier.
152+
The password must also match the password chosen when generating the certificates.
153+
154+
This is an example command to run on a machine which hostname is "client" and certificate password is "password"
139155
```cli
140156
: P12 client.p12 'password' # key filename inside /etc/ipsec.d/private directory
141157
```
142158

143-
1. Run the following commands:
159+
1. Finally run the following commands:
144160

145161
```cli
146-
# ipsec restart
147-
# ipsec up azure
162+
sudo ipsec restart
163+
sudo ipsec up azure
148164
```
149165

150166
## <a name="openvpn"></a>OpenVPN steps

includes/vpn-gateway-strongswan-certificates-include.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Generate the user certificate.
2727

2828
```
2929
export PASSWORD="password"
30-
export USERNAME="client"
30+
export USERNAME=$(hostnamectl --static)
3131
3232
ipsec pki --gen --outform pem > "${USERNAME}Key.pem"
3333
ipsec pki --pub --in "${USERNAME}Key.pem" | ipsec pki --issue --cacert caCert.pem --cakey caKey.pem --dn "CN=${USERNAME}" --san "${USERNAME}" --flag clientAuth --outform pem > "${USERNAME}Cert.pem"
@@ -37,4 +37,4 @@ Generate a p12 bundle containing the user certificate. This bundle will be used
3737

3838
```
3939
openssl pkcs12 -in "${USERNAME}Cert.pem" -inkey "${USERNAME}Key.pem" -certfile caCert.pem -export -out "${USERNAME}.p12" -password "pass:${PASSWORD}"
40-
```
40+
```

includes/vpn-gateway-strongswan-install-include.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ The following configuration was used for the steps below:
1414

1515
Use the following commands to install the required strongSwan configuration:
1616

17+
```
18+
sudo apt-get update
19+
```
20+
21+
```
22+
sudo apt-get upgrade
23+
```
24+
1725
```
1826
sudo apt install strongswan
1927
```
@@ -32,4 +40,4 @@ Use the following command to install the Azure command-line interface:
3240
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
3341
```
3442

35-
For more information, see [Additional instructions to install the Azure CLI](/cli/azure/install-azure-cli-apt).
43+
For more information, see [Additional instructions to install the Azure CLI](/cli/azure/install-azure-cli-apt).

0 commit comments

Comments
 (0)