SSL key location
Closed this issue · 6 comments
I'm having trouble getting lib/juggernaut/server.js to find our SSL certificates. The code in question:
https://github.com/maccman/juggernaut/blob/master/lib/juggernaut/server.js#L11
if (path.existsSync("keys/privatekey.pem")) {
var privateKey = fs.readFileSync("keys/privatekey.pem", "utf8");
var certificate = fs.readFileSync("keys/certificate.pem", "utf8");
credentials = {key: privateKey, cert: certificate};
}
I've tried juggernaut/lib/juggernaut/keys and juggernaut/keys but neither works. Using absolute paths does work:
var keysPath = __dirname + "/keys";
if (path.existsSync(keysPath+"/privatekey.pem") && path.existsSync(keysPath+"/certificate.pem")) {
var privateKey = fs.readFileSync(keysPath+"/privatekey.pem", "utf8");
var certificate = fs.readFileSync(keysPath+"/certificate.pem", "utf8");
credentials = {key: privateKey, cert: certificate};
}
Are SSL certs being loaded for anyone? What am I doing wrong?
Hi RKelln,
Atm, to use SSL and Juggernaut, you need to clone the repo locally, create a
folder called keys, and create some keys there as specified in the readme.
I realize, this isn't optimal, and we plan to allow users to specify a keys
folder via the command line soon.
Thanks,
Alex
On Wed, Jun 22, 2011 at 2:47 PM, RKelln <
reply@reply.github.com>wrote:
I'm having trouble getting lib/juggernaut/server.js to find our SSL
certificates. The code in question:https://github.com/maccman/juggernaut/blob/master/lib/juggernaut/server.js#L11
if (path.existsSync("keys/privatekey.pem")) { var privateKey = fs.readFileSync("keys/privatekey.pem", "utf8"); var certificate = fs.readFileSync("keys/certificate.pem", "utf8"); credentials = {key: privateKey, cert: certificate}; }I've tried juggernaut/lib/juggernaut/keys and juggernaut/keys but neither
works. Using absolute paths does work:var keysPath = __dirname + "/keys"; if (path.existsSync(keysPath+"/privatekey.pem") && path.existsSync(keysPath+"/certificate.pem")) { var privateKey = fs.readFileSync(keysPath+"/privatekey.pem", "utf8"); var certificate = fs.readFileSync(keysPath+"/certificate.pem", "utf8"); credentials = {key: privateKey, cert: certificate}; }Are SSL certs being loaded for anyone? What am I doing wrong?
Reply to this email directly or view it on GitHub:
#79
Alex MacCaw
+12147175129
@maccman
http://alexmaccaw.co.uk | http://www.leadthinking.com | http://socialmod.com
Thanks Alex, but our keys are working, but only when I specify the directory using absolute paths.
I installed using the regular npm method, but globally using sudo npm install juggernaut -g
, such that the server.js file containing the certificate reading code is in: /usr/local/lib/node_modules/juggernaut/lib/juggernaut/
As you can see there are two juggernaut directories that the readme instructions could refer to - is it the base juggernaut directory or the one under lib?
In any case neither locations work for us unless I specify paths absolutely, which I find very strange.
I was running into this problem too, but I couldn't figure it out. It was never consistent for me why SSL would sometimes work and sometimes not. Once I saw this issue, I realized that running the juggernaut server from its installation directory would work, but trying to call it from elsewhere wouldn't.
Patched submitted and merged (thanks Alex for the 1 hour turn around time :D )
#99
Any ideas when this might be packaged up (hopefully with socket.io 0.8.5?)
Looking into the security pull request - probably do a release after that's merged.
var keysPath = __dirname + "/keys";
-if (path.existsSync(keysPath+"/privatekey.pem") && path.existsSync(keysPath+"/certificate.pem")) {
+if (fs.existsSync(keysPath+"/privatekey.pem") && fs.existsSync(keysPath+"/certificate.pem")) {
var privateKey = fs.readFileSync(keysPath+"/privatekey.pem", "utf8");
var certificate = fs.readFileSync(keysPath+"/certificate.pem", "utf8");
credentials = {key: privateKey, cert: certificate};
}
These and other things that needed for it work today on Heroku I will put in pull request.
Refs.: