<commit_before># Authelia

  [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)][MIT License]
  [![Build](https://travis-ci.org/clems4ever/authelia.svg?branch=master)](https://travis-ci.org/clems4ever/authelia)

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

## Features
* 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.

## Deployment

If you don't have any LDAP and nginx setup yet, I advise you to follow the 
Getting Started. That way, you will not require anything to start.

Otherwise here are the available steps to deploy on your machine.

### With NPM

    npm install -g authelia

### With Docker

    docker pull clems4ever/authelia

## Getting started

The provided example is docker-based so that you can deploy and test it very 
quickly. First clone the repo make sure you don't have anything listening on 
port 8080 before starting. 
Then, type the following command to build and deploy the services:

    docker-compose build
    docker-compose up -d

After few seconds the services should be running and you should be able to visit 
[https://localhost:8080/](https://localhost:8080/). 

Normally, a self-signed certificate exception should appear, it has to be 
accepted before getting to the login page:

![first-factor-page](https://raw.githubusercontent.com/clems4ever/authelia/master/images/first_factor.png)

### 1st factor: LDAP
An LDAP server has been deployed for you with the following credentials: **user/password**.

Type them in the login page and validate. Then, the second factor page should 
have appeared as shown below.

![second-factor-page](https://raw.githubusercontent.com/clems4ever/authelia/master/images/second_factor.png)


### 2nd factor: TOTP (Time-Base One Time Password)
In **Authelia**, you need to register a per user TOTP 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](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en) 
to store them and get the generated tokens required during authentication.

![totp-secret](https://raw.githubusercontent.com/clems4ever/authelia/master/images/totp.png)

### 2nd factor: U2F (Universal 2-Factor) with security keys
**Authelia** also offers authentication using U2F devices like [Yubikey](Yubikey) <commit_msg>Ask the user to add lines to /etc/hosts in the getting started section of the README<commit_after># Authelia

  [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)][MIT License]
  [![Build](https://travis-ci.org/clems4ever/authelia.svg?branch=master)](https://travis-ci.org/clems4ever/authelia)

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

## Features
* 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.

## Deployment

If you don't have any LDAP and nginx setup yet, I advise you to follow the 
Getting Started. That way, you will not require anything to start.

Otherwise here are the available steps to deploy on your machine.

### With NPM

    npm install -g authelia

### With Docker

    docker pull clems4ever/authelia

## Getting started

The provided example is docker-based so that you can deploy and test it very 
quickly. First clone the repo make sure you don't have anything listening on 
port 8080 before starting. 
Add the following lines to your /etc/hosts to simulate multiple subdomains

    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       auth.test.local
    
Then, type the following command to build and deploy the services:

    docker-compose build
    docker-compose up -d

After few seconds the services should be running and you should be able to visit 
[https://localhost:8080/](https://secret.test.local:8080/). 

Normally, a self-signed certificate exception should appear, it has to be 
accepted before getting to the login page:

![first-factor-page](https://raw.githubusercontent.com/clems4ever/authelia/master/images/first_factor.png)

### 1st factor: LDAP
An LDAP server has been deployed for you with the following credentials: **user/password**.

Type them in the login page and validate. Then, the second factor page should 
have appeared as shown below.

![second-factor-page](https://raw.githubusercontent.com/clems4ever/authelia/master/images/second_factor.png)


### 2nd factor: TOTP (Time-Base One Time Password)
In **Authelia**, you need to register a per user TOTP 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](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en) 
to store them and get the generated tokens required during authentication.

![totp-secret](https://raw.githubusercontent.com/clems4ever/authelia/master/images/totp.png)

### 2nd factor: U2F (Universal 2-Factor) with security keys
**Authelia** also offers authentication using U2F devices like [Yubikey](Yubikey) 
{'fraction_non_alphanumeric': 0.08515967438948027, 'fraction_numerical': 0.015967438948027553, 'mean_word_length': 4.267106347897774, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 18, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1577519', 'n_tokens_mistral': 1941, 'n_tokens_neox': 1824, 'n_words': 752}