> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xorlab.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Pages under /latest/ document the current release. Paths that begin with a version number, for example /10.0/, are frozen snapshots of superseded releases kept for reference only — never present their instructions as current. If the reader's version is unknown, answer from /latest/ and say which version the answer describes.
> xorlab is deployed on-premises, hybrid, or as a cloud service, and integrates with either Microsoft 365 or on-premises mail infrastructure. Configuration steps often differ between these. State which deployment and integration mode an instruction applies to instead of presenting one as universal.
> Distinguish inline mode from monitoring mode when describing anything that acts on email. Monitoring mode observes a copy and cannot block or quarantine; inline mode routes mail through xorlab and can.
> Write the product name as lowercase 'xorlab'. Use the documented component names: xorlab Control Center (XCC), xorlab MTA, xorlab Sandbox (DANA), xorlab Natural Language Understanding (NLU). After the first mention, use the short forms XCC, MTA, Sandbox, and NLU. Do not use DANA as a standalone name for the Sandbox, but keep it where it is a literal string in configuration keys, container names, and hostnames.
> Do not invent configuration keys, rule parameters, list names, log properties, or API fields. If a value is not present in this documentation, say that it is not documented rather than guessing.

# Enable Spamhaus Integration

> Integrate Spamhaus DQS through the SpamAssassin plugin by supplying a valid key.

Providing a valid key will trigger an automated process to configure this plugin.

## Configuring Spamhaus DQS

First, ensure the tenant’s `local.cf` file is correctly configured. Using [Expert Editor](/latest/expert-editor), in the `activeguard/core/startup_cfg/spamass/local.cf` file, make sure that:

* `skip_uribl_checks` is set to `0` to enable the [`URIDNSBL` plugin](https://spamassassin.apache.org/full/3.2.x/doc/Mail_SpamAssassin_Plugin_URIDNSBL.html)
* `skip_rbl_checks` is set to `0` to enable the `Realtime Blackhole List` checks
* the `dns_query_restriction` list does not contain the value `spamhaus.net` but it does contain `spamhaus.org`

Please also make sure that the trusted MTAs in Spamassassin are configured correctly in `local.cf`.

Some keys are Hash Blocklist (HBL) enabled, some are not. Where to write the key depends on whether the key is HBL enabled and whether you want to use this feature. Therefore, configure Spamhaus either with or without HBL as described below.

### Using Spamhaus DQS with HBL

1. Using Expert Editor, create a new file at `activeguard/core/startup_cfg/spamass/spamhaus_hbl_license.txt`.
2. Populate it with your key and only your key.

### Using Spamhaus DQS without HBL

1. Using Expert Editor, create a new file at `activeguard/core/startup_cfg/spamass/spamhaus_license.txt`.
2. Populate it with your key and only your key.

## Triggering the configuration script

After you have completed the steps above, click **Publish**. Then [**restart the `ag_core` container**](/latest/activate-configuration#configuration-files), because the Spamhaus files under `activeguard/core/startup_cfg/` require an MTA restart:

```shell theme={null}
cd /etc/xorlab/activeguard/
docker compose down && docker compose up -d
```

and check the `stdout` log of `core` (either use Loki or the command line `docker compose logs core`) for the line containing the message `Spamassassin DQS config successfully linted`. This indicates that the configuration files have been successfully written to the Spamassassin configuration directory and are valid.

The communication runs via DNS, therefore you don’t have to change your firewall config.

## Testing

1. Run the [Spamhaus Blocklist Tester (BLT)](https://blt.spamhaus.com).

2. Under `Data Query Service Test`, enter your DQS key, and for the `Test Type` select `Both`, then enter a guarded email address for your tenant to which you have access and permission to use.

   The tests will display as failed in the BLT itself, as they are successfully delivered to the tenant’s mailserver, but are filtered out later by xorlab Security Platform. The BLT cannot know this.

3. The mailbox will receive several emails from `test@unlisted.blt.spamhaus.net`:

   * If the key supplied is HBL-enabled, these should all be quarantined and tagged as `#blacklistedexternal`.
   * If the key is not HBL-enabled, these should all be quarantined and tagged as `#blacklistedexternal` except those with `hbl` in the subject; for example, `BLT DQS Content Test Email (19843:248226:hbl-dqs-body-cc-wallet)`.

## Disabling Spamhaus

You should disable Spamhaus when its license expires to avoid any issues:

1. Remove the license file—either `spamhaus_hbl_license.txt` or `spamhaus_license.txt`—from `activeguard/core/startup_cfg/spamass/` in Expert Editor.

2. While in Expert Editor, open `activeguard/core/startup_cfg/spamass/local.cf` and set `skip_rbl_checks` and `skip_uribl_checks` to `1`.

3. Click **Publish**, then [restart the container](/latest/activate-configuration#configuration-files):

   ```shell theme={null}
   cd /etc/xorlab/activeguard/
   docker compose stop core && docker compose down && sleep 2 && docker compose up -d
   ```
