Skip to content

Commit c8f6364

Browse files
authored
Roundcube driver fix for self-signed SSL (Ubuntu 16.10)
1 parent 3a2cfa2 commit c8f6364

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

install/ubuntu/16.10/roundcube/vesta.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,16 @@ function password_save($curpass, $passwd)
4040
$send .= PHP_EOL;
4141
$send .= $postdata . PHP_EOL . PHP_EOL;
4242

43-
$fp = fsockopen('ssl://' . $vesta_host, $vesta_port);
43+
//$fp = fsockopen('ssl://' . $vesta_host, $vesta_port);
44+
$errno = "";
45+
$errstr = "";
46+
$context = stream_context_create();
47+
$result = stream_context_set_option($context, 'ssl', 'verify_peer', false);
48+
$result = stream_context_set_option($context, 'ssl', 'verify_peer_name', false);
49+
$result = stream_context_set_option($context, 'ssl', 'verify_host', false);
50+
$result = stream_context_set_option($context, 'ssl', 'allow_self_signed', true);
51+
52+
$fp = stream_socket_client('ssl://' . $vesta_host . ':'.$vesta_port, $errno, $errstr, 60, STREAM_CLIENT_CONNECT, $context);
4453
fputs($fp, $send);
4554
$result = fread($fp, 2048);
4655
fclose($fp);

0 commit comments

Comments
 (0)