node-http-server
Version:
A very simple and fast http server for node, bash, and spawnable from C, Python etc. It is lightweight and great for embedded solutions as well as everyday development or public facing apps.
120 lines (93 loc) • 10.6 kB
HTML
<html>
<head>
<title>Using TLS and SSL for Secure server</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="viewport"
content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet"
media="all"
href="../assets/file_1.css"/>
<link rel="stylesheet"
media="all"
href="../assets/file_5.css"/>
<link rel="stylesheet"
media="all"
href="../assets/32px.png"/>
<link rel="stylesheet"
media="all"
href="../assets/40px.png"/>
<link rel="stylesheet"
media="all"
href="../assets/throbber.gif"/>
<link rel="stylesheet"
media="all"
href="../assets/file_7.css"/>
<link rel="stylesheet"
media="all"
href="../assets/file_8.css"/>
<script src="../assets/file_2.js"
type="text/javascript"></script>
<script src="../assets/file_3.js"
type="text/javascript"></script>
<script src="../assets/file_4.js"
type="text/javascript"></script>
<script src="../assets/file_6.js"
type="text/javascript"></script>
<script type="application/json" id="jsTreeJSON">
[{"id":"./example/basic/https-advancedApp.js","text":"https-advancedApp.js","icon":"jstree-file","parent":"./example/basic","a_attr":{"href":"../example/basic/https-advancedApp.js.html"},"state":{"selected":false}},{"id":".","text":".","icon":"jstree-folder","parent":"#","a_attr":{"href":".."},"state":{"opened":true}},{"id":"./example","text":"example","icon":"jstree-folder","parent":".","a_attr":{"href":"../example"},"state":{"opened":false}},{"id":"./example/readme.md","text":"readme.md","icon":"jstree-file","parent":"./example","a_attr":{"href":"../example/readme.md.html"},"state":{"selected":false}},{"id":"./example/advanced","text":"advanced","icon":"jstree-folder","parent":"./example","a_attr":{"href":"../example/advanced"},"state":{"opened":false}},{"id":"./example/advanced/basicTemplate.js","text":"basicTemplate.js","icon":"jstree-file","parent":"./example/advanced","a_attr":{"href":"../example/advanced/basicTemplate.js.html"},"state":{"selected":false}},{"id":"./example/advanced/https-ONLY-basicTemplate.js","text":"https-ONLY-basicTemplate.js","icon":"jstree-file","parent":"./example/advanced","a_attr":{"href":"../example/advanced/https-ONLY-basicTemplate.js.html"},"state":{"selected":false}},{"id":"./example/advanced/https-basicTemplate.js","text":"https-basicTemplate.js","icon":"jstree-file","parent":"./example/advanced","a_attr":{"href":"../example/advanced/https-basicTemplate.js.html"},"state":{"selected":false}},{"id":"./example/advanced/https-randomCSS.js","text":"https-randomCSS.js","icon":"jstree-file","parent":"./example/advanced","a_attr":{"href":"../example/advanced/https-randomCSS.js.html"},"state":{"selected":false}},{"id":"./example/advanced/https-requestBenchmark.js","text":"https-requestBenchmark.js","icon":"jstree-file","parent":"./example/advanced","a_attr":{"href":"../example/advanced/https-requestBenchmark.js.html"},"state":{"selected":false}},{"id":"./example/advanced/randomCSS.js","text":"randomCSS.js","icon":"jstree-file","parent":"./example/advanced","a_attr":{"href":"../example/advanced/randomCSS.js.html"},"state":{"selected":false}},{"id":"./example/advanced/requestBenchmark.js","text":"requestBenchmark.js","icon":"jstree-file","parent":"./example/advanced","a_attr":{"href":"../example/advanced/requestBenchmark.js.html"},"state":{"selected":false}},{"id":"./example/basic","text":"basic","icon":"jstree-folder","parent":"./example","a_attr":{"href":"../example/basic"},"state":{"opened":false}},{"id":"./example/basic/advancedApp.js","text":"advancedApp.js","icon":"jstree-file","parent":"./example/basic","a_attr":{"href":"../example/basic/advancedApp.js.html"},"state":{"selected":false}},{"id":"./example/basic/basicApp.js","text":"basicApp.js","icon":"jstree-file","parent":"./example/basic","a_attr":{"href":"../example/basic/basicApp.js.html"},"state":{"selected":false}},{"id":"./example/basic/basicLogging.js","text":"basicLogging.js","icon":"jstree-file","parent":"./example/basic","a_attr":{"href":"../example/basic/basicLogging.js.html"},"state":{"selected":false}},{"id":"./example/basic/cluster-basicApp.js","text":"cluster-basicApp.js","icon":"jstree-file","parent":"./example/basic","a_attr":{"href":"../example/basic/cluster-basicApp.js.html"},"state":{"selected":false}},{"id":"./example/basic/https-ONLY-basicApp.js","text":"https-ONLY-basicApp.js","icon":"jstree-file","parent":"./example/basic","a_attr":{"href":"../example/basic/https-ONLY-basicApp.js.html"},"state":{"selected":false}},{"id":"./README.md","text":"README.md","icon":"jstree-file","parent":".","a_attr":{"href":"../README.md.html"},"state":{"selected":false}},{"id":"./example/basic/https-basicApp.js","text":"https-basicApp.js","icon":"jstree-file","parent":"./example/basic","a_attr":{"href":"../example/basic/https-basicApp.js.html"},"state":{"selected":false}},{"id":"./example/basic/https-basicLogging.js","text":"https-basicLogging.js","icon":"jstree-file","parent":"./example/basic","a_attr":{"href":"../example/basic/https-basicLogging.js.html"},"state":{"selected":false}},{"id":"./example/basic/https-multipleDomains.js","text":"https-multipleDomains.js","icon":"jstree-file","parent":"./example/basic","a_attr":{"href":"../example/basic/https-multipleDomains.js.html"},"state":{"selected":false}},{"id":"./example/basic/https-verboseApp.js","text":"https-verboseApp.js","icon":"jstree-file","parent":"./example/basic","a_attr":{"href":"../example/basic/https-verboseApp.js.html"},"state":{"selected":false}},{"id":"./example/basic/multipleDomains.js","text":"multipleDomains.js","icon":"jstree-file","parent":"./example/basic","a_attr":{"href":"../example/basic/multipleDomains.js.html"},"state":{"selected":false}},{"id":"./example/basic/verboseApp.js","text":"verboseApp.js","icon":"jstree-file","parent":"./example/basic","a_attr":{"href":"../example/basic/verboseApp.js.html"},"state":{"selected":false}},{"id":"./example/proxy","text":"proxy","icon":"jstree-folder","parent":"./example","a_attr":{"href":"../example/proxy"},"state":{"opened":false}},{"id":"./example/proxy/basic.js","text":"basic.js","icon":"jstree-file","parent":"./example/proxy","a_attr":{"href":"../example/proxy/basic.js.html"},"state":{"selected":false}},{"id":"./example/proxy/https-and-http-basic.js","text":"https-and-http-basic.js","icon":"jstree-file","parent":"./example/proxy","a_attr":{"href":"../example/proxy/https-and-http-basic.js.html"},"state":{"selected":false}},{"id":"./example/proxy/https-and-http-google-proxy.js","text":"https-and-http-google-proxy.js","icon":"jstree-file","parent":"./example/proxy","a_attr":{"href":"../example/proxy/https-and-http-google-proxy.js.html"},"state":{"selected":false}},{"id":"./server","text":"server","icon":"jstree-folder","parent":".","a_attr":{"href":"../server"},"state":{"opened":false}},{"id":"./server/Config.js","text":"Config.js","icon":"jstree-file","parent":"./server","a_attr":{"href":"../server/Config.js.html"},"state":{"selected":false}},{"id":"./server/Server.js","text":"Server.js","icon":"jstree-file","parent":"./server","a_attr":{"href":"../server/Server.js.html"},"state":{"selected":false}},{"id":"./bin","text":"bin","icon":"jstree-folder","parent":".","a_attr":{"href":"../bin"},"state":{"opened":false}},{"id":"./bin/nhs.js","text":"nhs.js","icon":"jstree-file","parent":"./bin","a_attr":{"href":"../bin/nhs.js.html"},"state":{"selected":false}},{"id":"./local-certs","text":"local-certs","icon":"jstree-folder","parent":".","a_attr":{"href":"."},"state":{"opened":true}},{"id":"./local-certs/readme.md","text":"readme.md","icon":"jstree-file","parent":"./local-certs","a_attr":{"href":"readme.md.html"},"state":{"selected":true}}]
</script>
</head>
<body class="markdown-body">
<h1>
Using TLS and SSL for Secure server
</h1>
<div class="subHeading">
./local-certs/readme.md
</div>
<button type="button" class="navigatorToggle">☰ files...</button>
<nav class="navigationTree minimized">
<input type="text" id="jsTreeSearch" placeholder="search..."/>
<div></div>
</nav>
<section>
<ul class="sectionDetails docsOnly">
<li id="section-1">
<div class="annotation">
<h3 id="document-in-progress">document in progress</h3>
<p>Still working on this. If you look at the examples and can help, please jump right in.</p>
<h3 id="simple-self-signed-certificates">Simple Self Signed Certificates</h3>
<pre><code class="lang-sh">
<span class="hljs-comment">#generate you server key</span>
openssl genrsa -out server.key 2048
<span class="hljs-comment">#generate the server public key or client cert</span>
openssl req -new -x509 -key server.key -out server.pub -days 365 -config openssl.cnf
</code></pre>
<h3 id="creating-your-own-certificate-authority-and-signing-your-cert-with-it-">Creating Your Own Certificate Authority And Signing Your Cert With it.</h3>
<pre><code class="lang-sh">
<span class="hljs-comment">#generate the CA key</span>
openssl genrsa -out rootCA.key 2048
<span class="hljs-comment">#self sign the CA key</span>
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.pem
<span class="hljs-comment">#generate you server key</span>
openssl genrsa -out server.key 2048
<span class="hljs-comment">#create your certificate signing request</span>
openssl req -new -key server.key -out server.csr
<span class="hljs-comment">#generate the server public key or client cert</span>
openssl x509 -req -<span class="hljs-keyword">in</span> server.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out client.crt -days 500 -sha256
</code></pre>
<p><strong>*need to add info on openssl.cnf edits</strong></p>
<h4 id="using-the-local-certs">using the local certs</h4>
<p>This should <strong>ONLY</strong> be done on your local machine. Both the public and private certs are available here on git hub, so its not a good idea to use them over the network.</p>
<h4 id="talk-about-security">talk about security</h4>
<ul>
<li>keep private keys private, don’t share</li>
</ul>
<h4 id="talk-about-using-hostname-not-ip-for-best-security-validation-of-certs">talk about using hostname not ip for best security validation of certs</h4>
</div><div class="content">
</div>
</li>
</ul>
</section>
</body>
</html>