Discovery Scan - PostgreSQL Fails when Cert Validation is enabled, Certificate validation error
Symptom
Discovery scans PostgreSQ failed with with Cert Validation, this fails with Plugin result: {"errorMessage": "Scan validation failed", "scanErrors": {"Certificate validation error": {"xxx": ["Initializing connection with pyodbc failed for target xxx.amazonaws.com with certificate exception."]}}
Machine log as this error message:
WARNING - The ODBC encountered issues with the certificate, error: ('08001', '[08001] connection to server at "xxx" (xxx.xxx.xxx.xxx), port 5432 failed: root certificate file "C:\\Windows\\ServiceProfiles\\CyberArkManagementAgent\\AppData\\Roaming/postgresql/root.crt" does not exist\nEither provide the file, use the system\'s trusted roots with sslrootcert=system, or change sslmode to disable server certificate verification.\n (101) (SQLDriverConnect)'). Please make sure the target has a certificate set up correctly and that the machine which the scan runs from recognizes and trusts the Certificate Authority (CA).
Environment
Privilege Cloud Discovery (New) Discovery (New) Discovery Scans
Cause
cert in the wrong path
Resolution
First, make sure the cert has been added to both DB and the Connector Management Agent Host Server and in the folder indicated in the log.
Test using following:
Log into the Idira connector machine.
Press the Windows Key, type ODBC Data Sources (64-bit), and run it as an Administrator.
Navigate to the User DSN tab.
Click Add... on the right side.
Select PostgreSQL ANSI(x64) from the list and click Finish.
A configuration window for the PostgreSQL driver will appear. Fill in the connection details for your target- Database: postgres, Server: "xxx", Port: 5432, Username: "<scan account used>" and Password used for the scan.
Locate the SSL Mode dropdown and change it to verify-full.
Click on Test
This should fail with the error that the certificate needs to be in a certain Path (should be a different path than requested in the error in the scan's logs)
Copy the certificate to the path in the error message and test again. Make sure file extension end with .cer