Skip to content

Commit 1161ec9

Browse files
author
Adrian Gracia
committed
SQC-352 SQC-353 create cert command documantion for mtls/CA cert chain management
1 parent 1ce2489 commit 1161ec9

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

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

+130
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

@@ -2324,6 +2325,135 @@ Deleted certificate 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d successfully
23242325

23252326
---
23262327

2328+
## `cert`
2329+
2330+
Manage mTLS client certificates and Certificate Authority (CA) chain certificates used for secured connections.
2331+
2332+
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).
2333+
2334+
### `upload mtls-certificate`
2335+
2336+
Upload a client certificate.
2337+
2338+
```txt
2339+
wrangler cert upload mtls-certificate --cert <PATH> --key <PATH> [OPTIONS]
2340+
```
2341+
2342+
- `--cert` <Type text="string" /> <MetaInfo text="required" />
2343+
- A path to the TLS certificate to upload. Certificate chains are supported.
2344+
- `--key` <Type text="string" /> <MetaInfo text="required" />
2345+
- A path to the private key to upload.
2346+
- `--name` <Type text="string" /> <MetaInfo text="optional" />
2347+
- The name assigned to the mTLS certificate at upload.
2348+
2349+
<Render file="wrangler-commands/global-flags" product="workers" />
2350+
2351+
The following is an example of using the `upload` command to upload an mTLS certificate.
2352+
2353+
```sh
2354+
npx wrangler cert upload --cert cert.pem --key key.pem --name my-origin-cert
2355+
```
2356+
2357+
```sh output
2358+
Uploading mTLS Certificate my-origin-cert...
2359+
Success! Uploaded mTLS Certificate my-origin-cert
2360+
ID: 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d
2361+
Issuer: CN=my-secured-origin.com,OU=my-team,O=my-org,L=San Francisco,ST=California,C=US
2362+
Expires: 1/01/2025
2363+
```
2364+
2365+
Note that the certificate and private keys must be in separate (typically `.pem`) files when uploading.
2366+
2367+
### `upload certificate-authority`
2368+
2369+
Upload a client certificate.
2370+
2371+
```txt
2372+
wrangler cert upload certificate-authority --ca-cert <PATH> [OPTIONS]
2373+
```
2374+
2375+
- `--ca-cert` <Type text="string" /> <MetaInfo text="required" />
2376+
- A path to the Certificate Authority (CA) chain certificate to upload.
2377+
2378+
- `--name` <Type text="string" /> <MetaInfo text="optional" />
2379+
- The name assigned to the mTLS certificate at upload.
2380+
2381+
<Render file="wrangler-commands/global-flags" product="workers" />
2382+
2383+
The following is an example of using the `upload` command to upload an CA certificate.
2384+
2385+
```sh
2386+
npx wrangler cert upload certificate-authority --ca-cert server-ca-chain.pem --name SERVER_CA_CHAIN
2387+
2388+
```
2389+
2390+
```sh output
2391+
Uploading CA Certificate SERVER_CA_CHAIN...
2392+
Success! Uploaded CA Certificate SERVER_CA_CHAIN
2393+
ID: 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d
2394+
Issuer: CN=my-secured-origin.com,OU=my-team,O=my-org,L=San Francisco,ST=California,C=US
2395+
Expires: 1/01/2025
2396+
```
2397+
2398+
### `list`
2399+
2400+
List mTLS certificates associated with the current account ID. This will display both mTLS certificates and CA certificates.
2401+
2402+
```txt
2403+
wrangler cert list
2404+
```
2405+
2406+
<Render file="wrangler-commands/global-flags" product="workers" />
2407+
2408+
The following is an example of using the `list` command to upload an mTLS or CA certificate.
2409+
2410+
```sh
2411+
npx wrangler cert list
2412+
```
2413+
2414+
```sh output
2415+
ID: 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d
2416+
Name: my-origin-cert
2417+
Issuer: CN=my-secured-origin.com,OU=my-team,O=my-org,L=San Francisco,ST=California,C=US
2418+
Created on: 1/01/2023
2419+
Expires: 1/01/2025
2420+
2421+
ID: c5d004d1-8312-402c-b8ed-6194328d5cbe
2422+
Issuer: CN=another-origin.com,OU=my-team,O=my-org,L=San Francisco,ST=California,C=US
2423+
Created on: 1/01/2023
2424+
Expires: 1/01/2025
2425+
```
2426+
2427+
### `delete`
2428+
2429+
Delete a client certificate.
2430+
2431+
```txt
2432+
wrangler cert delete {--id <ID|--name <NAME>}
2433+
```
2434+
2435+
- `--id` <Type text="string" />
2436+
- The ID of the mTLS or CA certificate.
2437+
- `--name` <Type text="string" />
2438+
- The name assigned to the mTLS or CA certificate at upload.
2439+
2440+
<Render file="wrangler-commands/global-flags" product="workers" />
2441+
2442+
The following is an example of using the `delete` command to delete an mTLS or CA certificate.
2443+
2444+
```sh
2445+
npx wrangler cert delete --id 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d
2446+
```
2447+
2448+
```sh output
2449+
Are you sure you want to delete certificate 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d (my-origin-cert)? [y/n]
2450+
yes
2451+
Deleting certificate 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d...
2452+
Deleted certificate 99f5fef1-6cc1-46b8-bd79-44a0d5082b8d successfully
2453+
```
2454+
2455+
---
2456+
23272457
## `types`
23282458

23292459
Generate types from bindings and module rules in configuration.

0 commit comments

Comments
 (0)