fix(node-vsphere-soap): better handling of self signed cert
This commit is contained in:
committed by
Julien Fontanet
parent
af562f3c3a
commit
d68f4215f1
@@ -13,11 +13,12 @@
|
||||
*/
|
||||
|
||||
const EventEmitter = require('events').EventEmitter
|
||||
const axios = require('axios')
|
||||
const https = require('node:https')
|
||||
const util = require('util')
|
||||
const soap = require('soap')
|
||||
const Cookie = require('soap-cookie') // required for session persistence
|
||||
const { SSL_OP_NO_TLSv1_2 } = require('crypto').constants
|
||||
|
||||
const constants = require('crypto').constants
|
||||
// Client class
|
||||
// inherits from EventEmitter
|
||||
// possible events: connect, error, ready
|
||||
@@ -35,11 +36,14 @@ function Client(vCenterHostname, username, password, sslVerify) {
|
||||
this.clientopts = {}
|
||||
} else {
|
||||
this.clientopts = {
|
||||
rejectUnauthorized: false,
|
||||
strictSSL: false,
|
||||
secureOptions: SSL_OP_NO_TLSv1_2, // likely needed for node >= 10.0
|
||||
} // recommended options by node-soap authors
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0' // need for self-signed certs
|
||||
request: axios.create({
|
||||
httpsAgent: new https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
|
||||
secureOptions: constants.SSL_OP_NO_TLSv1_2, // likely needed for node >= 10.0
|
||||
}),
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
this.connectionInfo = {
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
},
|
||||
"bugs": "https://github.com/vatesfr/xen-orchestra/issues",
|
||||
"dependencies": {
|
||||
"axios": "^1.4.0",
|
||||
"soap": "^1.0.0",
|
||||
"soap-cookie": "^0.10.1"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user