Fix SSL certificate detection for Rocky Linux and static curl (#20695)
* Add Rocky Linux certificate path to SSL detection Rocky Linux provides CA certificates at /etc/ssl/certs/ca-bundle.crt via symlinks, but this path was not included in our certificate detection logic. This caused SSL verification failures during claiming on Rocky Linux systems. Added this path to the detect_ca_path() function to ensure Rocky Linux systems can properly find their CA certificates. * Fix static curl certificate detection on all Linux distributions The static curl binary is compiled to look for CA certificates at /opt/netdata/etc/ssl/certs/ca-certificates.crt, but different Linux distributions use different certificate bundle names: - Debian/Ubuntu: ca-certificates.crt - RHEL/Rocky/CentOS: ca-bundle.crt - Alpine: cert.pem (directly in /etc/ssl/) - OpenSUSE: ca-bundle.pem (directly in /etc/ssl/) This caused SSL verification failures on non-Debian systems. On Rocky Linux specifically, the test_certs() function would fail because curl couldn't find certificates, causing the installer to fall back to bundled certificates instead of using system certificates. Added ensure_static_curl_certificates() function that: 1. Finds the system's certificate bundle using the same paths as detect_ca_path() in the C code 2. Creates the certs directory only if a certificate is found (to avoid polluting the filesystem) 3. Creates a symlink to make it available where curl expects it The function is called from select_system_certs() to ensure the symlink exists before test_certs() runs, fixing the issue where Rocky Linux users would incorrectly end up with bundled certificates. * Fix issues with implementation, and simplify code overall. - Prioritize our static build certificate path in agent code for TLS configuration. This ensures that the certificates used by the agent always match those used by the standalone copy of cURL shipped as part of the static build (which is important for debugging, among other things). - Use a relative symlink instead of an absolute symlink for the certificate link. In general, relative symlinks should always be preferred in situations like this where the actual intent of the symlink is to provide an alias for a file name in the same or almost the same directory, as it makes the link behave more consistently. - Don’t check for the existence of `/opt/netdata/etc/ssl/certs` before creating it. `mkdir -p` is idempotent and returns success whether it needed to create the directory or not, so it’s kind of pointless for us to check for it ourselves. - Only handle the cases of distros that do not already have a `certs/ca-certificates.crt` path within their SSL/TLS config directory. We should not be messing with our own certificate path (since it already gets handled elsewhere) or with an existing `certs/ca-certificates.crt` path (since we obviously do not need a symlink in that case anyway). - More liberaly use variables to avoid duplication and reduce the possibility of paths being out of sync within the function. - Remove trailing spaces on empty lines. * Fixes based on Copilot review. * fix rel symlink creation * apply formatting --------- Co-authored-by: Austin S. Hemmelgarn <austin@netdata.cloud> Co-authored-by: ilyam8 <ilya@netdata.cloud>