WildPHP / irc-bot

A simple and modular PHP IRC bot
MIT License
84 stars 24 forks source link

Cannot use self signed certificate #161

Closed ivptr closed 3 years ago

ivptr commented 3 years ago

For self signed certificate per https://github.com/reactphp/socket#connector added to config.php:

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

but still seeing:

wildphp.ERROR: An error occurred in the IRC connection: {"message":"Connection to 127.0.0.1:6697 failed during TLS handshake: Unable to complete TLS handshake: SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed","file":"vendor\\react\\socket\\src\\SecureConnector.php","line":63} []
NanoSector commented 3 years ago

Sounds like the handoff of options from the configuration file to the connector isn't working as it should, although your error message would suggest the bot is catching an error from the socket library.

Just to be sure, are you using the tls:// scheme for your address? If I'm reading the documentation correctly these options only work on the tls:// and tcp:// schemes.

ivptr commented 3 years ago

Using the following config:

'server' => '127.0.0.1',
'port' => 6697,
'secure' => true,

Tried with 'server' => 'tls://127.0.0.1', it's the same.

In SecureConnector.php noticed that in constructor $this->context is fine, but in connect() $this->context is empty for some reason.