> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/o/oracle-cloud-network-firewall.md).

# Oracle Cloud Network Firewall

OCI Network Firewall is a managed firewall service. OctoXLabs reads the security rules of firewall policies in one region and collects every rule as a policy, with address lists, services and ICMP applications resolved into addresses, ports and protocols.

## Use cases

* List firewall rules collected from Oracle Cloud.

```
Adapters = oracle-cloud-network-firewall
```

## Before you begin

### Network

| Source              | Destination                                     | Port | Protocol |
| ------------------- | ----------------------------------------------- | ---- | -------- |
| OctoXLabs connector | `identity.<region>.oci.oraclecloud.com`         | 443  | HTTPS    |
| OctoXLabs connector | `network-firewall.<region>.ocs.oraclecloud.com` | 443  | HTTPS    |

### Required permissions

| Scope or role                             | Permission | Needed for                                                                            |
| ----------------------------------------- | ---------- | ------------------------------------------------------------------------------------- |
| `inspect compartments` in tenancy         | Inspect    | Listing compartments                                                                  |
| `read network-firewall-family` in tenancy | Read       | Listing firewalls needs inspect; security rules, address lists and services need read |

## Create credentials in Oracle Cloud Network Firewall

{% stepper %}
{% step %}

### Copy the tenancy OCID

In the OCI Console open the Profile menu, choose **Tenancy information** and copy the OCID. Format: `ocid1.tenancy.oc1..<id>`.
{% endstep %}

{% step %}

### Copy the user OCID

Open the Profile menu, choose **User settings** and copy the OCID of the IAM user that owns the API key. This is not the console username. Format: `ocid1.user.oc1..<id>`.
{% endstep %}

{% step %}

### Create an API signing key

In **User settings > API Keys**, choose **Add API key** and **Generate API key pair**, then download the private key (PEM). You can also generate a key pair with OpenSSL and upload the public key. The private key must not have a passphrase.
{% endstep %}

{% step %}

### Copy the fingerprint

After the public key is added, the fingerprint is shown under **API Keys**. Format: `aa:bb:...:aa:bb`.
{% endstep %}

{% step %}

### Add the policy

Put the user in a group and attach this policy:

```
Allow group <group> to inspect compartments in tenancy
Allow group <group> to read network-firewall-family in tenancy
```

{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter                   | Required | Type       | Default | Description                                                                                                     |
| --------------------------- | -------- | ---------- | ------- | --------------------------------------------------------------------------------------------------------------- |
| Region                      | Yes      | String     |         | OCI region identifier, for example `us-ashburn-1`. Firewalls are regional, so create one connection per region. |
| Tenancy OCID                | Yes      | String     |         | OCID of the tenancy.                                                                                            |
| User OCID                   | Yes      | String     |         | OCID of the IAM user that owns the API key.                                                                     |
| Fingerprint                 | Yes      | String     |         | Fingerprint of the API signing key.                                                                             |
| Private Key                 | Yes      | File (PEM) |         | Private key file. Keys with a passphrase are not supported.                                                     |
| Https Proxy                 | No       | String     |         | HTTPS proxy URL.                                                                                                |
| Include Unattached Policies | No       | Boolean    | False   | Also collect rules of policies that no network firewall uses. Those rules are not enforced.                     |
| Thread Count                | No       | Integer    | 32      | Parallel threads for reading rules. Min 1, max 32.                                                              |
| Sleep Time                  | No       | Integer    | 0       | Seconds between thread batches.                                                                                 |
| Timeout                     | No       | Integer    | 30      | Seconds to wait for API responses.                                                                              |

## Troubleshooting

| Error message                                                                                                                               | Cause                                                | Fix                                                  |
| ------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | ---------------------------------------------------- |
| Could not collect any network firewall security rule; see the warnings above. The user needs the 'read network-firewall-family' permission. | Rules could not be read for any firewall policy.     | Grant `read network-firewall-family` in the tenancy. |
| Max retries exceeded for                                                                                                                    | OCI answered 429 five times.                         | Lower Thread Count or raise Sleep Time.              |
| Invalid private key, upload the unencrypted PEM API signing key:                                                                            | The key file cannot be read, or it has a passphrase. | Upload the unencrypted PEM private key.              |

## Change history

{% hint style="info" %}
Available starting from version 6.9.1.
{% endhint %}
