From 8e474372aa1db0a1779bd374e4c70160b6d768a0 Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Sat, 17 Dec 2016 20:19:10 +0100 Subject: [PATCH] Adding README, LICENSE and CONTRIBUTORS files --- CONTRIBUTORS | 6 +++++ LICENSE | 19 ++++++++++++++ README.md | 57 ++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 10 ++++---- nginx_conf/nginx.conf | 6 ++--- secret-key.png | Bin 0 -> 2081 bytes 6 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 CONTRIBUTORS create mode 100644 LICENSE create mode 100644 README.md create mode 100644 secret-key.png diff --git a/CONTRIBUTORS b/CONTRIBUTORS new file mode 100644 index 000000000..54f50c990 --- /dev/null +++ b/CONTRIBUTORS @@ -0,0 +1,6 @@ +This file contains a list of people who've made non-trivial +contribution to the http-two-factor project. People +who commit code to the project are encouraged to add their names +here. Please keep the list sorted by first names + +Clement Michaud diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000..9ee00acb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,19 @@ +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. diff --git a/README.md b/README.md new file mode 100644 index 000000000..35d8a0b19 --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +# http-two-factor +[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)][MIT License] + +**http-two-factor** is the simplest to set up HTTP 2-factor authentication server. It is compatible with NGINX auth_request module and is used in production to secure internal services in a swarm cluster. + +## Getting started + +This project is docker-enabled so that you can deploy and test it very quickly. +Before starting, make sure you don't have anything listening on port 8080. 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: http://localhost:8080/. + +### LDAP authentication +An LDAP server has been deployed with the following credentials: **admin/password**. + +### TOTP verification +You can use Google Authenticator for the verification of the TOTP token. You can either enter the base32 secret key or scan the QR code in Google Authenticator and the application should start generating verification tokens. + +Test secret key: GRWGIJS6IRHVEODVNRCXCOBMJ5AGC6ZE + +![secret-key](https://github.com/clems4ever/http-two-factor/raw/master/secret-key.png) + +## Contributing to http-two-factor + +Follow [contributing](CONTRIBUTING.md) file. + +## License + +http-2-factor 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. + + +[MIT License]: https://opensource.org/licenses/MIT + diff --git a/docker-compose.yml b/docker-compose.yml index 97db76052..8e6d52be5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,12 @@ version: '2' services: - auth-server: + auth: build: . environment: - LDAP_URL=ldap://ldap - LDAP_USERS_DN=dc=example,dc=com - - TOTP_SECRET=NBD2ZV64R7UV1O7K + - TOTP_SECRET=GRWGIJS6IRHVEODVNRCXCOBMJ5AGC6ZE - JWT_SECRET=unsecure_secret - JWT_EXPIRATION_TIME=1h - PORT=80 @@ -20,7 +20,7 @@ services: environment: - LDAP_ORGANISATION=MyCompany - LDAP_DOMAIN=example.com - - LDAP_ADMIN_PASSWORD=test + - LDAP_ADMIN_PASSWORD=password expose: - "389" @@ -31,6 +31,6 @@ services: - ./nginx_conf/index.html:/usr/share/nginx/html/index.html - ./nginx_conf/secret.html:/usr/share/nginx/html/secret.html depends_on: - - auth-server + - auth ports: - - "8085:80" + - "8080:80" diff --git a/nginx_conf/nginx.conf b/nginx_conf/nginx.conf index 74a7f907a..d5f3786fa 100644 --- a/nginx_conf/nginx.conf +++ b/nginx_conf/nginx.conf @@ -39,7 +39,7 @@ http { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; - proxy_pass http://auth-server/_auth; + proxy_pass http://auth/_auth; } location /auth/ { @@ -47,7 +47,7 @@ http { proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; - proxy_pass http://auth-server/; + proxy_pass http://auth/; } location = /secret.html { @@ -67,7 +67,7 @@ http { if ($request_method != POST) { return 403; } - proxy_pass http://auth-server/_auth; + proxy_pass http://auth/_auth; } } } diff --git a/secret-key.png b/secret-key.png new file mode 100644 index 0000000000000000000000000000000000000000..30a6a75c4da25a9ac28487efe34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