Code Monkey home page Code Monkey logo

microchap's Introduction

MicroCHAP

A tiny tool to allow authentication between servers or automated deployment tools using HMACSHA512 and CHAP protocols.

This is advantageous because the share secret never travels over the wire, and the MAC enables the target server to be sure that the message is genuine and signed using the shared secret.

The use of CHAP also makes replaying requests mostly useless as challenges are only usable once and the HMAC is never the same due to the use of the challenge in the reply.

IoC is recommended when using this tool. The IChapServer instance should be a singleton scoped instance so that challenges can be kept track of.

How does MicroCHAP work?

MicroCHAP is an interaction between a client and a server to authenticate an action. The client and server have a shared secret value (e.g. long random string) that they both know.

  1. The client requests a 'challenge' from the server. This is a unique value used to authenticate the request.
  2. The client creates an authentication signature based on SHA512(challenge|sharedSecret|requestUrl). Because of the unique challenge value this signature changes for every request even to the same URL.
  3. The client makes a HTTP request to the server that requires authentication, passing the signature in the X-MC-MAC HTTP header and the challenge in the X-MC-Nonce HTTP header.
  4. The server receives the request and calculates the expected signature for the request based on the incoming URL and nonce header. If the expected signature matches the received signature, the request is authenticated.

MicroCHAP does not do any sort of session management or token lifetime. Each challenge is valid for only a single request and multiple authenticated requests require multiple handshakes. In other words this is designed for low volume scenarios like authenticating deployment tools as opposed to authenticating multi-user human requests.

microchap's People

Contributors

kamsar avatar

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.