laravel / reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.
https://reverb.laravel.com
MIT License
1.11k stars 90 forks source link

[1.x] Fix the issue for connecting if the SSL is not verified peer #85

Closed michaelnabil230 closed 7 months ago

michaelnabil230 commented 7 months ago

See: https://github.com/laravel/reverb/issues/78

vatsake commented 7 months ago

If the certificate does not need local_pk, then it won't load local_cert at the moment.

I think part of the tls content should be commented out.

joedixon commented 7 months ago

I want to sit on this one a little while as I'm not convinced it's needed.

mateusztumatek commented 7 months ago

This fixed my problem during local development with Laravel Valet. Thanks :)

benbjurstrom commented 7 months ago

I want to sit on this one a little while as I'm not convinced it's needed.

I wouldn't sit on this. I've had nothing but trouble trying to get reverb working locally on MacOS with Herd secured sites. The most frustrating part is it will work one day and be broken the next.

The changes to the Factory.php with this config entry resolves my problems:

            'options' => [
                'tls' => [
                    'verify_peer' => false,
                ],
            ],

I would suggest adding verify_peer as it's own env variable.

lsdevelop commented 7 months ago

Really, the problem has solved, please @joedixon merge this, If you want, I can make another more detailed PR.

joedixon commented 7 months ago

Pushed some updates here which will resolve #93, #105 and possibly #106.

I opted not to include config by default for all of the SSL context options, but instead allow users to configure it manually.

Now, the check for Valet and Herd certificates will only be carried out if both local_cert and local_pk are not set. This means the other SSL options such as verify_peer, allow_self_signed, etc may still be used with Valet and Herd certificates.

Additionally, null values are removed from the TLS options array to allow environment variables to be used to control whether or not TLS is enabled.

lsdevelop commented 7 months ago

Empurrei algumas atualizações aqui que resolverão #93 , #105 e possivelmente #106 .

Optei por não incluir a configuração por padrão para todas as opções de contexto SSL, mas em vez disso permitir que os usuários a configurem manualmente.

Agora, a verificação dos certificados de Valet e Rebanho só será realizada se ambos local_certe local_pknão estiverem configurados. Isso significa que as outras opções de SSL, como verify_peer, allow_self_signed, etc, ainda podem ser usadas com certificados Valet e Herd.

Além disso, nullos valores são removidos da matriz de opções TLS para permitir que variáveis ​​de ambiente sejam usadas para controlar se o TLS está habilitado ou não.

This update broken forge applications running with ssl

joedixon commented 7 months ago

Hi @lsdevelop, can you elaborate on what was broken? Are you running your Reverb server directly from the main branch?

lsdevelop commented 7 months ago

Hi @lsdevelop, can you elaborate on what was broken? Are you running your Reverb server directly from the main branch?

Hi, yeah,

I have a chat app with deprecated websockets, after launching reverb, I up stating environment in forge for testing using @beta of reverb,

After merge this commit in next deployment the connection has return error for tls.

Solved after downgrade for beta4, I'm trying again now.

joedixon commented 7 months ago

@lsdevelop you would have only seen this update if you explicitly used dev-main or @develop. This PR has not been released yet and beta4 is still currently the latest release.

Can you confirm the steps you took and verify the error you saw?