Join us Dec. 16 for The Community Hour, our first global virtual User Group event!

Custom ACC plugin

Michal9
Tera Contributor

Hello everyone, I'm exploring ACC module to gather data but I've hit a wall. I'm trying to create custom plugin to test out gathering different data from clients or adjust/transform the data coming in and populate them into different fields than out of the box configuration.

I created check type, check instance, check definition, policy and plugin where I uploaded the plugin directory signed with certificate. It runs as I see logs from my check type but I'm getting 2 errors. 

 

1.

OSQUERY-I-OK CI found *redacted pc name* content: "error getting assets for check: couldn't verify asset (skipped fetching certificates and retrying): could not verify file C:\\Users\\SERVIC~1\\AppData\\Local\\Temp\\sensu-asset3473500859\\OSQueryGeneric.tar.gz with input certificates"

 

2.

OSQUERY-I-OK Custom OSQuery result recieved: {"command":"C:\\ProgramData\\ServiceNow\\agent-client-collector\\cache\\osquery\\bin\\osqueryi --logger_min_status 1 --json \"{{.labels.params_query}}\"","name":"policy: OSQuery generic policy, check: Generic OSQuery check","interval":120,"timeout":60,"output":"error getting assets for check: couldn't verify asset (skipped fetching certificates and retrying): could not verify file C:\\Users\\SERVIC~1\\AppData\\Local\\Temp\\sensu-asset3473500859\\OSQueryGeneric.tar.gz with input certificates","status":"3","check_instance_id":"47fb3f0983d58b106b4c9ec0deaad3fa","check_type_id":"2e78193f3be48b10d17b030c95e45a1c","params_background":"false","is_silenced":false,"disable_token_replacement":"false","exec_mode":"execv","ci_id":"bc2a50c982288b1c0c7e17a44f7a131d","params_last_updated":"2026-06-04 13:25:38","send_results":"event_severity_changes","params_query":"select * from os_version","send_protocol":"ecc_queue","error_code":"ACC-1500","check_definition_id":"6f0415f73be48b10d17b030c95e45abf"}

 

I have added the certificate to my own PC and the signed certificate to the plugin record. Any idea what I'm missing?

 

1 REPLY 1

Peter Szelegowi
Tera Contributor

Hi,

I rebuilt this in my lab (Brazil, ACC 7.1.3 on Windows) and got exactly your message. The part in brackets, "skipped fetching certificates and retrying", is only a side effect: once the agent has fetched certificates, it doesn't fetch them again for a while. The real reason is the text after the colon, "could not verify file with input certificates". The agent simply doesn't trust the certificate your plugin was signed with.

Installing the certificate on your own PC or attaching it to the plugin record doesn't help, because the signature is checked by the agent on the endpoint. The agent gets customer certificates from the MID Server, from the folder agent\static\cert\customer, so put your certificate there as a .zip. Attaching it as a second file to the plugin record actually makes it worse: in my lab that set the plugin to inactive, because only one attachment is allowed there.

With a self-signed certificate that alone was not enough in my test. The agent downloaded it to C:\ProgramData\ServiceNow\agent-client-collector\config\cert\customer but rejected it with "x509: certificate signed by unknown authority". Only after I also imported the certificate into the Trusted Root Certification Authorities of the local computer on the endpoint and restarted the agent service did the check run fine.

If it still fails after that, check the signature itself. The .sig has to be created over the inner <plugin>.tar.gz, and both files are then packed into an outer archive with the same name. A signature over the wrong file gives exactly the same error as an untrusted certificate. You can check it locally with openssl dgst -sha256 -verify and the public key of your certificate before you upload the plugin.

Kind regards,
Peter