From 66469a1339a3d3742d947ceceea8e7f202a283c3 Mon Sep 17 00:00:00 2001 From: GOBERT Mathieu Date: Tue, 31 Mar 2015 13:24:24 +0200 Subject: [PATCH] add rejectUnauthorized in options --- docs/configuration.md | 5 ++++- lib/winston-logstash.js | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/configuration.md b/docs/configuration.md index b33d4b9..dc09206 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -25,6 +25,9 @@ * Passphrase for the SSL key. * Only needed if the certificate has a passphrase. * No default +* `rejectUnauthorized` + * If true the server will reject any connection which is not authorized with the list of supplied CAs. + * Default true * `strip_colors` * Strip colors from messages and metadata - * Default: `false` \ No newline at end of file + * Default: `false` diff --git a/lib/winston-logstash.js b/lib/winston-logstash.js index 99afa40..2eeabef 100644 --- a/lib/winston-logstash.js +++ b/lib/winston-logstash.js @@ -38,6 +38,7 @@ var Logstash = exports.Logstash = function (options) { this.ssl_cert = options.ssl_cert || ''; this.ca = options.ca || ''; this.ssl_passphrase = options.ssl_passphrase || ''; + this.rejectUnauthorized = options.rejectUnauthorized === true; // Connection state this.log_queue = []; @@ -133,6 +134,7 @@ Logstash.prototype.connect = function () { key: this.ssl_key ? fs.readFileSync(this.ssl_key) : null, cert: this.ssl_cert ? fs.readFileSync(this.ssl_cert) : null, passphrase: this.ssl_passphrase ? this.ssl_passphrase : null, + rejectUnauthorized: this.rejectUnauthorized === true, ca: this.ca ? (function (caList) { var caFilesList = [];