All Projects → leonjza → trauth

leonjza / trauth

Licence: MIT license
🔑 A simple Traefik ForwardAuth server for HTTP Basic SSO

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to trauth

Authelia
The Single Sign-On Multi-Factor portal for web apps
Stars: ✭ 11,094 (+36880%)
Mutual labels:  sso, traefik
traefik-proxy
One-step (secure) configuration for Traefik edge router.
Stars: ✭ 20 (-33.33%)
Mutual labels:  sso, traefik
Ssowat
A simple SSO for NGINX, written in Lua
Stars: ✭ 190 (+533.33%)
Mutual labels:  sso
infrastructure
Flux based GitOps repository for my home lab infrastructure.
Stars: ✭ 14 (-53.33%)
Mutual labels:  traefik
ceil
Helmut Hoffer von Ankershoffen experimenting with auto-provisioned RPi cluster running K8S on bare-metal
Stars: ✭ 42 (+40%)
Mutual labels:  traefik
Demo Project
存放学习过程中的demo项目,别光fork,顺便点下⭐哦
Stars: ✭ 198 (+560%)
Mutual labels:  sso
token-cli
Command line utility for interacting with OAuth2 infrastructure to generate tokens
Stars: ✭ 19 (-36.67%)
Mutual labels:  sso
Nginx Http Shibboleth
Shibboleth auth request module for nginx
Stars: ✭ 168 (+460%)
Mutual labels:  sso
nkchat
A web-based chat application using modern technologies such as React, GraphQL and styled-components
Stars: ✭ 20 (-33.33%)
Mutual labels:  traefik
docker-nextcloud
Nextcloud Docker image
Stars: ✭ 209 (+596.67%)
Mutual labels:  traefik
LYM.NetCore
IdentityServer4+EFCore
Stars: ✭ 17 (-43.33%)
Mutual labels:  sso
Moviepark
A Nuxt universal app with an Adonis 5 api server using the TMDb API for its movie catalog.
Stars: ✭ 32 (+6.67%)
Mutual labels:  traefik
Arkid
一账通是一款开源的统一身份认证授权管理解决方案,支持多种标准协议(LDAP, OAuth2, SAML, OpenID),细粒度权限控制,完整的WEB管理功能,钉钉、企业微信集成等
Stars: ✭ 217 (+623.33%)
Mutual labels:  sso
nsspi
A C# / .Net interface to the Win32 SSPI authentication API
Stars: ✭ 60 (+100%)
Mutual labels:  sso
Nginx Sso
SSO authentication provider for the auth_request nginx module
Stars: ✭ 195 (+550%)
Mutual labels:  sso
Multitenancy-Microservice-FederatedIdentity-Example
Multitenancy Federated Identity Example ASP.NET MVC C#
Stars: ✭ 33 (+10%)
Mutual labels:  sso
Home
Welcome to Janssen: the world's fastest cloud native identity and access management platform
Stars: ✭ 176 (+486.67%)
Mutual labels:  sso
Cas sso record
CAS实现SSO单点登录项目示例(基本认证流程,代理认证流程,Iframe实现SSO,Restful API实现SSO,JWT认证流程等等)
Stars: ✭ 242 (+706.67%)
Mutual labels:  sso
traefik-workshop
Getting started with Traefik on Kubernetes. A few exercises that help you to start the journey with Traefik Proxy.
Stars: ✭ 83 (+176.67%)
Mutual labels:  traefik
FabricSSO
A SSO(Single Sign On) platform with Microservices architecture built on IdentityServer 4
Stars: ✭ 14 (-53.33%)
Mutual labels:  sso

trauth

Docker build & Push

A simple ForwardAuth service for Traefik.

Unlike other ForwardAuth projects that enable neat OpenID / OAuth flows, trauth reads a simple htpasswd file as a credentials database, prompting via HTTP basic auth. This is perfect for private, isolated services served using Traefik needing a simple SSO solution.

usage

An example docker-compose.yml is included to show how to get it up and running. It assumes that htpass is mounted externally.

Of course, you could compile from source or download from the releases page and run outside of docker too.

setup

Depending on your setup, a few environment variables must be configured. For a docker-compose setup you would need TRAUTH_DOMAIN and TRAUTH_PASSWORD_FILE_LOCATION at the very least.

environment:
    - TRAUTH_DOMAIN=yourdomain.local
    - TRAUTH_PASSWORD_FILE_LOCATION=/config/htpass

Other variables also exist. Those are:

  • TRAUTH_SESSION_KEY - The authentication key used to validate cookie values. This value must be a 32 character, random string. Not setting this value (or using a value of the wrong size), will result in trauth generating a random key to use. A random value means everytime trauth starts, you'd need to re-authenticate. (Defaults to random value)
  • TRAUTH_SERVER_PORT - The port the server should listen on. (Defaults to 8080)
  • TRAUTH_DOMAIN - The domain trauth should set the sso cookie for. This is usually scoped for the parent domain.
  • TRAUTH_REALM - The "realm" value to use. (Defaults to "Restricted")
  • TRAUTH_COOKIE_PATH - The path used for the sso cookie. (Defaults to /)
  • TRAUTH_COOKIE_NAME - The name of the sso cookie. (Defaults to trauth)
  • TRAUTH_COOKIE_SECURE - Set the Secure flag on the trauth cookie. (Defaults to false)
  • TRAUTH_COOKIE_HTTPONLY - Set the HttpOnly flag on the trauth cookie. (Defaults to false)
  • TRAUTH_PASSWORD_FILE_LOCATION - The location for the htpasswd file. (Defaults to ./htpass)

using with Traefik 2

To use it in Traefik you need to define a new middleware telling Traefik where the auth server is. For example:

- "traefik.http.middlewares.trauth.forwardauth.address=http://trauth:8080/"

Next, you simply need to add the middleware label to web services that should make use of it. For example:

- "traefik.http.routers.netdata.middlewares=trauth"

adding users

trauth uses a basic Apache htpasswd file. For detailed usage of htpasswd, please see this guide.

To add a new user in a new htpass file, using the Bcrypt hashing algorithm, run:

htpasswd -Bc htpass username1

To add a new user to an existing htpass file, run:

htpasswd -B htpass username2

example run

Below is example output from the docker-compse logs for the trauth service. Here you can see the service booted, and my authentication attempt logged when browsing to a protected service.

trauth     | 2021/08/18 05:56:40 booting trauth 1.3.1
trauth     | 2021/08/18 05:56:40 configuration information
trauth     | 2021/08/18 05:56:40 port: 8080; domain: internal.mydomain.local; cookiePath: /; cookieName: trauth; passfile: /config/htpass
trauth     | 2021/08/18 05:56:40 initializing cookie keys and options
trauth     | 2021/08/18 05:56:40 reading password file at /config/htpass
trauth     | 2021/08/18 05:56:40 starting http service, authenticating for domain internal.mydomain.local on port 8080
trauth     | 2021/08/18 06:04:22 unable to get session with error: securecookie: the value is not valid
trauth     | 2021/08/18 06:04:22 no basic auth creds provided from 192.168.0.10
trauth     | 2021/08/18 06:04:43 unable to get session with error: securecookie: the value is not valid
trauth     | 2021/08/18 06:04:43 authenticated leonjza from 192.168.0.10 using basic auth, redirecting to https://service.internal.mydomain.local:443/
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].