简体   繁体   中英

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@example.com",

     cluster: false
})
.serve(app);

where app is the Express server object.

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM