Build a custom asset connector
Reveal module — This feature requires the Reveal add-on module.
This article explains how to build a custom asset connector that sends valid data and keeps your inventory free of duplicate assets. It applies to custom asset connectors only: connectors your community creates and runs.
Before you begin
- The Reveal add-on module is enabled for your community.
- You have Python 3.11 or later and the
sekoia-automation-sdkpackage. - You use
sekoia-automation-models1.5.0 or later.
Step 1: Set up the custom integration
- Create the integration that will hold the asset connector. See Create your own integration.
- Add the asset connector to the integration.
- Import the integration into your community.
- Check that the import passes the Validating integration step.
A community can own up to 10 custom integrations that contain an asset connector. Over this number, the import fails at the Validating integration step.
Step 2: Build valid connector items
- Build every item with an OCSF model of
sekoia-automation-models:DeviceOCSFModel,UserOCSFModel,SoftwareOCSFModelorVulnerabilityOCSFModel. - Send the items in an
AssetList.
Sekoia validates each push against the same models. An item updates the asset your community already has for it, whatever source created that asset. Step 4 says how each type of item is matched. How a push updates an existing asset says which properties a push overwrites, clears or keeps.
For complete code, see the asset connectors of Sekoia integrations in automation-library: devices from Nozomi, users from Google Workspace and vulnerability findings from Holm Security.
Step 3: Send items in batches
- Group items into batches of at most 200 items instead of sending them one by one. Sekoia drops the items after the 200th of a push, without an error.
- Keep each item under the item-size limit of 900 KB.
Each configuration has a rate limit on pushes per minute and a 24-hour item quota. The values are in Asset connector limits.
Step 4: Send assets
Each type of item follows its own rules, so that it updates the right asset.
Devices
- Build
hostnameanddomainwithsplit_hostname(), fromsekoia_automation_models.hostname. For instance,SRV01.corp.example.comgivessrv01andcorp.example.com. - Skip a device when
split_hostname()returns no hostname. - Send each machine with the same hostname at every run.
split_hostname() applies the hostname rule of Sekoia. A device without a usable hostname would be rejected.
A device updates the host asset with the same hostname detection property, regardless of case. Revoked assets are excluded. When none matches, a new host asset is created.
Users
- Send each account with the same username at every run.
A user updates the account asset with the same email when its username is an email address, or with the same username otherwise. When none matches, a new account asset is created.
Software
- Give each software a name. A software without a name is ignored.
- Give it the device it runs on, with the same hostname as the device item.
A software updates the application of the host asset with the same name and version. The host asset is the one with the same hostname as the device the item carries. A new version creates a new application.
Vulnerability findings
A vulnerability finding is a vulnerability that the source reports on one asset.
- Give each finding the device it affects, with the same hostname as the device item.
- Filter findings in the connector code before sending them, for instance by CVSS score, or by known exploitation when the source reports it.
- Send a finding with the Close activity when the source reports it fixed. Its status becomes remediated.
- Send the finding again without Close if the source reports it again. Its status becomes open.
Send only the findings with a CVSS base score of 7.0 or more
from sekoia_automation_models.ocsf.vulnerability import VulnerabilityOCSFModel
def is_worth_sending(finding: VulnerabilityOCSFModel) -> bool:
return any(
cvss.base_score is not None and cvss.base_score >= 7.0
for vulnerability in finding.vulnerabilities
if vulnerability.cve
for cvss in vulnerability.cve.cvss or []
)
A push never changes a status a user set, such as accepted risk or false positive.
A finding updates the finding of the same asset whose CVEs include all the CVEs it carries, or with the same finding_info.uid when it has no CVE. The asset is the one with the same hostname as the device the finding carries. When none matches, a new finding is created.
Step 5: Plan for storage limits
- Close fixed findings, so that open findings stay under their limit.
- Keep the hostnames and usernames of Step 4 stable, so that each machine and account updates a single asset.
Each configuration and each community can store a limited number of active assets, active applications and open findings. The limits follow the number of assets included in the community subscription. When a configuration reaches a storage limit, every push of the configuration receives a 429 ASSET_CONNECTOR_LIMIT_REACHED. See Storage limits for custom asset connectors.
Related articles
- Troubleshoot asset connectors: Push errors and the action for each.
- Asset connector limits: Rate limits, caps and storage limits.
- Assets: How a push updates the properties of an existing asset.
- Create an asset connector: How to configure an asset connector from the integration catalog.