StarryShark / zabbix-promise

Simplified Zabbix API Client for JavaScript Node.js Runtime.
https://sumitgoelpw.github.io/zabbix-promise/
MIT License
39 stars 15 forks source link

Add support for custom options #10

Closed MadsRC closed 6 years ago

MadsRC commented 7 years ago

From reading the code, I can't really see if it's possible to parse options such as use a specific CA when validating a HTTPS request (I need to use this library to connect to a host signed by an internal ca)

From reading this: https://github.com/request/request#tlsssl-protocol it seems like it should be possible to add custom options using https.globalAgent.options however that doesn't seem to work.

Any idea?

MadsRC commented 7 years ago

I should add that I'm aware of the rejectUnauthorized:false option. However that is a no go for production usage.

StarryShark commented 7 years ago

@MadsRC thank you for the suggestion. I will look into the possibilities for the next release hopefully sometime this week. It should be doable. In the mean time, you may want to try ssl-root-cas.

StarryShark commented 7 years ago

@MadsRC I've added the ability to pass the request options as an object via the fourth parameter in the Zabbix class instantiation.

const Zabbix = require('zabbix-promise');

const zabbix = new Zabbix(
  'http://127.0.0.1:8080/api_jsonrpc.php',
  'Admin',
  'zabbix', {
    'agentOptions': {
      'securityOptions': 'SSL_OP_NO_SSLv3'
    }
  }
);

It is in the devel branch now; please give it a try and let me know if you encounter any issues. Soon it will be merged into the master branch.

StarryShark commented 7 years ago

Pull request #11