owacoder
owacoder

Reputation: 4873

Disable TLS 1.0 and TLS 1.1 in Greenlock-Express

Is there a way to disable TLS 1.0 and TLS 1.1 and only allow TLS 1.2 with Greenlock-Express and Node.js?

The example code for Greenlock shows something like the following:

var app = require("./app");

require("greenlock-express")
  .init({
     packageRoot: __dirname,
     configDir: "./greenlock.d",

     maintainerEmail: "[email protected]",

     cluster: false
})
.serve(app);

where app is the Express server object.

Can server TLS options be passed through the Greenlock initialization parameters?

Upvotes: 0

Views: 239

Answers (1)

coolaj86
coolaj86

Reputation: 76984

Use .ready() instead of .serve() and you can get access to node's native https object customize as you wish.

.ready(function (glx) {
    // Get the raw https server:
    var tlsOptions = {};
    var httpsServer = glx.httpsServer(tlsOptions, function(req, res) {
        res.end("Hello, Encrypted World!");
    });

    httpsServer.listen(443, "0.0.0.0", function() {
        console.info("Listening on ", httpsServer.address());
    });
})

See examples/https/server.js.

Upvotes: 1

Related Questions