ゾーンレベル
ゾーンの認証されたオリジンプルを有効にすると、ゾーンへのすべてのプロキシトラフィックはオリジンのウェブサーバーで認証されます。
ゾーンがフル以上のSSL/TLS暗号化モードを使用していることを確認してください。
まず、オリジンに証明書をアップロードします。
Cloudflareの証明書(特定のCAを使用)を使用するには、PEMファイルをダウンロードし、それをオリジンにアップロードします。この証明書はCloudflareのオリジンCA証明書とは異なり、ダッシュボードには表示されません。
カスタム証明書を使用するには、APIの指示に従ってCloudflareにカスタム証明書をアップロードしますが、origin_tls_client_authエンドポイントを使用します。その後、証明書をオリジンにアップロードします。
With the certificate installed, set up your origin web server to accept client certificates.
Check the examples below for Apache and NGINX or refer to your origin web server documentation - e.g. HAProxy ↗, Traefik ↗, Caddy ↗.
Apache example
SSLVerifyDepth 1SSLCACertificateFile /path/to/origin-pull-ca.pemFor this example, you would have saved your certificate to /path/to/origin-pull-ca.pem.
NGINX example
ssl_verify_client optional;ssl_client_certificate /etc/nginx/certs/cloudflare.crt;For this example, you would have saved your certificate to /etc/nginx/certs/cloudflare.crt.
At this point, you may also want to enable logging on your origin so that you can verify the configuration is working.
Then, enable the Authenticated Origin Pulls feature as an option for your Cloudflare zone.
This step sets the TLS Client Auth to require Cloudflare to use a client certificate when connecting to your origin server.
To enable Authenticated Origin Pulls in the dashboard:
- Log in to your Cloudflare account ↗ and go to a specific domain.
- Go to SSL/TLS > Origin Server.
- For Authenticated Origin Pulls, switch the toggle to On.
To enable or disable Authenticated Origin Pulls with the API, send a PATCH request with tls_client_auth as the setting name in the URI path, and the value parameter set to your desired setting ("on" or "off").
Cloudflare APIを使用して、ゾーンレベルの認証されたオリジンプルを有効にするためにPUTリクエストを送信します。
ステップ2でオリジンにロギングを設定していた場合は、認証されたオリジンプルが機能していることをテストして確認してください。
Once you can confirm everything is working as expected for your specific origin setup, configure your origin to enforce the authentication.
Apache example
SSLVerifyClient requireNGINX example
ssl_verify_client on;After completing the process, you can use curl to send requests directly to your origin IPs, verifying that the requests fail due to certificate validation being enforced.
AOP証明書が期限切れになる前に通知を受け取るためのアラートを構成できます。
Refer to Cloudflare Notifications for more information on how to set up an alert.