> 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/s/scopnet-nac.md).

# ScopNet NAC

ScopNet NAC is a network access control product that stores detected hosts in a Microsoft SQL Server database. OctoXLabs queries that database and adds the detected hosts to the device inventory.

## Use cases

* List hosts that ScopNet NAC detected.

```
Adapters = scopnet-nac
```

* Find NAC-detected hosts that no EDR covers.

```
Adapters = scopnet-nac AND NOT Adapters = falcon-crowdstrike
```

## Before you begin

### Network

| Source              | Destination                                | Port                         | Protocol         |
| ------------------- | ------------------------------------------ | ---------------------------- | ---------------- |
| OctoXLabs connector | MSSQL Server of ScopNet NAC (IP you enter) | 1433 (default, configurable) | TCP (SQL Server) |
| OctoXLabs connector | Kerberos KDC (only for Kerberos auth)      | Not verified                 | Kerberos         |

### Required permissions

| Scope or role | Permission   | Needed for                                                                |
| ------------- | ------------ | ------------------------------------------------------------------------- |
| SQL login     | Select, List | `nac_detected_hosts` and `NAC_OBJECT_TYPES` tables in the chosen database |

The instructions state that the user must have Select and List privileges.

## Create credentials in ScopNet NAC

{% stepper %}
{% step %}

### Open SSMS

Open MSSQL Server Management Studio.
{% endstep %}

{% step %}

### Create the login

Under **Security**, right-click **Login** and click **New Login**.
{% endstep %}

{% step %}

### Pick the authentication

Select the authentication method the server uses.
{% endstep %}

{% step %}

### Fill in the details

Fill in the details and select your database in **Default Database**.
{% endstep %}

{% step %}

### Save the user

Save the user.
{% endstep %}

{% step %}

### First login

Log in to the database once with this user to avoid an error.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter                | Required    | Type    | Default  | Description                                                                                                  |
| ------------------------ | ----------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------ |
| IP                       | Yes         | String  | None     | IP address of the MSSQL Server host.                                                                         |
| Port                     | No          | Integer | 1433     | SQL Server port.                                                                                             |
| Domain                   | No          | String  | None     | Active Directory domain. When set, the login is `DOMAIN\username`.                                           |
| Database                 | Yes         | String  | None     | Database to connect to.                                                                                      |
| Username                 | Yes         | String  | None     | SQL Server login.                                                                                            |
| Password                 | Conditional | String  | None     | Required for SQL auth and for Kerberos mode password. May be empty for Kerberos mode keytab.                 |
| Use PyODBC Driver        | No          | Boolean | False    | Use PyODBC instead of pymssql. Needs ODBC Driver 17 or 18 for SQL Server. Driver 17 is tried first, then 18. |
| Batch Size               | No          | Integer | 300      | Rows fetched per batch.                                                                                      |
| Use MAC Aggregation      | No          | Boolean | True     | Aggregate hosts without a usable host name by MAC address. When off, such hosts are skipped.                 |
| Query Timeout            | No          | Integer | 60       | Query timeout in seconds.                                                                                    |
| Auth Type                | No          | String  | SQL      | SQL or Kerberos.                                                                                             |
| Kerberos Mode            | No          | String  | password | password uses the user name and password to get a TGT. keytab uses an uploaded keytab.                       |
| Kerberos Realm           | No          | String  | None     | AD realm in uppercase, for example CORP.LOCAL. May be empty if the user name is in UPN form.                 |
| KDC IP                   | No          | String  | None     | Host or IP of the KDC (usually a domain controller).                                                         |
| Kerberos SPN             | No          | String  | None     | Service principal name override, for example MSSQLSvc/sqlserver.corp.local:1433.                             |
| Keytab                   | Conditional | String  | None     | Required for Kerberos mode keytab. Generate it with ktpass on a domain controller.                           |
| Encrypt                  | No          | Boolean | True     | TLS between client and server. Applied only with Kerberos.                                                   |
| Trust Server Certificate | No          | Boolean | True     | Skip certificate chain validation. Applied only with Kerberos.                                               |

## Troubleshooting

| Error message                                                                                                     | Cause                                                                                                                                      | Fix                                                                                                                          |
| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| Password is required for SQL Server Authentication.                                                               | Auth Type is SQL and Password is empty.                                                                                                    | Enter a password.                                                                                                            |
| Keytab is required when kerberos\_mode is 'keytab'.                                                               | Kerberos keytab mode without a keytab.                                                                                                     | Upload the keytab.                                                                                                           |
| Password is required when kerberos\_mode is 'password'.                                                           | Kerberos password mode without a password.                                                                                                 | Enter a password.                                                                                                            |
| No ODBC Driver found. Install 'ODBC Driver 17' or 'ODBC Driver 18' for SQL Server.                                | PyODBC or Kerberos is on and no driver is installed.                                                                                       | Install ODBC Driver 17 or 18 on the connector host.                                                                          |
| Kerberos config failed: SQL Server reports auth\_scheme=''. Check SPN registration in AD and the Encrypt setting. | The session did not use Kerberos, for example NTLM fallback.                                                                               | Check the SPN registration in Active Directory and the Encrypt setting.                                                      |
| Status Code:                                                                                                      | The API answered with a status other than the one the connector expects. The message also lists the URL, the method and the response body. | Read the status code and the response body in the message, then check the credentials, the permissions and the network path. |

## Change history

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