Red Hat Training

A Red Hat training course is available for OpenShift Container Platform

8.2. ユーザーエージェントの設定

OpenShift Container Platform 管理者として、マスター設定の userAgentMatching 設定を使用してクライアントが API にアクセスできないようにすることができます。

手順

  • マスター設定ファイルを、ユーザーエージェント設定を組み込むように変更します。たとえば、以下のユーザーエージェントは Kubernetes 1.2 クライアントバイナリー、OKD 1.1.3 バイナリー、および POST および PUT httpVerbs を拒否します。

    policyConfig:
      userAgentMatchingConfig:
        defaultRejectionMessage: "Your client is too old.  Go to https://example.org to update it."
        deniedClients:
        - regex: '\w+/v(?:(?:1\.1\.1)|(?:1\.0\.1)) \(.+/.+\) openshift/\w{7}'
        - regex: '\w+/v(?:1\.1\.3) \(.+/.+\) openshift/\w{7}'
          httpVerbs:
          - POST
          - PUT
        - regex: '\w+/v1\.2\.0 \(.+/.+\) kubernetes/\w{7}'
          httpVerbs:
          - POST
          - PUT
        requiredClients: null

    以下の例は、予想されるクライアントに一致しないクライアントを拒否します。

    policyConfig:
      userAgentMatchingConfig:
        defaultRejectionMessage: "Your client is too old.  Go to https://example.org to update it."
        deniedClients: []
        requiredClients:
        - regex: '\w+/v1\.1\.3 \(.+/.+\) openshift/\w{7}'
        - regex: '\w+/v1\.2\.0 \(.+/.+\) kubernetes/\w{7}'
          httpVerbs:
          - POST
          - PUT