Skip to content

Commit

Permalink
update API commands
Browse files Browse the repository at this point in the history
  • Loading branch information
ranbel committed Oct 9, 2024
1 parent 7664f75 commit 019d0b2
Showing 1 changed file with 22 additions and 28 deletions.
50 changes: 22 additions & 28 deletions src/content/partials/cloudflare-one/ssh/ssh-proxy-ca.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,27 @@

---

import { Render } from "~/components"

1. If you have not yet generated your Cloudflare SSH CA, make a `POST` request to the Cloudflare API with your email address and [API key](/fundamentals/api/get-started/keys/) as request headers.

```bash
curl --request POST \
"https://api.cloudflare.com/client/v4/accounts/{account_id}/access/gateway_ca" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>"
```

2. If you have already created your Cloudflare SSH CA or try the above and receive the error message, "access.api.error.gateway_ca_already_exists," modify the above command to a `GET` request instead.

```bash
curl --request GET \
"https://api.cloudflare.com/client/v4/accounts/{account_id}/access/gateway_ca" \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>"
```

3. If you would like to use an API token instead of a Global API key, the token must have edit permissions for "Access: SSH Auditing" permissions. The `POST` or `GET` request should be modified to use the "Authorization: Bearer" value instead of "X-Auth-Key."

```bash
curl --request POST \
"https://api.cloudflare.com/client/v4/accounts/{account_id}/access/gateway_ca" \
--header "X-Auth-Email: <EMAIL>" \
--header "Authorization: Bearer <API_TOKEN>"
```
import { Render, Details } from "~/components"

1. [Create an API token](/fundamentals/api/get-started/create-token/) with the following permissions:

| Type | Item | Permission |
| ------- | ---------------- | ---------- |
| Account | Access: SSH Auditing | Edit |

2. If you have not yet generated a Cloudflare SSH CA, make a `POST` request to the Cloudflare API:

```bash
curl --request POST \
"https://api.cloudflare.com/client/v4/accounts/{account_id}/access/gateway_ca" \
--header "Authorization: Bearer <API_TOKEN>"
```

3. If you have already created a Cloudflare SSH CA or receive the error message `access.api.error.gateway_ca_already_exists`, make a `GET` request instead:

```bash
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/access/gateway_ca \
--header "Authorization: Bearer <API_TOKEN>"
```

4. Copy the `public_key` value returned in the response.

0 comments on commit 019d0b2

Please sign in to comment.