Cloudflare SASE

SamurAI [Local] CollectorSamurAI [Cloud] Collector
Picture1.svg

This guide describes the steps required to configure Cloudflare to stream its Zero Trust, Gateway, Magic Transit and Browser Isolation logs to public cloud storage (Microsoft Azure Blob Storage or Amazon S3) for ingestion to the SamurAI platform via a Cloud Collector.

The logs are delivered by:

  • Creating a Logpush job in the Cloudflare dashboard for each dataset
  • Cloudflare writing the log files to a customer owned cloud storage container / bucket
  • The SamurAI Cloud Collector monitoring that storage for new files and pulling the data into the SamurAI platform

Prerequisites

Ensure that a Samurai Cloud Collector has been deployed via the SamurAI Portal for your chosen cloud provider (Microsoft Azure or Amazon Web Services).

Take note of the following as it will be required when configuring the Logpush destination:

  • Microsoft Azure — the Storage account name
  • Amazon Web Services — the S3 bucket name and the Region

If you are planning to reuse an already deployed Cloud Collector, this information can be found via:

  1. Navigate to the SamurAI Portal
  2. Click Telemetry and select Collectors from the main menu
  3. Click on the name of the desired Collector
  4. Note down the storage information presented

Supported datasets

DatasetSourcetypeProduct
Gateway HTTPcloudflare_gateway_httpGateway HTTP
Gateway DNScloudflare_gateway_dnsGateway DNS
Gateway Networkcloudflare_gateway_networkGateway Network
Zero Trust Network Sessioncloudflare_zerotrust_network_sessionZero Trust Network Session
Network Analyticscloudflare_network_analyzeNetwork Analytics
Device Posture Resultscloudflare_device_postureDevice Posture
Audit Logs v2cloudflare_audit_logs_v2Audit Logs v2
Access Requestscloudflare_access_requestAccess Request
Browser Isolation User Actionscloudflare_remote_browser_isolationRemote Browser Isolation

Storage naming requirement

Configure Logpush in Cloudflare

Follow the vendor documentation to create one Logpush job per dataset, writing to the storage prepared above.

Logpush jobs for the SASE datasets are created at the account level.

Select the section below that matches your deployed Cloud Collector, complete the destination steps, then apply the Logpush job settings.

Amazon S3 (AWS Cloud Collector)

  1. Confirm the bucket name and region. Use the S3 bucket name and Region noted in the Prerequisites. This is the bucket monitored by the Cloud Collector.

  2. Start creating the Logpush job. In the Cloudflare dashboard, open the Logpush page, select Create a Logpush job and choose Amazon S3 as the destination.

  3. Enter the bucket and copy the bucket policy. Enter the S3 bucket name in the Bucket field. Once entered, Cloudflare automatically generates the bucket policy JSON that allows Cloudflare to upload logs to the bucket. Copy it, but do not select Continue yet.

  4. Add the Cloudflare statement to the existing bucket policy. In the AWS Management Console open the bucket, then Permissions > Bucket policy. Add the Statement element generated by Cloudflare as a new element in the existing Statement array.

    For example, the bucket policy initially contains only the read permission for the Cloud Collector:

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "AllowSamuraiXdrReader",
          "Effect": "Allow",
          "Principal": {
            "AWS": "arn:aws:iam::600502389717:user/samurai-xdr-s3-reader-user"
          },
          "Action": [
            "s3:GetObject",
            "s3:ListBucket"
          ],
          "Resource": [
            "arn:aws:s3:::<bucket-name>",
            "arn:aws:s3:::<bucket-name>/*"
          ]
        }
      ]
    }
    

    After adding the Cloudflare statement, the policy will look similar to the following. Save the policy.

    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "Stmt1506627150918",
          "Effect": "Allow",
          "Principal": {
            "AWS": "arn:aws:iam::391854517948:user/cloudflare-logpush"
          },
          "Action": "s3:PutObject",
          "Resource": "arn:aws:s3:::<bucket-name>/*"
        },
        {
          "Sid": "AllowSamuraiXdrReader",
          "Effect": "Allow",
          "Principal": {
            "AWS": "arn:aws:iam::600502389717:user/samurai-xdr-s3-reader-user"
          },
          "Action": [
            "s3:GetObject",
            "s3:ListBucket"
          ],
          "Resource": [
            "arn:aws:s3:::<bucket-name>",
            "arn:aws:s3:::<bucket-name>/*"
          ]
        }
      ]
    }
    
  5. Enter the Path and Bucket region. Return to the Cloudflare Logpush page and complete the following:

    • Path: enter a value that ends with the required suffix for the dataset, as listed in Storage naming requirement — for example contoso-cloudflare-gateway-http. The Path is what the SamurAI platform uses to identify the dataset, so each dataset needs its own Path.
    • Enable Organize logs into daily subfolders.
    • Bucket region: select the region of the bucket confirmed in step 1.
    • Select Continue.
  6. Complete ownership verification. Cloudflare places an ownership verification file at the specified bucket and Path. Open the file in the S3 bucket, copy the ownership token, enter it in Cloudflare and select Continue.

Microsoft Azure (Azure Cloud Collector)

  1. Create a container for the dataset. In the Azure portal open the Storage account noted in the Prerequisites and create a Blob Storage container whose name ends with the required suffix for the dataset, as listed in Storage naming requirement — for example contoso-cloudflare-gateway-http. Each dataset needs its own container.

  2. Generate a SAS URL. In the Storage account select Security + networking > Shared access signature and configure:

    • Allowed services: Blob
    • Allowed resource types: Object
    • Allowed permissions: Write
    • Allowed protocols: HTTPS only
    • Expiry time: Cloudflare requires an expiration period of at least five years (see the note below)

    Select Generate SAS and connection string and copy the Blob service SAS URL.

  3. Create the Logpush job. In the Cloudflare dashboard, open the Logpush page, select Create a Logpush job and choose Microsoft Azure as the destination. Complete the following:

    • SAS URL: enter the Blob service SAS URL generated in step 2.
    • Path: enter the container name created in step 1 (ending with the required suffix). The Path is what the SamurAI platform uses to identify the dataset.
    • Enable Organize logs into daily subfolders.
    • Select Continue.

Logpush job settings

After the destination steps, on the dataset selection and job configuration screens:

  • Select the dataset that matches the Path you entered.
  • Set the Job name to the same string as the Path.
  • Under If logs match…, select All logs.
  • Under Send the following fields…, do not leave Select all checked. Select only the fields listed in Fields to send for that dataset.
  • Set Timestamp format to RFC3339.
  • Select Submit to create the job.

Repeat for each dataset

Repeat the steps above for each dataset you wish to onboard. The bucket policy (Amazon S3) and SAS URL (Microsoft Azure) can be reused, however the Path / container, ownership verification (Amazon S3), dataset selection and job settings must be completed for each dataset.

Finally, return to the Logpush page and confirm that all created jobs are listed and enabled.

Fields to send

The lists below are the minimum set of fields required for the SamurAI platform to analyse each dataset. Selecting Select all sends a large volume of data that the platform does not use, which increases storage and egress costs without improving detection coverage.

In the Send the following fields… section of each Logpush job, clear Select all and tick at least the fields listed for that dataset.

Gateway HTTP

Action, ApplicationNames, BlockedFileHash, BlockedFileName, BlockedFileSize, BlockedFileType, CategoryNames, Datetime, DestinationIP, DestinationIPCountryCode, DestinationPort, DeviceID, DeviceName, DownloadMatchedDlpProfiles, Email, FileInfo, HTTPHost, HTTPMethod, HTTPStatusCode, HTTPVersion, PolicyName, Referer, RequestID, SessionID, SourceIP, SourceIPCountryCode, SourceInternalIP, SourcePort, URL, UploadMatchedDlpProfiles, UserAgent, UserID, VirtualNetworkName

Gateway DNS

ApplicationName, AuthoritativeNameServerIPs, CNAMECategoryNames, CNAMEs, Datetime, DeviceID, DeviceName, DstIP, DstPort, Email, MatchedIndicatorFeedNames, PolicyName, Protocol, QueryCategoryNames, QueryName, QuerySize, QueryTypeName, RCode, ResolvedIPs, ResolverDecision, ResponseTimeMs, SrcIP, SrcIPCountryCode, SrcPort, UpstreamRecordTTLs, UserID

Gateway Network

Action, ApplicationNames, CategoryNames, Datetime, DestinationIP, DestinationIPCountryCode, DestinationPort, DetectedProtocol, DeviceID, DeviceName, Email, OverrideIP, OverridePort, PolicyName, SNI, SessionID, SourceIP, SourceIPCountryCode, SourceInternalIP, SourcePort, TransportProtocol, UserID, VirtualNetworkName

Zero Trust Network Session

BytesReceived, BytesSent, ConnectionCloseReason, DestinationTunnelID, DetectedProtocol, DeviceID, DeviceName, EgressIP, EgressRuleName, Email, Offramp, OriginIP, OriginPort, OriginTLSCertificateIssuer, Protocol, ResolvedFQDN, SNI, SessionEndTime, SessionID, SessionStartTime, SourceIP, SourceInternalIP, SourcePort, UserID, VirtualNetworkID

Network Analytics

AttackID, AttackVector, DNSQueryName, DNSQueryType, Datetime, DestinationCountry, DestinationPort, Direction, ICMPCode, ICMPType, IPDestinationAddress, IPProtocol, IPProtocolName, IPSourceAddress, IPTTL, MitigationReason, MitigationSystem, Outcome, RuleID, RuleName, SourceCountry, SourcePort, TCPFlagsString, Verdict

Device Posture Results

DeviceID, DeviceManufacturer, DeviceModel, DeviceName, DeviceSerialNumber, DeviceType, Email, OSVersion, PolicyID, PostureCheckName, PostureCheckType, PostureEvaluatedResult, PostureExpectedJSON, PostureReceivedJSON, Timestamp, UserUID

Audit Logs v2

ActionDescription, ActionResult, ActionTimestamp, ActionType, ActorContext, ActorEmail, ActorID, ActorIPAddress, ActorType, AuditLogID, ResourceID, ResourceProduct, ResourceRequest, ResourceResponse, ResourceType, ZoneID, ZoneName

Access Requests

Action, Allowed, AppDomain, Connection, Country, CreatedAt, Email, IPAddress, PurposeJustificationResponse, RayID, UserUID

Browser Isolation User Actions

Decision, DomainName, Metadata, Timestamp, Type, URL, UserEmail, UserID

Our Integration guide was accurate at the time of writing but vendors change things frequently! If you find errors or anything is outdated, let us know by raising a request in the SamurAI MDR Portal and we shall get it updated.