I'm making HTTPS connections from a node app, using a client certificate:
var options = {
hostname: 'https://my-server.com',
port: 443,
path: '/',
method: 'GET',
key: fs.readFileSync('client1-key.pem'),
cert: fs.readFileSync('client1-crt.pem'),
ca: fs.readFileSync('ca-crt.pem') };
var req = https.request(options, res => {
[...]
});
Everything is working fine, however I want to add code to ensure only TLS 1.2 connections are allowed. I cannot find any way to configure this in the https.agent options, or elsewhere. Is it possible to configure this, or do I have to make a connection and then query the protocol version, with something like:
res.socket.getProtocol() === 'TLSv1.2'
and abort the connection if the protocol is not satisfactory?