Skip to content

[Security] Add caddy server configuration for Client Authentication (X509) #18151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,32 @@ and to expose the certificate's DN to the Symfony application:
# pass the DN to the application
SSLOptions +StdEnvVars

.. code-block:: caddy

tls {
client_auth {
mode verify_if_given # Please refer to the Caddy documentation for more information
trusted_ca_cert_file /path/to/my-custom-CA.pem
}
}

route {
# Other configuration options go here

php_fastcgi unix//var/run/php/php-fpm.sock {
env SSL_CLIENT_S_DN {tls_client_subject}

# Environment variables for other certificate fields that you might need.
# They are not used by Symfony, but you can use them in your application.
# All placeholders can be found at https://caddyserver.com/docs/caddyfile/concepts#placeholders
env SSL_CLIENT_S_FINGERPRINT {tls_client_fingerprint}
env SSL_CLIENT_S_CERTIFICATE {tls_client_certificate_der_base64}
env SSL_CLIENT_S_ISSUER {tls_client_issuer}
env SSL_CLIENT_S_SERIAL {tls_client_serial}
env SSL_CLIENT_S_VERSION {tls_version}
}
}

Then, enable the X.509 authenticator using ``x509`` on your firewall:

.. configuration-block::
Expand Down