GithubHelp home page GithubHelp logo

rakesh-mohanta / hermes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ralt/hermes

0.0 3.0 0.0 184 KB

Authenticate on linux by plugging your USB stick!

License: MIT License

Makefile 2.94% Common Lisp 94.03% C 2.13% Shell 0.90%

hermes's Introduction

hermes

Authenticate on linux by plugging your USB stick!

Demo: https://www.youtube.com/watch?v=W7L9FrIDYgU

Installation

Installing hermes

Note: for now, only a debian/ubuntu package is provided.

Download the debian package and install it:

$ sudo dpkg -i hermes_1.3_amd64.deb
$ sudo apt-get -f install

Preparing the usb stick

I recommend having 2 partitions on your usb stick: a very small one (hermes needs 266 bytes as of now, so allocate 2048 bytes to be safe), and another partition for your data.

Let's assume that the partition for hermes is /dev/sdb1, and your user is foo.

To make your usb stick an hermes device, run:

$ sudo hermes write /dev/sdb1 foo

You can see what hermes can do with hermes help. (Although for now, it can only run the write command seen above.)

Done!

You can now do exactly as in the video. When you need to login, plug in the usb stick, hit enter with an empty password, and you should be logged in!

Manual installation

If you're not on debian, here are the steps to manually install hermes.

Download the following (equivalent to your distribution) dependencies: gcc, sbcl, wget, buildapp, libpam0g-dev, libfixposix-dev.

Then run:

# Build hermes
$ git clone https://github.com/ralt/hermes
$ cd hermes/
$ make

# Install the built files
$ sudo make install

# Configure your system
$ sudo pam-auth-update # Select "Hermes"
$ sudo addgroup hermes

If you're using systemd, you can then run the following:

$ sudo systemctl enable hermes
$ sudo systemctl start hermes

If you're not using systemd, please look at the debian/services/hermes.service file and reproduce the equivalent for your init system.

From then on, you can follow the steps in Preparing the usb stick.

How does it work?

A string of 128 characters is put on the both usb stick and in the user's home directory. When connection time comes, the tokens are checked to see if they match. If they do, the user can be connected.

Every time there is a successful login, the token is regenerated, for security reasons.

Developer todo

  • better error handling. Right now it's fprintf(stderr) or perror() everywhere, randomly. Make it consistent.

Technical process

The hermes write <device> <user> command will generate a 128-bytes token, and write it to both /etc/hermes/<user> and the device. On the device, it will first write 5 bytes to recognize an hermes device.

When login is needed, the PAM module will send the user to the /var/run/hermes.sock UNIX socket. The hermes-daemon service will then look in /dev/sd* for a hermes device (starts with bytes 82, 111, 98, 105, 110). If none exists, it sends "false" to the UNIX socket. If one exists, it compares with the token in /etc/hermes/<user>, and sends either "true" or "false" back to the UNIX socket. The PAM module just has to get the boolean result back and it can return it.

License

The project is provided under the MIT license.

hermes's People

Contributors

ralt avatar

Watchers

 avatar  avatar  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.