Giter Site home page Giter Site logo

https-demo's Introduction

https-demo

node.js/express demonstration of https and client auth

This was inspired by the excellent article HTTPS Authorized Certs with Node.js. Code is similar to the sample but incorporates Express. Commands were distilled into two bash shell scripts.

Set up and run the demo

# Install dependencies
npm install
cd certs
# Create all necessary certificates.  Dig into the scripts to learn more.
./init.sh
# Start 'er up.
cd ..
node app

Testing with curl

# Access the site using the client certificate created above.
curl -v -s -k --key snort-key.pem --cert snort-crt.pem https://localhost:4433

Testing with a browser

  1. Add the client pfx file to your certificate store. Because you're using a newly created CA, you'll probably need to add that pfx as well.
  2. Browse to https://localhost:4433.
  3. You should be presented with a dialog box. Choose the client certificate.

Note that if you change the certificate, you will need to completely close Chrome (and possibly need to kill the task) in order to see the dialog again.

Certificate Revocation is left as a future exercise.

https-demo's People

Contributors

mmendelson222 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

https-demo's Issues

Error: error:0A00018E:SSL routines::ca md too weak

Thanks for this demo - it's quite useful!

However, I'm getting an error when I try to run it locally:

Error: error:0A00018E:SSL routines::ca md too weak
    at node:internal/tls/secure-context:69:13
    at Array.forEach (<anonymous>)
    at setCerts (node:internal/tls/secure-context:67:3)
    at configSecureContext (node:internal/tls/secure-context:156:5)
    at Object.createSecureContext (node:_tls_common:117:3)
    at Server.setSecureContext (node:_tls_wrap:1352:27)
    at Server (node:_tls_wrap:1211:8)
    at new Server (node:https:74:3)
    at Object.createServer (node:https:112:10)

browser not work

Step:
1、npm install
2、node app.js
3、I add ca_client.pfx ca_server.pfx snort.pfx into my chrome(the pfx password is null) and I browse to https://localhost:4433.The dialog box not open,The server send 'User is not authorized' to me.
What am I doing wrong?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.