Fehlende Zertifikate im CA-Trust-Store beim Webhosting (SSL-Zertifikatsprüfung schlägt fehl (cURL, ect.))

  • Moin,

    ich habe ein Problem analog zu diesem Thema: SSL-Zertifikatsprüfung schlägt fehl (file_get_contents / cURL) – fehlt cacert.pem bei Webhosting?

    Code
    /etc/ssl/certs$ curl https://www.rwth-aachen.de
    
    curl: (60) SSL certificate problem: unable to get local issuer certificate
    More details here: https://curl.se/docs/sslcerts.html
    
    curl failed to verify the legitimacy of the server and therefore could not
    establish a secure connection to it. To learn more about this situation and
    how to fix it, please visit the web page mentioned above.

    Das Problem liegt abweichend aber darin, dass das Wurzelzertifikat (GEANT / HARICA Root CA 2021) bei meinem shared-hosting Server noch nicht im systemweiten CA-Trust-Store enthalten ist.

    Als Workaround wird mir seitens des netcup Supports folgendes vorgeschlagen:

    Code
    curl_setopt($ch, CURLOPT_CAINFO, __DIR__ . '/harica-root-2021.pem');

    Damit bin ich aber wirklich nicht allzu happy und frage daher, ob jemand für shared-hosting bessere Alternativen kennt (per .htaccess; php_ini, globale-Konfig,...)?
    Ich müsste für den Vorschlag in fremden Paketen den Code ändern und beim nächsten Update wird das wieder überschrieben.

    Viele Grüße
    Christian

  • Habe es jetzt selbst gelöst.

    Im Verzeichnis der Homepage eine .user.ini anlegen mit folgendem Inhalt:

    Code
    curl.cainfo="/var/www/vhosts/hostingABCDEFG.abcdef.netcup.net/httpdocs/cacert.pem"
    openssl.cafile="/var/www/vhosts/hostingABCDEFG.abcdef.netcup.net/httpdocs/cacert.pem"

    Wobei man sich eine aktuelle cacert.pem von vertrauenswürdiger Quelle ( https://curl.se/docs/caextract.html ) herunterlädt. Der Vorschlag vom Support akzeptiert nämlich nur noch das <harica-root-2021.pem. So wird der Netcup-Trust-Store durch die Datei ersetzt.