소스 검색

Roundcube driver fix for self-signed SSL (Ubuntu 16.10)

dpeca 9 년 전
부모
커밋
c8f63642b0
1개의 변경된 파일10개의 추가작업 그리고 1개의 파일을 삭제
  1. 10 1
      install/ubuntu/16.10/roundcube/vesta.php

+ 10 - 1
install/ubuntu/16.10/roundcube/vesta.php

@@ -40,7 +40,16 @@
         $send .= PHP_EOL;
         $send .= PHP_EOL;
         $send .= $postdata . PHP_EOL . 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_peer_name', 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);
         fputs($fp, $send);
         $result = fread($fp, 2048);
         $result = fread($fp, 2048);
         fclose($fp);
         fclose($fp);