Skip to content

Commit f8e4d55

Browse files
Merge pull request #216780 from PatAltimore/patricka-cert-path
Change cert directory
2 parents 8e28349 + 635b2d4 commit f8e4d55

File tree

3 files changed

+63
-50
lines changed

3 files changed

+63
-50
lines changed

articles/iot-edge/how-to-connect-downstream-iot-edge-device.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ For example, the following commands create a root CA certificate, a parent devic
130130

131131
For more information about creating test certificates, see [create demo certificates to test IoT Edge device features](how-to-create-test-certificates.md).
132132

133-
01. You'll need to transfer the certificates and keys to each device. You can use a USB drive, a service like [Azure Key Vault](../key-vault/general/overview.md), or with a function like [Secure file copy](https://www.ssh.com/ssh/scp/). Choose one of these methods that best matches your scenario.
133+
01. You'll need to transfer the certificates and keys to each device. You can use a USB drive, a service like [Azure Key Vault](../key-vault/general/overview.md), or with a function like [Secure file copy](https://www.ssh.com/ssh/scp/). Choose one of these methods that best matches your scenario. Copy the files to the preferred directory for certificates and keys. Use `/var/aziot/certs` for certificates and `/var/aziot/secrets` for keys.
134134

135135
For more information on installing certificates on a device, see [Manage certificates on an IoT Edge device](how-to-manage-device-certificates.md).
136136

@@ -140,22 +140,22 @@ To configure your parent device, open a local or remote command shell.
140140

141141
To enable secure connections, every IoT Edge parent device in a gateway scenario needs to be configured with a unique device CA certificate and a copy of the root CA certificate shared by all devices in the gateway hierarchy.
142142

143-
01. Transfer the **root CA certificate**, **parent device CA certificate**, and **parent private key** to the parent device. The examples in this article use the directory `/var/secrets` for the certificates and keys directory.
143+
01. Transfer the **root CA certificate**, **parent device CA certificate**, and **parent private key** to the parent device. The examples in this article use the preferred directory `/var/aziot` for the certificates and keys.
144144

145145
01. Install the **root CA certificate** on the parent IoT Edge device. First, copy the root certificate into the certificate directory and add `.crt` to the end of the file name. Next, update the certificate store on the device using the platform-specific command.
146146

147147
**Debian or Ubuntu:**
148148

149149
```bash
150-
sudo cp /var/secrets/azure-iot-test-only.root.ca.cert.pem /usr/local/share/ca-certificates/azure-iot-test-only.root.ca.cert.pem.crt
150+
sudo cp /var/aziot/certs/azure-iot-test-only.root.ca.cert.pem /usr/local/share/ca-certificates/azure-iot-test-only.root.ca.cert.pem.crt
151151

152152
sudo update-ca-certificates
153153
```
154154

155155
**IoT Edge for Linux on Windows (EFLOW):**
156156

157157
```bash
158-
sudo cp /var/secrets/azure-iot-test-only.root.ca.cert.pem /etc/pki/ca-trust/source/anchors/azure-iot-test-only.root.ca.cert.pem.crt
158+
sudo cp /var/aziot/certs/azure-iot-test-only.root.ca.cert.pem /etc/pki/ca-trust/source/anchors/azure-iot-test-only.root.ca.cert.pem.crt
159159
160160
sudo update-ca-trust
161161
```
@@ -216,15 +216,15 @@ You should already have IoT Edge installed on your device. If not, follow the st
216216
device. For example:
217217
218218
```toml
219-
trust_bundle_cert = "file:///var/secrets/azure-iot-test-only.root.ca.cert.pem"
219+
trust_bundle_cert = "file:///var/aziot/certs/azure-iot-test-only.root.ca.cert.pem"
220220
```
221221
222222
01. Find or add the **Edge CA certificate** section in the config file. Update the certificate `cert` and private key `pk` parameters with the file URI paths for the certificate and key files on the parent IoT Edge device. IoT Edge requires the certificate and private key to be in text-based privacy-enhanced mail (PEM) format. For example:
223223
224224
```toml
225225
[edge_ca]
226-
cert = "file:///var/secrets/iot-edge-device-ca-gateway.cert.pem"
227-
pk = "file:///var/secrets/iot-edge-device-ca-gateway.key.pem"
226+
cert = "file:///var/aziot/certs/iot-edge-device-ca-gateway.cert.pem"
227+
pk = "file:///var/aziot/secrets/iot-edge-device-ca-gateway.key.pem"
228228
```
229229
230230
01. Verify your IoT Edge device uses the correct version of the IoT Edge agent when it starts. Find the **Default Edge Agent** section and set the image value for IoT Edge to version 1.4. For example:
@@ -238,11 +238,11 @@ You should already have IoT Edge installed on your device. If not, follow the st
238238
239239
```toml
240240
hostname = "10.0.0.4"
241-
trust_bundle_cert = "file:///var/secrets/azure-iot-test-only.root.ca.cert.pem"
241+
trust_bundle_cert = "file:///var/aziot/certs/azure-iot-test-only.root.ca.cert.pem"
242242
243243
[edge_ca]
244-
cert = "file:///var/secrets/iot-edge-device-ca-gateway.cert.pem"
245-
pk = "file:///var/secrets/iot-edge-device-ca-gateway.key.pem"
244+
cert = "file:///var/aziot/certs/iot-edge-device-ca-gateway.cert.pem"
245+
pk = "file:///var/aziot/secrets/iot-edge-device-ca-gateway.key.pem"
246246
```
247247
248248
01. Save and close the `config.toml` configuration file. For example if you're using the **nano** editor, select **Ctrl+O** - *Write Out*, **Enter**, and **Ctrl+X** - *Exit*.
@@ -319,22 +319,22 @@ To configure your child device, open a local or remote command shell.
319319
320320
To enable secure connections, every IoT Edge child device in a gateway scenario needs to be configured with a unique device CA certificate and a copy of the root CA certificate shared by all devices in the gateway hierarchy.
321321
322-
01. Transfer the **root CA certificate**, **child device CA certificate**, and **child private key** to the child device. The examples in this article use the directory `/var/secrets` for the certificates and keys directory.
322+
01. Transfer the **root CA certificate**, **child device CA certificate**, and **child private key** to the child device. The examples in this article use the directory `/var/aziot` for the certificates and keys directory.
323323
324324
01. Install the **root CA certificate** on the child IoT Edge device. First, copy the root certificate into the certificate directory and add `.crt` to the end of the file name. Next, update the certificate store on the device using the platform-specific command.
325325
326326
**Debian or Ubuntu:**
327327
328328
```bash
329-
sudo cp /var/secrets/azure-iot-test-only.root.ca.cert.pem /usr/local/share/ca-certificates/azure-iot-test-only.root.ca.cert.pem.crt
329+
sudo cp /var/aziot/certs/azure-iot-test-only.root.ca.cert.pem /usr/local/share/ca-certificates/azure-iot-test-only.root.ca.cert.pem.crt
330330
331331
sudo update-ca-certificates
332332
```
333333
334334
**IoT Edge for Linux on Windows (EFLOW):**
335335
336336
```bash
337-
sudo cp /var/secrets/azure-iot-test-only.root.ca.cert.pem /etc/pki/ca-trust/source/anchors/azure-iot-test-only.root.ca.cert.pem.crt
337+
sudo cp /var/aziot/certs/azure-iot-test-only.root.ca.cert.pem /etc/pki/ca-trust/source/anchors/azure-iot-test-only.root.ca.cert.pem.crt
338338
339339
sudo update-ca-trust
340340
```
@@ -383,15 +383,15 @@ You should already have IoT Edge installed on your device. If not, follow the st
383383
device. For example:
384384
385385
```toml
386-
trust_bundle_cert = "file:///var/secrets/azure-iot-test-only.root.ca.cert.pem"
386+
trust_bundle_cert = "file:///var/aziot/certs/azure-iot-test-only.root.ca.cert.pem"
387387
```
388388
389389
01. Find or add the **Edge CA certificate** section in the configuration file. Update the certificate `cert` and private key `pk` parameters with the file URI paths for the certificate and key files on the IoT Edge child device. IoT Edge requires the certificate and private key to be in text-based privacy-enhanced mail (PEM) format. For example:
390390
391391
```toml
392392
[edge_ca]
393-
cert = "file:///var/secrets/iot-edge-device-ca-downstream.cert.pem"
394-
pk = "file:///var/secrets/iot-edge-device-ca-downstream.key.pem"
393+
cert = "file:///var/aziot/certs/iot-edge-device-ca-downstream.cert.pem"
394+
pk = "file:///var/aziot/secrets/iot-edge-device-ca-downstream.key.pem"
395395
```
396396
397397
01. Verify your IoT Edge device uses the correct version of the IoT Edge agent when it starts. Find the **Default Edge Agent** section and set the image value for IoT Edge to version 1.4. For example:
@@ -405,11 +405,11 @@ You should already have IoT Edge installed on your device. If not, follow the st
405405
406406
```toml
407407
parent_hostname = "10.0.0.4"
408-
trust_bundle_cert = "file:///var/secrets/azure-iot-test-only.root.ca.cert.pem"
408+
trust_bundle_cert = "file:///var/aziot/certs/azure-iot-test-only.root.ca.cert.pem"
409409
410410
[edge_ca]
411-
cert = "file:///var/secrets/iot-edge-device-ca-downstream.cert.pem"
412-
pk = "file:///var/secrets/iot-edge-device-ca-downstream.key.pem"
411+
cert = "file:///var/aziot/certs/iot-edge-device-ca-downstream.cert.pem"
412+
pk = "file:///var/aziot/secrets/iot-edge-device-ca-downstream.key.pem"
413413
```
414414
415415
01. Save and close the `config.toml` configuration file. For example if you're using the **nano** editor, select **Ctrl+O** - *Write Out*, **Enter**, and **Ctrl+X** - *Exit*.

articles/iot-edge/how-to-create-transparent-gateway.md

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,30 @@ If you don't have your own certificate authority and want to use demo certificat
114114

115115
# [IoT Edge](#tab/iotedge)
116116

117-
If you created the certificates on a different machine, copy them over to your IoT Edge device then proceed with the next steps. You can use a USB drive, a service like [Azure Key Vault](../key-vault/general/overview.md), or with a function like [Secure file copy](https://www.ssh.com/ssh/scp/). Choose one of these methods that best matches your scenario.
117+
1. If you created the certificates on a different machine, copy them over to your IoT Edge device. You can use a USB drive, a service like [Azure Key Vault](../key-vault/general/overview.md), or with a function like [Secure file copy](https://www.ssh.com/ssh/scp/).
118+
1. Move the files to the preferred directory for certificates and keys. Use `/var/aziot/certs` for certificates and `/var/aziot/secrets` for keys.
119+
1. Change the ownership and permissions of the certificates and keys.
120+
121+
```bash
122+
sudo chown aziotcs:aziotcs /var/aziot/certs
123+
sudo chown -R iotedge /var/aziot/certs
124+
sudo chmod 644 /var/aziot/secrets/
125+
```
118126

119127
# [IoT Edge for Linux on Windows](#tab/eflow)
120128

121129
Now, you need to copy the certificates to the Azure IoT Edge for Linux on Windows virtual machine.
122130

131+
1. Copy the certificates to the EFLOW virtual machine to a directory where you have write access. For example, the `/home/iotedge-user` home directory.
132+
133+
```powershell
134+
# Copy the IoT Edge device CA certificate and key
135+
Copy-EflowVMFile -fromFile <path>\certs\iot-edge-device-ca-<cert name>-full-chain.cert.pem -toFile ~/iot-edge-device-ca-<cert name>-full-chain.cert.pem -pushFile
136+
Copy-EflowVMFile -fromFile <path>\private\iot-edge-device-ca-<cert name>.key.pem -toFile ~/iot-edge-device-ca-<cert name>.key.pem -pushFile
137+
138+
# Copy the root CA certificate
139+
Copy-EflowVMFile -fromFile <path>\certs\azure-iot-test-only.root.ca.cert.pem -toFile ~/azure-iot-test-only.root.ca.cert.pem -pushFile
140+
```
123141
1. Open an elevated _PowerShell_ session by starting with **Run as Administrator**.
124142

125143
Connect to the EFLOW virtual machine.
@@ -128,38 +146,33 @@ Now, you need to copy the certificates to the Azure IoT Edge for Linux on Window
128146
Connect-EflowVm
129147
```
130148

131-
1. Create the certificates directory. You can select any writeable directory. For this tutorial, we'll use the _iotedge-user_ home folder.
149+
1. Create the certificates directory. You should store your certificates and keys to the preferred `/var/aziot` directory. Use `/var/aziot/certs` for certificates and `/var/aziot/secrets` for keys.
132150

133151
```bash
134-
cd ~
135-
mkdir certs
136-
cd certs
137-
mkdir certs
138-
mkdir private
152+
sudo mkdir -p /var/aziot/certs
153+
sudo mkdir -p /var/aziot/secrets
139154
```
140155

141-
1. Exit the EFLOW VM connection.
156+
1. Move the certificates and keys to the preferred `/var/aziot` directory.
142157

143158
```bash
144-
exit
159+
# Move the IoT Edge device CA certificate and key to preferred location
160+
sudo mv ~/iot-edge-device-ca-<cert name>-full-chain.cert.pem /var/aziot/certs
161+
sudo mv ~/iot-edge-device-ca-<cert name>.key.pem /var/aziot/secrets
162+
sudo mv ~/azure-iot-test-only.root.ca.cert.pem /var/aziot/certs
145163
```
146164

147-
1. Copy the certificates to the EFLOW virtual machine.
165+
1. Change the ownership and permissions of the certificates and keys.
148166

149-
```powershell
150-
# Copy the IoT Edge device CA certificates
151-
Copy-EflowVMFile -fromFile <path>\certs\iot-edge-device-ca-<cert name>-full-chain.cert.pem -toFile /home/iotedge-user/certs/certs/iot-edge-device-ca-<cert name>-full-chain.cert.pem -pushFile
152-
Copy-EflowVMFile -fromFile <path>\private\iot-edge-device-ca-<cert name>.key.pem -toFile /home/iotedge-user/certs/private/iot-edge-device-ca-<cert name>.key.pem -pushFile
153-
154-
# Copy the root CA certificate
155-
Copy-EflowVMFile -fromFile <path>\certs\azure-iot-test-only.root.ca.cert.pem -toFile /home/iotedge-user/certs/certs/azure-iot-test-only.root.ca.cert.pem -pushFile
167+
```bash
168+
sudo chown -R iotedge /var/aziot/certs
169+
sudo chmod 644 /var/aziot/secrets/iot-edge-device-ca-<cert name>.key.pem
156170
```
171+
172+
1. Exit the EFLOW VM connection.
157173

158-
1. Invoke the following commands on the EFLOW VM to grant *iotedge* permissions to the certificate files since `Copy-EflowVMFile` copies files with root only access permissions.
159-
160-
```powershell
161-
Invoke-EflowVmCommand "sudo chown -R iotedge /home/iotedge-user/certs/"
162-
Invoke-EflowVmCommand "sudo chmod 0644 /home/iotedge-user/certs/"
174+
```bash
175+
exit
163176
```
164177

165178
----

articles/iot-edge/tutorial-configure-est-server.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,17 +130,17 @@ The Dockerfile uses Ubuntu 18.04, a [Cisco library called `libest`](https://gith
130130
131131
Each device requires the Certificate Authority (CA) certificate that is associated to a device identity certificate.
132132
133-
1. On the IoT Edge device, create the `/var/secrets` directory if it doesn't exist then change directory to it.
133+
1. On the IoT Edge device, create the `/var/aziot` directory if it doesn't exist then change directory to it.
134134

135135
```bash
136-
# Create the /var/secrets directory if it doesn't exist
137-
sudo mkdir /var/secrets
136+
# Create the /var/aziot/certs directory if it doesn't exist
137+
sudo mkdir -p /var/aziot/certs
138138
139-
# Change directory to /var/secrets
140-
cd /var/secrets
139+
# Change directory to /var/aziot/certs
140+
cd /var/aziot/certs
141141
```
142142

143-
1. Retrieve the CA certificate from the EST server into the `/var/secrets` directory and name it `cacert.crt.pem`.
143+
1. Retrieve the CA certificate from the EST server into the `/var/aziot/certs` directory and name it `cacert.crt.pem`.
144144

145145
```bash
146146
openssl s_client -showcerts -verify 5 -connect localhost:8085 < /dev/null | sudo awk '/BEGIN/,/END/{ if(/BEGIN/){a++}; out="cert"a".pem"; print >out}' && sudo cp cert2.pem cacert.crt.pem
@@ -149,7 +149,7 @@ Each device requires the Certificate Authority (CA) certificate that is associat
149149
1. Certificates should be owned by the key service user **aziotks**. Set the ownership to **aziotks** for all the certificate files.
150150

151151
```bash
152-
sudo chown aziotks:aziotks /var/secrets/*.pem
152+
sudo chown aziotks:aziotks /var/aziot/certs/*.pem
153153
```
154154

155155
## Provision IoT Edge device using DPS
@@ -159,7 +159,7 @@ Using Device Provisioning Service allows you to automatically issue and renew ce
159159
### Upload CA certificate to DPS
160160

161161
1. If you don't have a Device Provisioning Service linked to IoT Hub, see [Quickstart: Set up the IoT Hub Device Provisioning Service with the Azure portal](../iot-dps/quick-setup-auto-provision.md).
162-
1. Transfer the `cacert.crt.pem` file from your device to a computer with access to the Azure portal such as your development computer. An easy way to transfer the certificate is to remotely connect to your device, display the certificate using the command `cat /var/secrets/cacert.crt.pem`, copy the entire output, and paste the contents to a new file on your development computer.
162+
1. Transfer the `cacert.crt.pem` file from your device to a computer with access to the Azure portal such as your development computer. An easy way to transfer the certificate is to remotely connect to your device, display the certificate using the command `cat /var/aziot/certs/cacert.crt.pem`, copy the entire output, and paste the contents to a new file on your development computer.
163163
1. In the [Azure portal](https://portal.azure.com), navigate to your instance of IoT Hub Device Provisioning Service.
164164
1. Under **Settings**, select **Certificates**, then **+Add**.
165165
@@ -233,7 +233,7 @@ On the IoT Edge device, update the IoT Edge configuration file to use device cer
233233
# Optional if the EST server's TLS certificate is already trusted by the system's CA certificates.
234234
[cert_issuance.est]
235235
trusted_certs = [
236-
"file:///var/secrets/cacert.crt.pem",
236+
"file:///var/aziot/certs/cacert.crt.pem",
237237
]
238238
239239
# The default username and password for libest

0 commit comments

Comments
 (0)