> 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/secfusion.md).

# SecFusion

SecFusion consolidates vulnerability data in a Microsoft SQL Server database. OctoXLabs queries that database and adds the assets, their open vulnerabilities and open ports for the companies you choose to the device inventory. For the API variant, see SecFusion API.

## Use cases

* List assets that SecFusion reports.

```
Adapters = sec-fusion
```

* Find SecFusion assets with a high CVSS v3 finding.

```
Adapters = sec-fusion AND Vulnerabilities.Cvss3Base >= 7
```

## Before you begin

### Network

| Source              | Destination                           | Port                         | Protocol         |
| ------------------- | ------------------------------------- | ---------------------------- | ---------------- |
| OctoXLabs connector | MSSQL Server (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 | TblAsset, TblVuln, TblVulnCategory and TblNmapOpenPortsVuln |

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

## Create credentials in SecFusion

{% 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 %}

### Grant privileges

Give the user **Select** and **List** privileges.
{% 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 FQDN. When set with SQL auth, the login is `DOMAIN\username`.                        |
| Database                 | Yes         | String          | None     | Database to connect to.                                                                                      |
| Username                 | Yes         | String          | None     | SQL Server login used to connect to SecFusion.                                                               |
| Password                 | Conditional | String          | None     | Required for SQL auth and for Kerberos mode password. May be empty for Kerberos mode keytab.                 |
| Company IDs              | Yes         | List of numbers | None     | Company IDs to fetch data from. At least one. Digits only.                                                   |
| Custom Query             | No          | String          | None     | SQL predicate added as `AND (<custom query>)`, for example `[t0].[InsertDate] > '2024-01-01'`.               |
| Query Timeout            | No          | Integer         | 60       | Query timeout in seconds.                                                                                    |
| 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.                                                                                      |
| 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                                                                                                                          |
| ----------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- |
| At least one company id is required.                                                                              | Company IDs is empty.                                                                                                                      | Enter one or more company IDs.                                                                                               |
| 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.6.0.
{% endhint %}
