From ad05c575d24651edde7aab5ec7291cd16844550a Mon Sep 17 00:00:00 2001 From: dpeca Date: Mon, 24 Oct 2016 22:05:02 +0200 Subject: [PATCH] Allow Vesta Roundcube driver to comunicate with server even there is self signed SSL cert. Previously fsockopen failed to connect on self-signed SSL cert. Code ported from Debian Vesta Roundcube driver. --- install/rhel/7/roundcube/vesta.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/install/rhel/7/roundcube/vesta.php b/install/rhel/7/roundcube/vesta.php index b8695bd1..4a8783e6 100644 --- a/install/rhel/7/roundcube/vesta.php +++ b/install/rhel/7/roundcube/vesta.php @@ -42,7 +42,17 @@ class rcube_vesta_password $send .= PHP_EOL; $send .= $postdata . PHP_EOL . PHP_EOL; - $fp = fsockopen('ssl://' . $vesta_host, $vesta_port); + //$fp = fsockopen('ssl://' . $vesta_host, $vesta_port); + $errno = ""; + $errstr = ""; + $context = stream_context_create(); + + $result = stream_context_set_option($context, 'ssl', 'verify_peer', false); + $result = stream_context_set_option($context, 'ssl', 'verify_host', false); + $result = stream_context_set_option($context, 'ssl', 'allow_self_signed', true); + + $fp = stream_socket_client('ssl://' . $vesta_host . ':'.$vesta_port, $errno, $errstr, 60, STREAM_CLIENT_CONNECT, $context); + fputs($fp, $send); $result = fread($fp, 2048); fclose($fp);