Skip to content

Commit 2761b52

Browse files
LtadrianAdrian Gracia
andauthored
SQC-352 SQC-353 create cert command documantion for mtls/CA cert chain management (#19205)
Co-authored-by: Adrian Gracia <[email protected]>
1 parent 6aba9c4 commit 2761b52

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

src/content/docs/workers/wrangler/commands.mdx

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Wrangler offers a number of commands to manage your Cloudflare Workers.
4040
- [`rollback`](#rollback) - Rollback to a recent deployment.
4141
- [`dispatch-namespace`](#dispatch-namespace) - Interact with a [dispatch namespace](/cloudflare-for-platforms/workers-for-platforms/reference/how-workers-for-platforms-works/#dispatch-namespace).
4242
- [`mtls-certificate`](#mtls-certificate) - Manage certificates used for mTLS connections.
43+
- [`cert`](#cert) - Manage certificates used for mTLS and Certificate Authority (CA) chain connections.
4344
- [`types`](#types) - Generate types from bindings and module rules in configuration.
4445
- [`telemetry`](#telemetry) - Configure whether Wrangler can collect anonymous usage data.
4546

@@ -1790,6 +1791,135 @@ Deleted certificate 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d successfully
17901791

17911792
---
17921793

1794+
## `cert`
1795+
1796+
Manage mTLS client certificates and Certificate Authority (CA) chain certificates used for secured connections.
1797+
1798+
These certificates can be used in Hyperdrive configurations, enabling them to present the certificate when connecting to an origin database that requires client authentication (mTLS) or a custom Certificate Authority (CA).
1799+
1800+
### `upload mtls-certificate`
1801+
1802+
Upload a client certificate.
1803+
1804+
```txt
1805+
wrangler cert upload mtls-certificate --cert <PATH> --key <PATH> [OPTIONS]
1806+
```
1807+
1808+
- `--cert` <Type text="string" /> <MetaInfo text="required" />
1809+
- A path to the TLS certificate to upload. Certificate chains are supported.
1810+
- `--key` <Type text="string" /> <MetaInfo text="required" />
1811+
- A path to the private key to upload.
1812+
- `--name` <Type text="string" /> <MetaInfo text="optional" />
1813+
- The name assigned to the mTLS certificate at upload.
1814+
1815+
<Render file="wrangler-commands/global-flags" product="workers" />
1816+
1817+
The following is an example of using the `upload` command to upload an mTLS certificate.
1818+
1819+
```sh
1820+
npx wrangler cert upload --cert cert.pem --key key.pem --name my-origin-cert
1821+
```
1822+
1823+
```sh output
1824+
Uploading mTLS Certificate my-origin-cert...
1825+
Success! Uploaded mTLS Certificate my-origin-cert
1826+
ID: 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d
1827+
Issuer: CN=my-secured-origin.com,OU=my-team,O=my-org,L=San Francisco,ST=California,C=US
1828+
Expires: 1/01/2025
1829+
```
1830+
1831+
Note that the certificate and private keys must be in separate (typically `.pem`) files when uploading.
1832+
1833+
### `upload certificate-authority`
1834+
1835+
Upload a client certificate.
1836+
1837+
```txt
1838+
wrangler cert upload certificate-authority --ca-cert <PATH> [OPTIONS]
1839+
```
1840+
1841+
- `--ca-cert` <Type text="string" /> <MetaInfo text="required" />
1842+
- A path to the Certificate Authority (CA) chain certificate to upload.
1843+
1844+
- `--name` <Type text="string" /> <MetaInfo text="optional" />
1845+
- The name assigned to the mTLS certificate at upload.
1846+
1847+
<Render file="wrangler-commands/global-flags" product="workers" />
1848+
1849+
The following is an example of using the `upload` command to upload an CA certificate.
1850+
1851+
```sh
1852+
npx wrangler cert upload certificate-authority --ca-cert server-ca-chain.pem --name SERVER_CA_CHAIN
1853+
1854+
```
1855+
1856+
```sh output
1857+
Uploading CA Certificate SERVER_CA_CHAIN...
1858+
Success! Uploaded CA Certificate SERVER_CA_CHAIN
1859+
ID: 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d
1860+
Issuer: CN=my-secured-origin.com,OU=my-team,O=my-org,L=San Francisco,ST=California,C=US
1861+
Expires: 1/01/2025
1862+
```
1863+
1864+
### `list`
1865+
1866+
List mTLS certificates associated with the current account ID. This will display both mTLS certificates and CA certificates.
1867+
1868+
```txt
1869+
wrangler cert list
1870+
```
1871+
1872+
<Render file="wrangler-commands/global-flags" product="workers" />
1873+
1874+
The following is an example of using the `list` command to upload an mTLS or CA certificate.
1875+
1876+
```sh
1877+
npx wrangler cert list
1878+
```
1879+
1880+
```sh output
1881+
ID: 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d
1882+
Name: my-origin-cert
1883+
Issuer: CN=my-secured-origin.com,OU=my-team,O=my-org,L=San Francisco,ST=California,C=US
1884+
Created on: 1/01/2023
1885+
Expires: 1/01/2025
1886+
1887+
ID: c5d004d1-8312-402c-b8ed-6194328d5cbe
1888+
Issuer: CN=another-origin.com,OU=my-team,O=my-org,L=San Francisco,ST=California,C=US
1889+
Created on: 1/01/2023
1890+
Expires: 1/01/2025
1891+
```
1892+
1893+
### `delete`
1894+
1895+
Delete a client certificate.
1896+
1897+
```txt
1898+
wrangler cert delete {--id <ID|--name <NAME>}
1899+
```
1900+
1901+
- `--id` <Type text="string" />
1902+
- The ID of the mTLS or CA certificate.
1903+
- `--name` <Type text="string" />
1904+
- The name assigned to the mTLS or CA certificate at upload.
1905+
1906+
<Render file="wrangler-commands/global-flags" product="workers" />
1907+
1908+
The following is an example of using the `delete` command to delete an mTLS or CA certificate.
1909+
1910+
```sh
1911+
npx wrangler cert delete --id 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d
1912+
```
1913+
1914+
```sh output
1915+
Are you sure you want to delete certificate 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d (my-origin-cert)? [y/n]
1916+
yes
1917+
Deleting certificate 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d...
1918+
Deleted certificate 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d successfully
1919+
```
1920+
1921+
---
1922+
17931923
## `types`
17941924

17951925
Generate types from bindings and module rules in configuration.

0 commit comments

Comments
 (0)