Akkadius / glass-isc-dhcp

Glass - ISC DHCP Server Interface
MIT License
684 stars 142 forks source link

Certificate - www file modified for https #60

Open tmacgbay opened 4 years ago

tmacgbay commented 4 years ago

Below is the /opt/glass-isc-dhcp/bin/www file that has been modified to use the certificates created for another service (Librenms) my Ubuntu server provides. It took some hunting around and progressive failures to get it right...especially since this is my first foray into Nodejs. Incidentally the Nodjs version the ubuntu server is on is v10.19.0 so those of you who were wondering about the outdated 8 version in the installation docs. As of the date of writing this Ubuntu is fully patched. The following code was added:

/**
 * Set up for https.
 */

const https = require('https');
const fs    = require('fs');
var   tls   = require('tls');

const options = {
  key:   fs.readFileSync('/etc/ssl/private/server.key'),
  cert:  fs.readFileSync('/etc/ssl/certs/cmg-net01.pem')
};

and the server line was modified to include the options from above:

/**
 * Create HTTPs server.
 */

var server = https.createServer(options,app);
dhop90 commented 4 years ago

https works using these changes but viewing logs via websocket doesn't work

tmacgbay commented 4 years ago

Huh. Let me know if you figure that one out - no time to focus on it at the moment.