Could not find key file error message within Assets Discovery
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
When running Assets Discovery tool as a Service, Linux hosts cannot be scanned. There will be a "No working credential for" along with "Could not find key file:"
The following appears in the discovery logs:
15/01/2022 15:01:00 : Start Scan Thread: 00008 IP: 10.0.0.1 TaskID: 0000019676
15/01/2022 15:01:00 : Start getting HostInfo.
15/01/2022 15:01:00 : Start Scan: 10.0.0.1
15/01/2022 15:01:00 : Ping 10.0.0.1 --> Success ResponseTime=0ms TTL=61
15/01/2022 15:01:00 : We have 1 credentials in total.
15/01/2022 15:01:00 : We have 1 credential(s) configured for all Scan-Settings.
15/01/2022 15:01:00 : We have 1 possible credetentials for the ip 10.0.0.1
15/01/2022 15:01:00 : Initiate SSH-Provider with credential: c8657604-b912-4032-a3bd-c77d1e763ffb
15/01/2022 15:01:00 : Start SSH-Connection (c8657604-b912-4032-a3bd-c77d1e763ffb) to 10.0.0.1
15/01/2022 15:01:00 : Could not find key file: xxxxx/xxxxx.key
15/01/2022 15:01:00 : Finish SSH-Connection (c8657604-b912-4032-a3bd-c77d1e763ffb) to 10.0.0.1 - used 0.0029468 seconds - result: False
15/01/2022 15:01:00 : Total used scantime 0.0063116 seconds.
15/01/2022 15:01:00 : No working credential for 10.0.0.1
15/01/2022 15:01:00 : Try getting basic information for 10.0.0.1
Environment
- Discovery 2.28.1.0
- Discovery 2.29
- Discovery 3.1.1
Diagnosis
- Running the Scan setting manually, Discovery scans Linux host successfully
- When Discovery runs as a Service, Discovery uses the SYSTEM user
- SYSTEM user has permission on the directory itself and key file
- File used in Credentials section in Assets discovery uses a relative path
Cause
The error message 'Could not find key file: xxxxx/xxxxx.key' occurs when using a relative path instead of a full path.
Solution
- Open Discovery Tool
- Go to Credentials tab
- Add the full file path