-
Notifications
You must be signed in to change notification settings - Fork 501
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
Support TLS Client Certificates #377
Comments
Needs 4 options:
Otherwise I can only use native |
We did some research @pronamic and this can perhaps be simplified to 3 options for now:
In the request arguments we could perhaps use the following naming convention:
For the cURL transport support for this can be added like this: /**
* Support TLS Client Certificates.
*
* @link https://core.trac.wordpress.org/ticket/34883#comment:3
* @link https://github.com/WordPress/Requests/issues/377
*/
\add_action(
'http_api_curl',
function ( $handle, $parsed_args, $url ) {
if ( \array_key_exists( 'ssl_certificate', $parsed_args ) ) {
\curl_setopt( $handle, \CURLOPT_SSLCERT, $parsed_args['ssl_certificate'] );
}
if ( \array_key_exists( 'ssl_private_key', $parsed_args ) ) {
\curl_setopt( $handle, \CURLOPT_SSLKEY, $parsed_args['ssl_private_key'] );
}
if ( \array_key_exists( 'ssl_private_key_password', $parsed_args ) ) {
\curl_setopt( $handle, \CURLOPT_SSLKEYPASSWD, $parsed_args['ssl_private_key_password'] );
}
},
10,
3
); It looks like there are currently no hooks available for the streams transport context: Requests/src/Transport/Fsockopen.php Lines 106 to 172 in 31ba95a
|
Per the suggestion in https://core.trac.wordpress.org/ticket/34883#comment:3, I'm opening this issue so that WP's
wp_remote_request()
, etc can more easily use client certs.And while not mentioned in the Trac ticket, there is also need to set
CURLOPT_SSLKEY
.The text was updated successfully, but these errors were encountered: