Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configurable ca path #25

Closed
sanyatuning opened this issue Apr 8, 2016 · 2 comments
Closed

configurable ca path #25

sanyatuning opened this issue Apr 8, 2016 · 2 comments

Comments

@sanyatuning
Copy link

pls create an optin to set ssl capath option
see http://php.net/manual/en/context.ssl.php

somethinng like this

        // do request
        $streamContext = stream_context_create(array(
            'http' => array(
                'method'  => 'POST',
                'header'  => 'Content-type: application/json-rpc'."\r\n".$this->extraHeaders,
                'content' => $this->requestEncoded
            ),
            'ssl' => array(
                'verify_peer'       => $this->verifyPeer,
                'verify_peer_name'  => $this->verifyPeer,
                'capath'            => $this->caPath,
            )
        ));

@domibarton
Copy link
Member

domibarton commented May 4, 2016

You can now easily overwrite the SSL context in the constructor or via setSslContext() method. For example:

$context = array(
    'capath' => '/my/ca/path'
);

$api = new ZabbixApi('http://zabbix.confirm.ch/api_jsonrpc.php', 'zabbix_user', 'zabbix_password', '', '', '', $context);

IMPORTANT (PLEASE READ): This change replaced the old $verifyPeer boolean and setVerifyPeer() method, which means the old code might be incompatible with the new API. If you want to skip SSL verification make sure you update the code to something like:

$context = array(
    'verify_peer' => FALSE,
    'verify_peer_name' => FALSE
);

$api = new ZabbixApi('http://zabbix.confirm.ch/api_jsonrpc.php', 'zabbix_user', 'zabbix_password', '', '', '', $context);

@domibarton
Copy link
Member

@sanyatuning feel free to use v2.2.4 or v2.4.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants