LoginSignup
1
1

More than 3 years have passed since last update.

Python の通信を Fiddler で見る

Posted at

az コマンドの通信を HTTPS デコードして Fiddler で見たかったけど Python は Windows の証明書ストアを見ないらしく、Fiddler のルート証明書を信頼できずに証明書エラーが発生した。

Please ensure you have network connection. Error detail: 
HTTPSConnectionPool(host='login.microsoftonline.com', port=443): Max retries exceeded with url: /common/oauth2/token (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

解決策

Fiddler の Root 証明書を環境変数 CURL_CA_BUNDLE にセットする。

$env:CURL_CA_BUNDLE = "C:\Path\To\FiddlerRoot.cer"

なお、ルート証明書は Base64 エンコードである必要がある。
証明書ストアから、Base64 でエクスポートするのが楽。

image.png

あとは環境変数に Fiddler のプロキシをセット

$env:http_proxy = "http://127.0.0.1:8888"
$env:https_proxy = $env:http_proxy

これで Fiddler で通信トレースを取れる。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1