prometheus / prometheus/client_python
Allow tls_auth_handler to support client side verification only
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 4.4k
- フォーク
- 876
- 平均マージ
- 8日 4時間
- マージ済み PR(30日)
- 1
説明
The tls_auth_handler supports setting up a mTLS connection with the Prometheus push gateway, but I want only to verify the certificate of the server. In other words, I wish to skip setting certfile and keyfile in the tls_auth_handler method when the protocol is not ssl.PROTOCOL_TLS_SERVER.
The authentication on the server side I will handle differently.
I'd be willing to contribute. Should I add it as a conditional to the current tls_auth_handler method (think this will ), or should I create a new tls_handler method?
Add to current tls_auth_handler:
def tls_auth_handler(
url: str,
method: str,
timeout: Optional[float],
headers: List[Tuple[str, str]],
data: bytes,
certfile: str,
keyfile: str,
cafile: Optional[str] = None,
protocol: int = ssl.PROTOCOL_TLS_CLIENT,
insecure_skip_verify: bool = False,
) -> Callable[[], None]:
"""Handler that implements an HTTPS connection with TLS Auth.
The default protocol (ssl.PROTOCOL_TLS_CLIENT) will also enable
ssl.CERT_REQUIRED and SSLContext.check_hostname by default. This can be
disabled by setting insecure_skip_verify to True.
Both this handler and the TLS feature on pushgateay are experimental."""
context = ssl.SSLContext(protocol=protocol)
if cafile is not None:
context.load_verify_locations(cafile)
else:
context.load_default_certs()
if insecure_skip_verify:
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
if protocol == ssl.PROTOCOL_TLS_SERVER:
context.load_cert_chain(certfile=certfile, keyfile=keyfile)
handler = HTTPSHandler(context=context)
return _make_handler(url, method, timeout, headers, data, handler)
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
tls_auth_handler エントリポイントから開始し、その SSLContext がどのように構成されているかを、HTTPSHandler の構築を含めて確認してください。クライアント専用の検証がクライアント証明書ファイルを必要とせずに機能するようにしつつ、サーバープロトコルで使用するための証明書チェーンの読み込みは維持してください。handler が引き続き、指定されている検証モードと非セキュアモードをサポートしていることを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- networking, security
- issue の種類
- 機能追加
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100