SSO wwith Authelia Customized
Go to file
2017-07-20 11:33:24 +02:00
doc Refactor client to make it responsive and testable 2017-06-16 18:16:38 +02:00
example Open and close ldap client after each operation to avoid issues with idle connections and ECONNRESET exceptions 2017-07-19 20:59:39 +02:00
images Refactor client to make it responsive and testable 2017-06-16 18:16:38 +02:00
scripts Fix dev environment deployment when watching with Gruntfile 2017-07-17 22:37:34 +02:00
src Merge pull request #58 from clems4ever/idle-connection 2017-07-19 21:05:37 +02:00
test Open and close ldap client after each operation to avoid issues with idle connections and ECONNRESET exceptions 2017-07-19 20:59:39 +02:00
.gitignore Fix example environment 2017-07-14 19:05:42 +02:00
.npmignore npm install breaks because it does not find entrypoint file 2017-06-19 10:14:08 +02:00
.travis.yml Fix integration test and package Travis scripts 2017-06-29 13:09:08 +02:00
config.template.yml Open and close ldap client after each operation to avoid issues with idle connections and ECONNRESET exceptions 2017-07-19 20:59:39 +02:00
CONTRIBUTORS.md Rename http-two-factor into Authelia in CONTRIBUTORS.md 2017-07-20 11:33:24 +02:00
docker-compose.base.yml Fix example environment 2017-07-14 19:05:42 +02:00
docker-compose.dev.yml Fix integration test and package Travis scripts 2017-06-29 13:09:08 +02:00
docker-compose.yml Adding one integration test for redis 2017-07-14 00:25:11 +02:00
Dockerfile Fix integration test and package Travis scripts 2017-06-29 13:09:08 +02:00
Gruntfile.js Fix dev environment deployment when watching with Gruntfile 2017-07-17 22:37:34 +02:00
LICENSE Adding README, LICENSE and CONTRIBUTORS files 2016-12-17 20:26:46 +01:00
package.json 3.1.4 2017-07-19 21:07:51 +02:00
README.md Add "chat on gitter" badge in the readme 2017-07-18 00:50:47 +02:00
tsconfig.json Refactor client to make it responsive and testable 2017-06-16 18:16:38 +02:00
tslint.json First step to typescript transformation 2017-05-20 16:00:47 +02:00

Authelia

license Build Gitter

Authelia is a complete HTTP 2-factor authentication server for proxies like nginx. It has been made to work with nginx auth_request module and is currently used in production to secure internal services in a small docker swarm cluster.

Table of Contents

  1. Features summary
  2. Deployment
    1. With NPM
    2. With Docker
  3. Getting started
    1. Pre-requisites
    2. Run it!
  4. Features in details
    1. First factor with LDAP and ACL
    2. Second factor with TOTP
    3. Second factor with U2F security keys
    4. Password reset
    5. Access control
    6. Session management with Redis
  5. Documentation
    1. Authelia configuration
    2. API documentation
  6. Contributing to Authelia
  7. License

Features summary

  • Two-factor authentication using either TOTP - Time-Base One Time password - or U2F - Universal 2-Factor - as 2nd factor.
  • Password reset with identity verification by sending links to user email address.
  • Access restriction after too many authentication attempts.
  • Session management using Redis key/value store.

Deployment

If you don't have any LDAP and/or nginx setup yet, I advise you to follow the Getting Started section. That way, you can test it right away without even configure anything.

Otherwise here are the available steps to deploy Authelia on your machine given your configuration file is /path/to/your/config.yml.

With NPM

npm install -g authelia
authelia /path/to/your/config.yml

With Docker

docker pull clems4ever/authelia
docker run -v /path/to/your/config.yml:/etc/authelia/config.yml -v /path/to/data/dir:/var/lib/authelia clems4ever/authelia

where /path/to/data/dir is the directory where all user data will be stored.

Getting started

The provided example is docker-based so that you can deploy and test it very quickly.

Pre-requisites

npm

Make sure you have npm and node installed on your computer.

Docker

Make sure you have docker and docker-compose installed on your machine. For your information, here are the versions that have been used for testing:

docker --version

gave Docker version 17.03.1-ce, build c6d412e.

docker-compose --version

gave docker-compose version 1.14.0, build c7bdf9e.

Available port

Make sure you don't have anything listening on port 8080.

Subdomain aliases

Add the following lines to your /etc/hosts to alias multiple subdomains so that nginx can redirect request to the correct virtual host.

127.0.0.1       secret.test.local
127.0.0.1       secret1.test.local
127.0.0.1       secret2.test.local
127.0.0.1       home.test.local
127.0.0.1       mx1.mail.test.local
127.0.0.1       mx2.mail.test.local
127.0.0.1       auth.test.local

Run it!

Deploy Authelia example with the following command:

npm install --only=dev
./node_modules/.bin/grunt build-dist
./scripts/example/deploy-example.sh

After few seconds the services should be running and you should be able to visit https://home.test.local:8080/.

When accessing the login page, a self-signed certificate exception should appear, it has to be trusted before you can get to the target page. The certificate must be trusted for each subdomain, therefore it is normal to see the exception several times.

Below is what the login page looks like:

Features in details

First factor with LDAP and ACL

An LDAP server has been deployed for you with the following credentials and access control list:

You can use them in the login page. If everything is ok, the second factor page should appear as shown below. Otherwise you'll get an error message notifying your credentials are wrong.

Second factor with TOTP

In Authelia, you need to register a per user TOTP (Time-Based One Time Password) secret before authenticating. To do that, you need to click on the register button. It will send a link to the user email address. Since this is an example, no email will be sent, the link is rather delivered in the file ./notifications/notification.txt. Paste the link in your browser and you'll get your secret in QRCode and Base32 formats. You can use Google Authenticator to store them and get the generated tokens with the app.

Second factor with U2F security keys

Authelia also offers authentication using U2F (Universal 2-Factor) devices like Yubikey USB security keys. U2F is one of the most secure authentication protocol and is already available for Google, Facebook, Github accounts and more.

Like TOTP, U2F requires you register your security key before authenticating. To do so, click on the register button. This will send a link to the user email address. Since this is an example, no email will be sent, the link is rather delivered in the file ./notifications/notification.txt. Paste the link in your browser and you'll be asking to touch the token of your device to register. Upon successful registration, you can authenticate using your U2F device by simply touching the token. Easy, right?!

Password reset

With Authelia, you can also reset your password in no time. Click on the Forgot password? link in the login page, provide the username of the user requiring a password reset and Authelia will send an email with an link to the user email address. For the sake of the example, the email is delivered in the file ./notifications/notification.txt. Paste the link in your browser and you should be able to reset the password.

Access Control

With Authelia, you can define your own access control rules for restricting the user access to some subdomains. Those rules are defined in the configuration file and can be set either for everyone, per-user or per-group policies. Check out the config.template.yml to see how they are defined.

Session management with Redis

When your users authenticate against Authelia, sessions are stored in a Redis key/value store. You can specify your own Redis instance in the configuration file.

Documentation

Authelia configuration

The configuration of the server is defined in the file configuration.template.yml. All the details are documented there. You can specify another configuration file by giving it as first argument of Authelia.

authelia config.custom.yml

API documentation

There is a complete API documentation generated with apiDoc and embedded in the repo under the doc/ directory. Simply open index.html locally to watch it.

Contributing to Authelia

Follow contributing file.

License

Authelia is licensed under the MIT License. The terms of the license are as follows:

The MIT License (MIT)

Copyright (c) 2016 - Clement Michaud

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.