diff options
Diffstat (limited to 'debian/tests/test_modules/https-pem')
-rw-r--r-- | debian/tests/test_modules/https-pem/LICENSE | 21 | ||||
-rw-r--r-- | debian/tests/test_modules/https-pem/README.md | 78 | ||||
-rw-r--r-- | debian/tests/test_modules/https-pem/cert.pem | 17 | ||||
-rw-r--r-- | debian/tests/test_modules/https-pem/index.js | 7 | ||||
-rw-r--r-- | debian/tests/test_modules/https-pem/install.js | 10 | ||||
-rw-r--r-- | debian/tests/test_modules/https-pem/key.pem | 27 | ||||
-rw-r--r-- | debian/tests/test_modules/https-pem/package.json | 44 | ||||
-rw-r--r-- | debian/tests/test_modules/https-pem/test.js | 23 |
8 files changed, 227 insertions, 0 deletions
diff --git a/debian/tests/test_modules/https-pem/LICENSE b/debian/tests/test_modules/https-pem/LICENSE new file mode 100644 index 0000000..4a59c94 --- /dev/null +++ b/debian/tests/test_modules/https-pem/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016-2017 Thomas Watson Steen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/debian/tests/test_modules/https-pem/README.md b/debian/tests/test_modules/https-pem/README.md new file mode 100644 index 0000000..7a898d7 --- /dev/null +++ b/debian/tests/test_modules/https-pem/README.md @@ -0,0 +1,78 @@ +# https-pem + +Self-signed PEM key and certificate ready for use in your HTTPS server. + +A dead simple way to get an HTTPS server running in development with no +need to generate the self signed PEM key and certificate. + +[![Build status](https://travis-ci.org/watson/https-pem.svg?branch=master)](https://travis-ci.org/watson/https-pem) +[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) + +## Installation + +``` +npm install https-pem +``` + +**Warning:** Upon installation a private key and a self signed +certificate will be generated inside `./node_modules/https-pem`. The +certificate is valid for 365 days and no attempt have been made to make +this secure in any way. I suggest only using this for testing and +development where you just need an easy and quick way to run an HTTPS +server with Node.js. + +## Example Usage + +```js +var https = require('https') +var pem = require('https-pem') + +var server = https.createServer(pem, function (req, res) { + res.end('This is servered over HTTPS') +}) + +server.listen(443, function () { + console.log('The server is running on https://localhost') +}) +``` + +### Connecting + +When connecting to an HTTPS server from Node.js that uses a self-signed +certificate, `https.request` will normally emit an `error` and refuse to +complete the reuqest. To get around that simply set the +`rejectUnauthorized` option to `false`: + +```js +var opts = { rejectUnauthorized: false } + +var req = https.request(opts, function (res) { + // ... +}) + +req.end() +``` + +If using `curl` to connect to a Node.js HTTPS server using a +self-signed certificate, use the `-k` option: + +``` +curl -k https://localhost:4443 +``` + +## API + +The `https-pem` module simply exposes an object with two properties: +`key` and `cert`. + +### `pem.key` + +The private key (RSA). + +### `pem.cert` + +The certificate. + +## License + +MIT diff --git a/debian/tests/test_modules/https-pem/cert.pem b/debian/tests/test_modules/https-pem/cert.pem new file mode 100644 index 0000000..b778cc8 --- /dev/null +++ b/debian/tests/test_modules/https-pem/cert.pem @@ -0,0 +1,17 @@ +-----BEGIN CERTIFICATE-----
+MIICyDCCAbCgAwIBAgIJZmmvi99kgORkMA0GCSqGSIb3DQEBBQUAMAAwHhcNMjMw
+NzA5MDkyMTQwWhcNMjQwNzA4MDkyMTQwWjAAMIIBIjANBgkqhkiG9w0BAQEFAAOC
+AQ8AMIIBCgKCAQEAnqIdKW51MDpwprg/wKKAvcCZAzcNtszWy0hQtWApYLSF5UZR
+UyoLDnf24Pnm9D/JDSSG5YWdQW+/K0ehSS7R02huO1uFMQUo1Pyys1LaxhkiMn/V
+WCVpQ8m0i/ydfDrmvcj2wmllTHhlUjup22g1qeoDV09bZ4A+2BgD6JYMRE5DPcpt
+Q+rYq1Bu8XxYSD4ytiW0z+kC4rhqojHSFmt6zyjP2UF4krcM4aU0kMd2aIvyiBk5
+7b9zhEvTABb3jU+ofIV8+g6P63IFy/DKCeK2FEFvg4v+Ouvnli8NkjeuEoZ89Agz
+k0pw3uAqLM7W+MQhtOenjfJoeSd1W9TJGM/VNQIDAQABo0UwQzAMBgNVHRMEBTAD
+AQH/MAsGA1UdDwQEAwIC9DAmBgNVHREEHzAdhhtodHRwOi8vZXhhbXBsZS5vcmcv
+d2ViaWQjbWUwDQYJKoZIhvcNAQEFBQADggEBACoWVfuGQlq/+FGw4Alt1cmd5HYO
+jZXPRDsG8wXgOoDT6zDqtqD34ReNGXz/naN9FSkTIWnVgN3502kYZgRcUiaY4Wst
+1eMhG9HoslpI8nA4gHB0kf/o/ngXBfjglVv0CrBjKCLM/OubnCFftFdKTEC8el27
+dtwxcwkeB6i7YMbLRbDX9X2bXvVa05XNIPD7x4oplL2v/EjmHg/ED6OPzsS1klmq
+Z1f4nV0AykbXLzAO+oc30nuebF+ZQWcwUbvK8RgoNJUj/isLc7sfSu2SL9tA2+i/
+SJgRb+NgyVO5R5yJxK3OYG9TGByvVBMYLgp0RQRO4ZvcJ7rXh2e+QR9F13E=
+-----END CERTIFICATE-----
diff --git a/debian/tests/test_modules/https-pem/index.js b/debian/tests/test_modules/https-pem/index.js new file mode 100644 index 0000000..04bcc63 --- /dev/null +++ b/debian/tests/test_modules/https-pem/index.js @@ -0,0 +1,7 @@ +'use strict' + +var path = require('path') +var fs = require('fs') + +exports.key = fs.readFileSync(path.join(__dirname, 'key.pem')) +exports.cert = fs.readFileSync(path.join(__dirname, 'cert.pem')) diff --git a/debian/tests/test_modules/https-pem/install.js b/debian/tests/test_modules/https-pem/install.js new file mode 100644 index 0000000..d7cc884 --- /dev/null +++ b/debian/tests/test_modules/https-pem/install.js @@ -0,0 +1,10 @@ +'use strict' + +var fs = require('fs') +var path = require('path') +var selfsigned = require('selfsigned') + +var pems = selfsigned.generate() + +fs.writeFileSync(path.join(__dirname, 'key.pem'), pems.private) +fs.writeFileSync(path.join(__dirname, 'cert.pem'), pems.cert) diff --git a/debian/tests/test_modules/https-pem/key.pem b/debian/tests/test_modules/https-pem/key.pem new file mode 100644 index 0000000..55a01f5 --- /dev/null +++ b/debian/tests/test_modules/https-pem/key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEAnqIdKW51MDpwprg/wKKAvcCZAzcNtszWy0hQtWApYLSF5UZR
+UyoLDnf24Pnm9D/JDSSG5YWdQW+/K0ehSS7R02huO1uFMQUo1Pyys1LaxhkiMn/V
+WCVpQ8m0i/ydfDrmvcj2wmllTHhlUjup22g1qeoDV09bZ4A+2BgD6JYMRE5DPcpt
+Q+rYq1Bu8XxYSD4ytiW0z+kC4rhqojHSFmt6zyjP2UF4krcM4aU0kMd2aIvyiBk5
+7b9zhEvTABb3jU+ofIV8+g6P63IFy/DKCeK2FEFvg4v+Ouvnli8NkjeuEoZ89Agz
+k0pw3uAqLM7W+MQhtOenjfJoeSd1W9TJGM/VNQIDAQABAoIBABZ3JHSd40RDfnkp
+7kNocB2PVUweg5dwDnpHAUESf4GlxzGXYgSKV3sC08h8M7BDCUTOd7kxETp3aiYl
+tIpx8j7DkxreZPAyiBwTtnYNZZS48f4fWvYrBCuYuPQ7QA1cJRnbCFEzjmhEQ6sf
+7nf3W+Q2kycOAsaXY68ERadueonAp4wbH+gfctGsS15NMC1LQEZm0Q5feodK64kD
+c2dndo1X53D74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https-pem/package.json b/debian/tests/test_modules/https-pem/package.json new file mode 100644 index 0000000..3162b58 --- /dev/null +++ b/debian/tests/test_modules/https-pem/package.json @@ -0,0 +1,44 @@ +{ + "name": "https-pem", + "version": "2.0.0", + "description": "Self-signed PEM key and certificate ready for use in your HTTPS server", + "main": "index.js", + "scripts": { + "postinstall": "node install.js", + "test": "standard && node test.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/watson/https-pem.git" + }, + "keywords": [ + "tls", + "https", + "pem", + "key", + "keys", + "cert", + "certificate", + "selfsigned", + "self-signed", + "development", + "options", + "server" + ], + "author": "Thomas Watson Steen <w@tson.dk> (https://twitter.com/wa7son)", + "license": "MIT", + "bugs": { + "url": "https://github.com/watson/https-pem/issues" + }, + "homepage": "https://github.com/watson/https-pem#readme", + "dependencies": { + "selfsigned": "^1.10.1" + }, + "devDependencies": { + "standard": "^10.0.2" + }, + "coordinates": [ + 55.7774667, + 12.5906882 + ] +} diff --git a/debian/tests/test_modules/https-pem/test.js b/debian/tests/test_modules/https-pem/test.js new file mode 100644 index 0000000..b22e2c6 --- /dev/null +++ b/debian/tests/test_modules/https-pem/test.js @@ -0,0 +1,23 @@ +'use strict' + +var assert = require('assert') +var https = require('https') +var pem = require('./') + +var server = https.createServer(pem, function (req, res) { + res.end('foo') +}) + +server.listen(function () { + var opts = { + port: server.address().port, + rejectUnauthorized: false + } + https.request(opts, function (res) { + assert.strictEqual(res.statusCode, 200) + res.on('data', function (chunk) { + assert.strictEqual(chunk.toString(), 'foo') + process.exit(0) + }) + }).end() +}) |