Implement HTTPS API with self-signed cert
Switches API to serve all requests over HTTPS, using a self-signed SSL certificate.
This commit is contained in:
parent
34324dabd5
commit
ea022d3880
13
lib/api.js
13
lib/api.js
|
@ -8,8 +8,10 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var express = require('express.io');
|
var fs = require('fs');
|
||||||
var namespace = require('node-namespace');
|
|
||||||
|
var express = require('express.io'),
|
||||||
|
namespace = require('node-namespace');
|
||||||
|
|
||||||
namespace("Cylon", function() {
|
namespace("Cylon", function() {
|
||||||
// The Cylon API Server provides an interface to communicate with master class
|
// The Cylon API Server provides an interface to communicate with master class
|
||||||
|
@ -29,7 +31,12 @@ namespace("Cylon", function() {
|
||||||
|
|
||||||
master = opts.master;
|
master = opts.master;
|
||||||
|
|
||||||
this.server = express().http().io();
|
var options = {
|
||||||
|
cert: fs.readFileSync(__dirname + "/ssl/server.crt"),
|
||||||
|
key: fs.readFileSync(__dirname + "/ssl/server.key")
|
||||||
|
}
|
||||||
|
|
||||||
|
this.server = express().https(options).io();
|
||||||
|
|
||||||
this.server.set('title', 'Cylon API Server');
|
this.server.set('title', 'Cylon API Server');
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDnDCCAoQCCQDMuSNl5mThYDANBgkqhkiG9w0BAQUFADCBjzELMAkGA1UEBhMC
|
||||||
|
VVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFDASBgNVBAcTC0xvcyBBbmdlbGVzMRkw
|
||||||
|
FwYDVQQKExBUaGUgSHlicmlkIEdyb3VwMRIwEAYDVQQDEwlsb2NhbGhvc3QxJjAk
|
||||||
|
BgkqhkiG9w0BCQEWF2N5bG9uanNAaHlicmlkZ3JvdXAuY29tMB4XDTE0MDQwMzIx
|
||||||
|
MjczM1oXDTE1MDQwMzIxMjczM1owgY8xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpD
|
||||||
|
YWxpZm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RawS30xyxIYy
|
||||||
|
z0yImdzHG5rXGlPS1aeeVue4H9DfinCICSfd0Bx9iJCqzUD98cmK8x4hVezD9r32
|
||||||
|
/6jm88UzF2WgJvuxcQ8EQRiPGCFcLHGB2AFryTWdt6ibCW6gsoRinnvZ
|
||||||
|
-----END CERTIFICATE REQUEST-----
|
|
@ -0,0 +1,27 @@
|
||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEpAIBAAKCAQEAuGhvMNpaUsHA9QUFlHFC3l+y/EXOQYnxPEPxSGnivk/gh2pr
|
||||||
|
YMprPuqgihv+X3q31LNzGL6eJvgLKTG3uvDiaYMkUJL71pXz679oUJeMSJwJI+Qz
|
||||||
|
3l/o04Nrcm8dZ4V9h5A5mrS4NL09Nxxemia29fu592ZiY+kM3NRwkP4UDz7m1V21
|
||||||
|
u+gXlpWy7hR9vsJygT0q7J5abtRCmNoq6hhUBr/14IdB+m3B/SI8+Vbg1xLkkbQI
|
||||||
|
k6rLKsVgLfQwiUTr+2iXxMI8WtsDgct22oEoyQ5+FJiivXY4EprNVZaqT4CS4NAV
|
||||||
|
9cD84WQvdUZUWOdSH9FSMKhlD4J4oAzuCtTJRwIDAQABAoIBAQCwIqgZrGXbZ88q
|
||||||
|
+On0eB4bkqK9zNsNxHjTTD35IZH+nwLhtObtI0o+ZRKD9+sGPYu6sNA9kUw0AnV+
|
||||||
|
mktYVl6b0zPrdgjvVHkP8tnrKGVIsSkVzBEy1L7o0Dzfp3wZdeqJgltTBkxvq1T9
|
||||||
|
/63oZRQabZ6ZzIQr09yCTLNb+iMkzxuJSbdwVAws+oKqSTVoUKY/Gee66MsJjKkr
|
||||||
|
FfqwS/tVfTFWXp9CamWz/zBDyUXnrtUhzNxE+3LPbeZ/sMq/V/f1F5jiQNjenMGl
|
||||||
|
K/qD3HyNbR0P4xWYCe/4/QLSWjsiZHg51d4Nioegii2775ya9qDvtTfUeNNdvCf6
|
||||||
|
HMcvUIPxAoGBAOF5pSl/9VqRc1FXS+Kr8cs7DORZ6EPXKzUZL59V0NHoMgKbk+sM
|
||||||
|
JZv4TeDx26eBoecT2UYWSYMbKLl7sM9YZDJJhgwMeqa47PHk5Cua/Dpfus/pDl67
|
||||||
|
S5FT/gyA2tpSpULml2G7YegdPnTRRNQdppcrY5v9LQ9CSPhbSAPY/FspAoGBANFf
|
||||||
|
gs6JEq46SOMBw+66svwaT2DQJNchwtCKE+2m7OdNufrtTSAVlKlNpGQQxElwYYg1
|
||||||
|
xkEA+l7MycXIkSWOGC4JfLSRYlBgYOFzCQCME9rTkboAXn8Iru9p9vnRnfsEOUk4
|
||||||
|
Vr8/ehzv4gcf90ZJcnPkQNu5lTkr+s/bNDjAof7vAoGARN3zvU4w8V21nCWOrwgX
|
||||||
|
jRxXHrP7RiVFNC2iJwd+BW7nP3anYkZOgmn/13HnxizI95xPY6HRCDNWZ/jIkzwL
|
||||||
|
NnTQdYOmPqAC9wsTSeJHoci1dWVYl0SbmyLNWKJOthpCEcH+gMJL8CpmdiWo4STB
|
||||||
|
SjDddrqIdb2oLfsrbslqoqkCgYAUJV6OxP25Kf6NaUQTGn/SZi2xIRYKZUM7ka2t
|
||||||
|
NlyhPQdiL6c2KR1u1Pu2bS6V6mxYEOSMqK1upcHceBoPRQbqlxsavMp69WsdBlad
|
||||||
|
aN0YNzdUcGinTIyYmNec3iCXYKaqdvNR36e+VQ6opNjEOJj8sb/T5J2JLMQrb+os
|
||||||
|
c8yinQKBgQCcww6Mr0Wnbw/E9RrwYJqheFWXjdrvbhs5leudzHknL/WXfroOccFr
|
||||||
|
cduywWcHkGq9ig0fay/3iVS5WRAlVqDOGmf60It60ZE0CEDVsHd3w9BEAeJxkq+6
|
||||||
|
vnMZ73dIUKmOozNg0+xK7XsY2YCNdYUaFtKH/ENfsCWfu7r2Kli46A==
|
||||||
|
-----END RSA PRIVATE KEY-----
|
Loading…
Reference in New Issue