A script reports "unable to get local issuer certificate"
What this certificate error means for a command or PHP script run from a customer's SSH or terminal session.
A customer runs a PHP script, curl or another command from their SSH session or the web terminal, and it fails to connect to an HTTPS or mail server with a message such as Certificate failure for mail.example.com: unable to get local issuer certificate, naming a well-known certificate authority. The same connection works from the website itself.
What it means
Every account's SSH and terminal session runs in its own restricted environment. That environment needs a read-only copy of the server's list of trusted certificate authorities, or it cannot tell that a certificate is genuine. Older versions left that list out.
Steps
- Upgrade the server. The update repairs every account's environment automatically:
To repair it right now without a full upgrade:sudo jsopctl upgradesudo jsopctl jail heal - Ask the customer to open a new session and run
ls /etc/ssl/certs | head. It should list certificate files. - Run their script again.
Tip: if the list is present and the error remains, the other server's certificate really is a problem: expired, self-signed, or missing its intermediate certificate. Check it with a browser or an online certificate checker.