From 36c2f234078be37a46e1c14baff06ff3a7cb1536 Mon Sep 17 00:00:00 2001 From: Koske Kimutai Date: Tue, 10 Sep 2019 12:52:30 +0300 Subject: [PATCH] adding ssl --- packages/server/src/main.ts | 8 ++- packages/server/src/secrets/demo-cert.pem | 31 ++++++++++++ packages/server/src/secrets/demo-key.pem | 60 +++++++++++++++++++++++ 3 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 packages/server/src/secrets/demo-cert.pem create mode 100644 packages/server/src/secrets/demo-key.pem diff --git a/packages/server/src/main.ts b/packages/server/src/main.ts index ffa9f83..9bca7a5 100644 --- a/packages/server/src/main.ts +++ b/packages/server/src/main.ts @@ -4,13 +4,17 @@ import { Transport } from '@nestjs/microservices'; import { SeederModule } from './infrastructure/seeder'; import { log } from 'util'; import { Logger } from '@nestjs/common'; -import { fs } from 'fast-glob/out/utils'; import { ConfigService } from './config/config.service'; import { ConfigModule } from './config/config.module'; import { join } from 'path'; +import * as fs from "fs"; async function bootstrap() { - const app = await NestFactory.create(AppModule); + const httpsOptions = { + key: fs.readFileSync('./secrets/demo-key.pem'), + cert: fs.readFileSync('./secrets/demo-cert.pem'), + }; + const app = await NestFactory.create(AppModule,{httpsOptions}); const config = app.get(ConfigService); Logger.log(`starting in ${process.env.NODE_ENV} mode`); const microservice = app.connectMicroservice(config.QueueConfig); diff --git a/packages/server/src/secrets/demo-cert.pem b/packages/server/src/secrets/demo-cert.pem new file mode 100644 index 0000000..edace96 --- /dev/null +++ b/packages/server/src/secrets/demo-cert.pem @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFXTCCBEWgAwIBAgISAxmAVv259vmEqAX3lLv9+Fw9MA0GCSqGSIb3DQEBCwUA +MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD +ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xOTA5MTAwODMwMTVaFw0x +OTEyMDkwODMwMTVaMB0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mjqbAIhAIcBHKKU+JD3YUM0 +NPsd2EGMFxlzkd5fXQ14YVk3vhI+AHYAY/Lbzeg7zCzPC3KEJ1drM6SNYXePvXWm +OLHHaFRL2I0AAAFtGoJmMQAABAMARzBFAiABSZAIRvdNCwaeWavIH76RTw7ZdeZg +sE+gLXUsXMsh5wIhALn0/c5qdGtjFiRowA5u7rgxYwkkGGcuXKKCpn1cSIdWMA0G +CSqGSIb3DQEBCwUAA4IBAQBq743BPN/iQ2bDd14dJ0n9uKIW1G82u7Uv0WS6rt6H +pjQ3cO4sGGFQ5ONTgeFu34KkK1epRWp7ZJdERYorpx7EvENfkxKBsqz6tqwD89QG +3NjUeGPN0kMQuvD0HwxY59ukFla/8rP8zuGM8nnsI4Z0smNnuaTZkpf/7NpLSjN3 +poIL/AjQr9aqgUkO9b+ISPwE4sdUw7N9et4/5eREO3ylw2jGyGIpOXobm5QVQTNr +dNA6o1Ll3tnJGGaXthD8O+lQWeMHvO9HMjeSycnJUvxG2BUk4TiMFSzy3uEt7sO6 +l7AGdFuTxFIlyF3ov7abCQcmqWddguhycgUn30RMMLY3 +-----END CERTIFICATE----- diff --git a/packages/server/src/secrets/demo-key.pem b/packages/server/src/secrets/demo-key.pem new file mode 100644 index 0000000..9cdf19b --- /dev/null +++ b/packages/server/src/secrets/demo-key.pem @@ -0,0 +1,60 @@ +-----BEGIN CERTIFICATE----- +MIIFXTCCBEWgAwIBAgISAxmAVv259vmEqAX3lLv9+Fw9MA0GCSqGSIb3DQEBCwUA +MEoxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MSMwIQYDVQQD +ExpMZXQncyBFbmNyeXB0IEF1dGhvcml0eSBYMzAeFw0xOTA5MTAwODMwMTVaFw0x +OTEyMDkwODMwMTVaMB0xGzAZBgNVBAMTEnNwb3Qua2VueWFobWlzLm9yZzCCASIw +DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMEh7kFVRWl9D/N+lO7Mw3WbW69M +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FtGoJmMQAABAMARzBFAiABSZAIRvdNCwaeWavIH76RTw7ZdeZg +sE+gLXUsXMsh5wIhALn0/c5qdGtjFiRowA5u7rgxYwkkGGcuXKKCpn1cSIdWMA0G +CSqGSIb3DQEBCwUAA4IBAQBq743BPN/iQ2bDd14dJ0n9uKIW1G82u7Uv0WS6rt6H +pjQ3cO4sGGFQ5ONTgeFu34KkK1epRWp7ZJdERYorpx7EvENfkxKBsqz6tqwD89QG +3NjUeGPN0kMQuvD0HwxY59ukFla/8rP8zuGM8nnsI4Z0smNnuaTZkpf/7NpLSjN3 +poIL/AjQr9aqgUkO9b+ISPwE4sdUw7N9et4/5eREO3ylw2jGyGIpOXobm5QVQTNr +dNA6o1Ll3tnJGGaXthD8O+lQWeMHvO9HMjeSycnJUvxG2BUk4TiMFSzy3uEt7sO6 +l7AGdFuTxFIlyF3ov7abCQcmqWddguhycgUn30RMMLY3 +-----END CERTIFICATE----- +root@CICDReleaseServer:/etc/letsencrypt/live/spot.kenyahmis.org# cat ../../archive/spot.kenyahmis.org/privkey1.pem +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDBIe5BVUVpfQ/z +fpTuzMN1m1uvTJCIi8RFOOaCZCn6BZn3he/6oAJcNYU7OkvKJi8BgrfCf1wCPrq3 +8ab/TzUvYESiqEmZvsdNS138av5RypK/7SNXDoJCVY+jj10nhR0/mdseXIBXSjtU +eQNoGA9EMT8f2IWfg+mFkC+9F3OStc89emgh9ucIys+ZR/JsbrGuLbsAc+Hivvym +AToiSR+nnlwQQfc00b2afX5DjxdOPn9c3Qezdsb0wvWkebN6n+1FKCJxWkLZJNuN +1bH4WEb7FL90sQhoLlTuwE9e5DSny74OiVjYbtf3EY+MCRZwunFJl4RhqJKtbBdP +xygqNUl7AgMBAAECggEAA/+83DN0zXteci9DzDIHNg8ydc3DDGDAfqJv+3ExgVDO +YFawomLfyaL+EDzjxtrFjGV1gpx6fj1oRlj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