curl: Fallback to using Certificate Authority from Windows Certificate Store
Nessuno ha ancora preso questa issue.
- Lingua principale
- C
- Stelle
- 40.4k
- Fork
- 8.1k
- Merge medio
- 2g 13h
- PR unite (30g)
- 96
Descrizione
Description
In PHP's current implementation, there is an inconsistency in how the language handles SSL/TLS certificate validation across different operating systems. This inconsistency primarily affects Windows users.
In this proof-of-concept, we can see the behavior clearly:
On Windows, the script does two requests:
- The first request without a CA file that fails and prints
Request correctly failed without CA certificate (expected on Windows) - A second request using the CA file from Mozilla that succeeds and prints
Request succeeded with provided CA certificate
On Linux and Mac, it uses the O.S CA file, which prints Request succeeded without CA certificate (expected on Linux and macOS)
On Linux, it uses by default:
CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
On Mac, it uses:
CAPath: /usr/local/etc/openssl@3/certs
On Windows, both are blank:
CAfile: (empty)
CApath: (empty)
Which means that PHP doesn't have a fallback Certificate Authority file to validate HTTPS requests, which leads to issues such as these. The common solution for this problem for Windows users is to download a trusted CA file (such as from Mozilla), and update php.ini to use it:
- Download http://curl.haxx.se/ca/cacert.pem
- Point php.ini
openssl.cafileto the downloaded file
This is a sub-optimal solution as it increases complexity for the average John Doe that just wants to do a network request against a HTTPS URL.
I think PHP in Windows could fallback to accessing the Windows Certificate Store, or bundle a trusted CA file, although this might get outdated.
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Non sono indicati file del repository o test. Inizia esaminando il proof of concept di Windows collegato e l'attuale comportamento di PHP nella convalida dei certificati HTTPS, quindi definisci quale approccio di fallback è supportato; il lavoro è completato quando le richieste Windows convalidano i certificati attendibili senza richiedere un file CA configurato separatamente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- php
- Ambito
- security
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100