mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
IRC bot - allow to disable ssl check
In PHP 5.6.x stream wrappers verify peer certificates and host names by default when using SSL. That fix allows to turn off that verification with config option $config['irc_disable_ssl_check'] = true; It is useful when you want to use self generated certificate for your own IRC server.
This commit is contained in:
10
irc.php
10
irc.php
@ -375,7 +375,15 @@ class ircbot {
|
||||
$server = $this->server;
|
||||
}
|
||||
|
||||
$this->socket['irc'] = fsockopen($server, $this->port);
|
||||
if ($this->ssl && $this->config['irc_disable_ssl_check']) {
|
||||
$ssl_context_params = array('ssl'=>array('allow_self_signed'=> true, 'verify_peer' => false, 'verify_peer_name' => false ));
|
||||
$ssl_context = stream_context_create($context_params);
|
||||
$this->socket['irc'] = stream_socket_client($server.':'.$this->port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $ssl_context);
|
||||
}
|
||||
else {
|
||||
$this->socket['irc'] = fsockopen($server, $this->port);
|
||||
}
|
||||
|
||||
if (!is_resource($this->socket['irc'])) {
|
||||
return $this->connect($try + 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user