Enhance the security of your website with Oracle Cloud Infrastructure’s Web Application Firewall

Oracle recently introduced a Web Application Firewall (WAF) to further enhance and secure Oracle Cloud Infrastructure offerings. The Oracle Cloud Infrastructure WAF is based on Oracle Zenedge and Oracle Dyn technologies. It inspects all traffic destined to your web application origin and identifies and blocks all malicious traffic. The WAF offers the following tools, which can be used on any website, regardless of where it is being hosted:

  • Origin management
  • Bot management
  • Access control
  • Over 250 robust protection rules that include the OWASP rulesets to protect against SQL injection, cross-site scripting, HTML injection, and more

In this post, I configure a set of access control WAF policies to a website. Access control defines explicit actions for requests that meet conditions based on URI, request headers, client IP address, or countries and regions.

Conditions can use regular expression and list comparison tools. Actions can be detections or blocks. The website that I use is ‘www.denzura.com’, previously created with Oracle Cloud Infrastructure Edge DNS services.

Create a WAF Policy Zone

  1. Sign in to your tenancy in the Oracle Cloud Infrastructure Console.
  2. Open the navigation menu. Under Solutions, Platform and Edge, go to Edge Services and click WAF Policies.
  3. Select a compartment for your WAF policy to reside in. If one is preselected, ensure that you want your WAF policy to reside there, or select another compartment.
  4. Click Create WAF Policy.
  5. For the policy name, enter a unique name for the policy (this example uses MyWAF).
  6. In the Domains section, for Primary Domain enter the naked domain of your website (this example uses denzura.com). In the Additional Domains field, enter a third-level domain. The default or the most commonly used third-level domain is www, which is what I’m using.  The complete example entry to this field is ‘www.denzura.com’. If you want to add additional domains, click Additional Domain.
    Note: The Additional Domains field hosts the subdomains where the policies are applied.
  7. In the WAF Origin section, for Origin Name, enter a name that is unique in your tenancy. The example in this post is DenzuraWAF.
  8. For the URI field, use either an IPv4 address or an FQDN. In this example, I’m using the IP address of the website:
    Note: For this example, I’m not using Advanced Origin Options or Tagging.
  9. Click Create WAF Policy.


In a few minutes, the policy is created.


Notice the message that indicates to visit your DNS provider.


In this example, I added the third-level domain www to the CNAME record that was output by the WAF Policy.

Add CNAME Record to your DNS Zone

The following instructions are for DNS zone management in Oracle Cloud Infrastructure Edge services. If your DNS zone is outside of Oracle Cloud Infrastructure, follow your provider instructions.

  1. Open the navigation menu in the Console. Under Solutions, Platform and Edge, go to Edge Services and click DNS Zone Management.
  2. Select your zone name (in this example, Denzura.com).
  3. Click Add Record.
  4. In the Add Record dialog box, select the CNAME record from the list.
  5. In the Name field, enter www.
  6. In the TTL (Time To Live) field, enter a value in milliseconds (for example, 10).
  7. Leave the RDATA field as basic.
  8. In the Target field, paste the CNAME string that resulted by adding your WAF policy. The string in this example is denzura-com.b.waas.oci.oraclecloud.net.
  9. Click Submit.
  10. Click Publish Changes.


After the policy becomes active, verify that the WAF is serving the website.

Verify WAF coverage.

  1. Open a web browser (this example is using Google Chrome).
  2. Enter the web address of your domain name (for example, ‘www.denzura.com’).
  3. When the website is displayed, right-click and select Inspect.
  4. Click the Network tab.
  5. Click All.
  6. In the Name column, select ‘www.denzura.com’.
  7. Click the Headers tab.

The Server field should display ZENEDGE. This indicates that your website is being inspected by Oracle Cloud Infrastructure WAF.



Configure WAF Access Control rules

Now it’s time to create the access control rules. In this example, I block all traffic coming from the USA, with the exception of one IP address. To prove that the access control works, I access the ‘www.denzura.com’ website from a host located in the US and verify that access is blocked and that a custom message is displayed. Then I access the website from that one exception and verify that it loads normally. Finally, I access the same website from an Oracle Cloud Infrastructure Windows instance located in the Frankfurt region, with the IP address, and verify that it loads normally.

  1. Open the navigation menu in the Console. Under Solutions, Platform and Edge, go to Edge Services and click WAF Policies.
  2. Open the policy that you created (in this example, DenzuraWAF).
  3. Click Access Control.
  4. Click Add Access Rule.
  5. Enter a unique name for the access rule (in this example, Cease_and_Desist).
  6. Under Conditions, select Country/Region is from the Rule Conditions menu.
  7. From the Country/Region menu, select United States.
  8. Click Additional Condition.
  9. From the Rule Conditions menu, select IP Address in not.
  10. Enter the IP address from a host located anywhere in the US that will be the one exception for accessing the website (in this example, 146.140.71).
  11. Under Action, select Block.
  12. Under Block Action, select Show Error Response.
  13. As needed, customize the messages that open. In this post, I’ll modify the Block Error Page Description with the following message: “Access blocked by website owner. CEASE AND DESIST.”
  14. Click Add Access Rule.
  15. Under WAF Policy, click Unpublished Changes.
  16. Click Publish All. In the Publish Changes dialog box, click Publish All.

Access your website.

 It takes about 10 minutes for a WAF policy access control rule to become active. After it does, test the policy by accessing the website: www.denzura.com



Both the exception and the host in the Frankfurt region work; the website can be accessed as expected. You can download screenshots that show this access from https://bit.ly/2PdSXCX. They are hosted in Oracle Cloud Infrastructure Object Storage, and the link will be active until December 31, 2020.


Author: Sergio J. Castro

Sergio J. Castro is a Senior Cloud Solutions Engineer at Oracle North America Cloud, With 7 years of cloud computing experience and 26 years of overall IT experience, Sergio has worked from multinational companies such as Oracle, IBM, and Ericsson; to 10 person startup companies. He holds a Bachelor of Science Degree in Computer Science from the Autonomous University of Baja California. He is Certified as a Cloud Solutions Architect from both OCI and AWS, and he also earned a CCNA from Cisco Systems. He focuses on Networking and on Next-Generation IT services.

2 thoughts on “Enhance the security of your website with Oracle Cloud Infrastructure’s Web Application Firewall”

  1. Very good post on the Oracle Web application firewall. I have one question related to Edge Services.
    WAF and traffic management steering policies looks to be working on the basis of CNAME records, Is there a way to configure both WAF and Traffic Geo Steering policies for a same URL in OCI?


  2. Dear Raja, Thank you for your feedback! The answer to your question is yes, yes this is possible for a third level domain URL. First create your Traffic Steering policy and then configure the WAF Policy and apply it to your CNAME records.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: