MeWrite Docs

SSL: certificate problem - unable to get local issuer certificate

SSL証明書の検証に失敗した際のエラー原因と解決策

概要

SSL/TLS接続時に証明書チェーンの検証に失敗するエラーです。

エラーメッセージ

SSL certificate problem: unable to get local issuer certificate

原因

  1. CA証明書の欠落: ルートCA証明書がシステムにない
  2. 中間証明書の欠落: サーバー設定で中間証明書が不足
  3. 自己署名証明書: 信頼されていない証明書
  4. システム時刻のずれ: 証明書の有効期間外と判定

解決策

1. CA証明書を更新

1
2
3
4
5
6
7
8
9
# Ubuntu/Debian
sudo apt-get update && sudo apt-get install ca-certificates
sudo update-ca-certificates

# CentOS/RHEL
sudo yum update ca-certificates

# macOS
brew install ca-certificates

2. curlでCA証明書を指定

1
2
3
4
5
# CA証明書を指定
curl --cacert /path/to/ca-bundle.crt https://example.com

# 環境変数で指定
export CURL_CA_BUNDLE=/path/to/ca-bundle.crt

3. Node.jsでの対応

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
// 環境変数でCA証明書を追加
process.env.NODE_EXTRA_CA_CERTS = '/path/to/ca.crt';

// または axios での設定
const https = require('https');
const axios = require('axios');

const agent = new https.Agent({
  ca: fs.readFileSync('/path/to/ca.crt')
});

axios.get('https://example.com', { httpsAgent: agent });

4. Pythonでの対応

1
2
3
4
5
6
7
8
import requests

# CA証明書を指定
response = requests.get('https://example.com', verify='/path/to/ca-bundle.crt')

# certifi を使用
import certifi
response = requests.get('https://example.com', verify=certifi.where())

5. Gitでの対応

1
2
3
4
5
# CA証明書を設定
git config --global http.sslCAInfo /path/to/ca-bundle.crt

# 一時的に検証を無効化(非推奨)
git -c http.sslVerify=false clone https://example.com/repo.git

よくある間違い

  • sslVerify=false で根本解決を避ける
  • 自己署名証明書を本番で使用
  • 証明書チェーンの順序が不正

関連エラー

関連エラー

Security の他のエラー

最終更新: 2025-12-10