Skip to content

PCAPs bucket setup

Before you can begin a full packet capture, you must first configure a bucket that Cloudflare can use to upload your files. Setting up a bucket is not required for sample packet captures.

You can configure an Amazon S3 or Google Cloud Platform bucket to use as a target. You can also use R2 as a target using the API.

Set up a bucket

Learn how to set up a bucket for use with full packet captures.

  1. Log in to your Cloudflare dashboard, and select you account.
  2. Select Magic Transit or Magic WAN.
  3. From the Packet captures page, select the Buckets tab.
  4. Select Add a bucket.
  5. Under Bucket configuration, select a bucket service and select Next.
  6. Enter the information related to your bucket for your service provider.
  7. When you are done, select Next.

The Prove ownership step of the Bucket configuration displays.

Next, validate the bucket and confirm ownership.

Validate a bucket

After the initial bucket set up, you need to confirm you own the bucket via an ownership challenge. After you validate your bucket, you can begin using it to collect full packet captures.

  1. From the Prove ownership step of the Bucket configuration, locate the Ownership token field.
  2. In the Ownership token field, enter the ownership token for your service provider.
  3. When you are done, select Create. The Packet captures page displays.

The Buckets tab displays a list of the buckets associated with your account. Refer to the Status column to see the status of your bucket configuration.

The bucket status displays one of the following options:

  • Success: The bucket is fully verified and ready to use.
  • Pending: The challenge response was initiated but is pending verification. Bucket verification can take five to ten minutes to finish processing.
  • Failed: The bucket could not be validated. If this occurs, verify your ownership information.

List configured buckets

View a list of all buckets configured on your account.

  1. Log in to your Cloudflare dashboard, and select you account.
  2. Select Magic Transit or Magic WAN.
  3. In Packet captures, select Start a capture.
  4. Select the Buckets tab.

The list of buckets associated with your account displays.

To learn how to collect packet captures, refer to Collect packet captures.

R2

To start collecting packet captures with R2, you first need to configure it properly. For all the required details, refer to the Cloudflare R2 documentation.

Create bucket and API token

  1. Log in to your Cloudflare dashboard, and select you account.
  2. Select R2 > Create bucket.
  3. Give your bucket a name > Create bucket.
  4. Go to the R2 Overview page, and select Manage R2 API Tokens.
  5. Select Create API Token.
  6. In Permissions, choose Object Read & Write. Make sure you also select Apply to specific buckets only, and select the bucket you have created for PCAPs from the drop-down menu.
  7. Select Create API Token.
  8. Make sure you copy the Secret Access Key and Access Key ID values, as you will need them for the next step.

Create initial request

Create your initial request to R2:

Terminal window
curl https://api.cloudflare.com/client/v4/accounts/{account_id}/pcaps/ownership \
--header "X-Auth-Email: <EMAIL>" \
--header "X-Auth-Key: <API_KEY>" \
--header "Content-Type: application/json" \
--data '{
"destination_conf": "r2://<BUCKET_NAME>?account-id=<ACCOUNT_ID>&access-key-id=<R2_ACCESS_KEY_ID>&secret-access-key=<R2_SECRET_ACCESS_KEY>"
}'

The response has a "filename" parameter with the name of a file that Cloudflare wrote to your R2 bucket. You need to download it for the next step. Example:

{
"errors": [],
"messages": [],
"result": {
"destination_conf": "<YOUR_R2_BUCKET>",
"filename": "ownership-challenge-9883874ecac311ec8475433579a6bf5f.txt",
"id": "9883874ecac311ec8475433579a6bf5f",
"status": "success",
"submitted": "2020-01-01T08:00:00Z",
"validated": "2020-01-01T08:00:00Z"
},
"success": true
}

Validate bucket ownership

Refer to the Validate a bucket API instructions for more details on the entire process to validate your R2 bucket. When specifying the R2 destination for this validation, exclude the secret and access keys from the URL.