Updated 2024-02-20

Getting Started with Edge Policies

Use the Web Application Firewall to manage Edge policies.

Before You Begin

Refer to the Overview of Web Application Firewall for important concepts about the WAF service.

To begin using the WAF service, you must have the following available:

  • Ensure that you have the Required IAM Service Policy permissions.
  • We recommended that you use a separate compartment for the WAF policy so that management is easier and more secure.
  • A main webapp domain.
  • IP address of the LBaaS or other public facing endpoint of the application.
  • Ability to update DNS records for the domain.
  • The WAF service only supports traffic on ports 80/443; however, after requests reach the WAF on ports 80/443, we're able to send the requests to your origin server on any port necessary. The following is an example:

    End User → Port 80/443 → WAF → Port 443/8000/555/*** → Origin Server

    Ensure that your application isn't running on other ports.
    Note

    You can't use WAF for traffic like SSH, FTP, or SMTP.

Also, if you plan to run your site on HTTPS/443, you need:

  • Public certificate for the fully qualified domain name (FQDN) of the application.
  • Corresponding private key for the site.
  • Certificate in PEM format.
  • Full chain certificate (Root, Intermediate, Origin Server)
    Note

    SSL certificates can only be applied to the main application of the policy.

Changes to Edge policies generally take 10 to 30 minutes to propagate, depending on the change. It takes that long to propagate because we have hundreds of nodes that new configurations are pushed to. The following feature changes typically propagate within 10 to 15 minutes:

  • Bots policies
  • Human Interaction Challenge (HIC)
  • Device Fingerprint Challenge
  • Javascript Challenge
  • CAPTCHA Challenge
  • Good Bot Whitelist
  • Access Rules
  • Thread Intelligence
  • IP Lists
  • IP Whitelist

Consider the following information when you work with Edge policies:

  • IPv6 isn't currently supported.

  • WAF inspects, but doesn't alter the response body.
  • The caching limit is 1 GB per policy.
  • For file size upload limitations, the limit is 1 GB. For file size limitations, consider:
    • The limit doesn't depend on the type of upload, such as images, videos, binaries, and so on.
    • The Content-Type header doesn't affect the limit. Only different protection rules are applied based on the Content-Type header.
    • Uploads using chunked or streams don't affect the limit. In buffering mode, the limit is 1 GB for uploads and downloads. However, some other modes, including streaming the response body, disregard the 1 GB limit.
    • WAF connections are rarely cancelled. A cancellation can occur because of large uploads or slow connections. After edge node reloads, a connection can be cancelled when a "cleanup" process is run, if the request or response cycle takes too long.
  • When using the WAF with content streaming services, the content streaming services might be affected because our protection rules require buffering of the full HTML content before analysis. The entire content needs to be buffered within our protection rules core engine, which might lead to slow responses or events not displaying the streaming content.
  • You can create or restore WAF policy backups with the OCI CLI. Extract the full JSON file of the web application and then re-create it in parts. We recommend that you recreate the main settings first, and then the security challenges and features of the web application.
  • You can enable WebSocket for a specific URL through the CLI by using the following command:

    oci waas policy-config update --waas-policy-id ocid1.waaspolicy.oc1..[WAAS POLICY OCID] --websocket-path-prefixes '["/url/url/websocket"]'

    Note

    WebSocket support prevents WAF processing in the specified paths. This means that if a WAF rule is enabled, it doesn't analyze the requests going to the URL excluded in the configuration. However, other countermeasures, such as Human Interaction Challenge and JavaScript Challenge, can be enabled to provide an extra layer of security for WebSocket URL.
  • The "key" in the Threat Intelligence Feed generated is different for each WAF policy.
  • You can make changes to Edge policies only when the policy status is ACTIVE.

Estimate cost for using WAF

Use this information to estimate costs for using the WAF service.
You can estimate the cost as follows:
  1. Go to: https://www.oracle.com/cloud/cost-estimator.html.
  2. Click Search and search for Networking - WAF.
  3. Click Add.
  4. Under Add Configuration, click the menu next to the service name, select Add by SKU, and then enter the SKU.
  5. Click Add.

    In the cost estimator, "Instance" represents the WAF policy.

Initial Setup of Your WAF Policy

1. Create an Edge Policy to Route Traffic Through the WAF

To begin, create an edge policy to route traffic through the WAF without rules enabled. Creating a policy without rules enabled ensures that there are no regressions by having a reverse proxy in front of the application.

2. Update Origin Keep Alive Timeout

The edge policy requires that your origin's (load balancer or web server) keep alive timeouts are maintained for 301 seconds or more, as our upstream timeout value is 300 seconds. The additional second is to ensure that the connection has enough time to renegotiate when our nodes create connections and avoid connectivity issues. This applies to API calls, as we use our OCI Network Multiplexing technology that helps to reduce network bottlenecks and improve performance by optimizing TCP protocol.

3. Upload Your Certificate and Key

This step assumes that your site runs on HTTPS/443.

4. Test Your Application (Before Deploying it to Production)

In this step, you ensure that requests are being routed to the WAF and that your application continues to function normally with a reverse proxy in the topology.

5. Update DNS to Enable WAF

After confirming your web application works flawless through WAF, you can now proceed to update the DNS globally.

In this step, you update the CNAME for your zone to route requests from internet clients to WAF. Use the following instructions to make this DNS change in the Console. If your DNS setup resides with another provider, refer to their documentation for instructions.

6. Securing Your WAF

To secure your WAF, you must configure your servers to accept traffic from the WAF servers. Configure your origin's ingress rules to only accept connections from the following CIDR ranges.

Enable WAF to Passively Detect Rules

WAF protection rules add extra CPU cycles to each transaction, therefore, we recommended enabling only the rules designed for your web application topology. WAF offers a set of recommended rules that will not harm your site performance and work with most of the web application. The WAF bot protection feature makes your web application fully secured to threats.

If you need help with setting up WAF, you can open a service request with My Oracle Support requesting OCI WAF tuning help. An expert will guide you through the process.

See Managing Edge Policies for the order of processing of WAF.

Test the Rules

When the policy is active, you can test that your rules are detected by WAF.