Skip to content
This repository was archived by the owner on Jan 25, 2022. It is now read-only.

Don't verify TLS [DEVOPS-627] #1

Open
wants to merge 1 commit into
base: mab
Choose a base branch
from
Open
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
10 changes: 9 additions & 1 deletion library.c
Original file line number Diff line number Diff line change
Expand Up @@ -1875,10 +1875,18 @@ PHP_REDIS_API int redis_sock_connect(RedisSock *redis_sock)
tv_ptr = &tv;
}

php_stream_context *context = php_stream_context_alloc();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we would pass in the context to \Redis, but in for our case explicitly creating a context should be good enough.

We also don't want to modify global PHP context for obvious reasons.


zval verify_peer_zval;
ZVAL_BOOL(&verify_peer_zval, 0);

php_stream_context_set_option(context, "ssl", "verify_peer", &verify_peer_zval);
php_stream_context_set_option(context, "ssl", "verify_peer_name", &verify_peer_zval);

redis_sock->stream = php_stream_xport_create(host, host_len,
0, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
persistent_id ? ZSTR_VAL(persistent_id) : NULL,
tv_ptr, NULL, &estr, &err);
tv_ptr, context, &estr, &err);

if (persistent_id) {
zend_string_release(persistent_id);
Expand Down