如何修复stream_socket_enable_crypto():ssl:握手时机

发布于 2025-01-29 02:39:32 字数 1922 浏览 4 评论 0原文

我们面临着将Azure应用程序上的Laravel应用程序连接到端口6380上的Azure Redis Cache实例的问题。我们在下面遇到错误。

ErrorException in StreamConnection.php line 246:
stream_socket_enable_crypto(): SSL: Handshake timed out
in StreamConnection.php line 246
at HandleExceptions->handleError('2', 'stream_socket_enable_crypto(): SSL: Handshake timed out', '/var/www/vendor/predis/predis/src/Connection/StreamConnection.php', '246', array('parameters' => object(Parameters), 'resource' => resource, 'metadata' => array('timed_out' => false, 'blocked' => true, 'eof' => false, 'stream_type' => 'tcp_socket/ssl', 'mode' => 'r+', 'unread_bytes' => '0', 'seekable' => false), 'options' => array('crypto_type' => '9')))
at stream_socket_enable_crypto(resource, true, '9') in StreamConnection.php line 246

数据库配置文件中的REDIS块看起来像这样:

'redis' => [
        'client' => 'predis',
        'cluster' => false,

        'default' => [
            'scheme' => 'tls',
            'host' => env('REDIS_HOST', 'localhost'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => 0,
            'read_write_timeout' => 0,
            // 'ssl' => [
            //     'verify_peer' => false,
            //     'verify_peer_name' => false,
            //     'allow_self_signed' => true
            // ]
            'context' => [
                // 'auth' => ['username', 'secret'],
                'stream' => [
                    'verify_peer' => true,
                    'verify_peer_name' => false,
                    'allow_self_signed' => true
                    ],
            ],
        ],
        'options' => [
            'parameters' => ['password' => env('REDIS_PASSWORD', null)],
        ],

    ],

我期待有关如何解决此问题的指示/提示。提前致谢。

We are facing an issue with connecting a Laravel app on Azure App Service to an Azure Redis Cache instance on port 6380. We keep getting the error below.

ErrorException in StreamConnection.php line 246:
stream_socket_enable_crypto(): SSL: Handshake timed out
in StreamConnection.php line 246
at HandleExceptions->handleError('2', 'stream_socket_enable_crypto(): SSL: Handshake timed out', '/var/www/vendor/predis/predis/src/Connection/StreamConnection.php', '246', array('parameters' => object(Parameters), 'resource' => resource, 'metadata' => array('timed_out' => false, 'blocked' => true, 'eof' => false, 'stream_type' => 'tcp_socket/ssl', 'mode' => 'r+', 'unread_bytes' => '0', 'seekable' => false), 'options' => array('crypto_type' => '9')))
at stream_socket_enable_crypto(resource, true, '9') in StreamConnection.php line 246

The Redis block of code in the database config file looks like this:

'redis' => [
        'client' => 'predis',
        'cluster' => false,

        'default' => [
            'scheme' => 'tls',
            'host' => env('REDIS_HOST', 'localhost'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', 6379),
            'database' => 0,
            'read_write_timeout' => 0,
            // 'ssl' => [
            //     'verify_peer' => false,
            //     'verify_peer_name' => false,
            //     'allow_self_signed' => true
            // ]
            'context' => [
                // 'auth' => ['username', 'secret'],
                'stream' => [
                    'verify_peer' => true,
                    'verify_peer_name' => false,
                    'allow_self_signed' => true
                    ],
            ],
        ],
        'options' => [
            'parameters' => ['password' => env('REDIS_PASSWORD', null)],
        ],

    ],

I am looking forward to pointers/tips on how to solve this issue. Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

彡翼 2025-02-05 02:39:32

此问题是由于方案类型的“ TLS”而发生的。
只需删除方案类型“ TLS”,它就会开始工作。

注意:此解决方案仅适用于本地设置。禁用SSL验证具有安全含义。在不验证SSL/HTTPS连接的真实性的情况下,任何恶意攻击者都可以模仿可信赖的终点,您将容易受到中间攻击的攻击。

This issue occurs due to scheme type 'tls'.
Just remove scheme type 'tls' it will start working.

Note: This solution is for local setup only. Disabling SSL verification has security implications. Without verifying the authenticity of SSL/HTTPS connections, any malicious attacker can impersonate a trusted endpoint, and you'll be vulnerable to a Man-in-the-Middle Attack.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文