Overview

A private location worker can reach any endpoint that its underlying host can reach, unless its configuration restricts outbound (egress) network access. Configuration files generated for new private locations set enableDefaultBlockedIpRanges to true, which blocks reserved and private IP ranges. The worker default is false. Private locations with older configuration files, and workers started without this option, do not restrict egress. Without restrictions, any user who can create a test on the private location can point that test at any reachable address.

To reduce this risk:

The allow and block lists apply to all test types that run on the private location.

Restrict egress with allow and block lists

The worker supports five options to control which addresses and hostnames tests can reach. For the full reference, see All configuration options.

OptionTypeDefaultEffect
enableDefaultBlockedIpRangesBooleanfalse (true in configuration files generated for new private locations)Blocks reserved and private IP ranges (see Default blocked ranges).
blockedIPRangesArray of strings, per IP familynoneBlocks additional IP addresses or CIDR ranges.
allowedIPRangesArray of strings, per IP familynoneAllows IP addresses or CIDR ranges that a block list otherwise blocks.
blockedDomainNamesArray of stringsnoneBlocks hostnames. Accepts wildcards such as *.example.com.
allowedDomainNamesArray of stringsnoneAllows hostnames that a block list otherwise blocks. Accepts wildcards.

The worker evaluates the lists in this order:

  1. Before the DNS lookup, the worker checks the hostname. A hostname that matches allowedDomainNames is allowed, and the worker skips the IP checks for that request. A hostname that matches blockedDomainNames is blocked.
  2. After the DNS lookup, the worker checks the resolved IP address. An address in allowedIPRanges is allowed. An address in blockedIPRanges, or in the default blocked ranges when enableDefaultBlockedIpRanges is true, is blocked.

Allow lists take precedence over block lists. allowedIPRanges has no effect if no IP range is blocked. In that case, the worker logs a warning at startup.

A hostname in allowedDomainNames bypasses all IP checks. If an allowed hostname resolves to a private or metadata address, tests can reach that address.

Default blocked ranges

When enableDefaultBlockedIpRanges is true, the worker blocks the following IPv4 ranges:

  • 0.0.0.0/8, 10.0.0.0/8, 100.64.0.0/10, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.168.0.0/16
  • 192.0.0.0/24, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.88.99.0/24, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24
  • 224.0.0.0/4, 240.0.0.0/4, 255.255.255.255/32

It also blocks IPv6 special-purpose ranges, including ::1/128, fc00::/7, fe80::/10, ::ffff:0:0/96, and 2002::/16. These ranges come from the IANA IPv4 and IPv6 Special-Purpose Address Registries.

Note: The default list includes the private ranges 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. If your private location tests internal applications, add their address ranges to allowedIPRanges.

Datadog recommends the following configuration:

  • Keep enableDefaultBlockedIpRanges set to true. Configuration files generated for new private locations set it to true. For older private locations, set it to true in the configuration file.
  • Add only the ranges that your tests need to allowedIPRanges. Use the smallest range possible, and use /32 (IPv4) or /128 (IPv6) for single hosts.
  • Use allowedDomainNames only for hostnames whose DNS records you control.
  • Optionally, to restrict tests to a known set of hostnames, set blockedDomainNames to * and list the hostnames that tests need in allowedDomainNames. A * entry matches every hostname, so the worker blocks every hostname that is not explicitly allowed.

The following examples block the default ranges and allow one internal application subnet and one hostname:

{
  "enableDefaultBlockedIpRanges": true,
  "allowedIPRanges": {
    "4": ["10.20.30.0/24"]
  },
  "allowedDomainNames": ["app.internal.example.com"]
}
docker run --rm --cap-add=NET_ADMIN -v $PWD/worker-config.json:/etc/datadog/synthetics-check-runner.json \
  datadog/synthetics-private-location-worker \
  --enableDefaultBlockedIpRanges \
  --allowedIPRanges.4="10.20.30.0/24" \
  --allowedDomainNames="app.internal.example.com"

Merge the options into the JSON configuration that you pass in configFile:

configFile: |-
  {
    "enableDefaultBlockedIpRanges": true,
    "allowedIPRanges": {
      "4": ["10.20.30.0/24"]
    },
    "allowedDomainNames": ["app.internal.example.com"]
  }

If you manage the configuration in your own secret with configSecret, add the same options to that secret.

Further Reading