Giter Club home page Giter Club logo

id-sea's Introduction

ID Sea

An OpenID Connect (OIDC) helper, designed to add SSO to your favourite reverse proxy. ID Sea makes it simple to require login for your apps and restrict certain apps to certain users.

Features include:

  • Role-based ACLs
  • Email allow listing
  • Role mapping for when your OIDC provider doesn't support roles/groups

Configuring ID Sea

Step 1. Configure your OIDC provider

Configuration will vary depending on your provider, however basic options are outlined below:

[oidc]
# Client ID and Secret obtained from provider
client_id="id-sea"
client_secret="changeme"
issuer_url="https://keycloak.lan/realms/home"

# This should be the URL you make ID Sea accessible from. /callback is added automatically if ommited.
redirect_url="http://localhost:8080/callback"

There are some additional OIDC configuration options, detailed below:

# If your OIDC provider allows you to assign roles/groups to users, you can instruct ID Sea which parameter will contain the list of roles/groups.
# Default is "groups"
role_claim_name="roles"

# By default, ID Sea will request the following scopes: "openid", "email", "profile"
# If you wish to request additional scopes from your OIDC provider, perhaps to gather role/group data, add them here:
additional_scopes=["microprofile-jwt"]

# When ID Sea starts, it pulls OIDC configuration from the issuer url.
# However, in some configurations, you may wish to pull the OIDC configuration from a separate URL.
# For example, if you have a Docker network, where the ID Sea container can reach http://keycloak/, but the public issuer URL is https://keycloak.lan/, that is where this parameter is useful
issuer_discovery_override_url="http://keycloak/realms/home"

Step 2. Configuring cookie/session settings

To identify users across requests, ID Sea currently uses JWTs stored in a cookie. The available options are shown with their defaults below:

[session.cookie]
secret="" # Make sure you set this to a long, random string!
domain="" # Make sure to set this to the domain your authenticated apps are served from. For example, for auth.server.lan, you may wish to set `domain` to "server.lan"
name="_auth_proxy_token"
secure=true
max_age=86400 # Session lifetime in seconds. Defaults to 24 hours

Redis support is planned, with an opaque session ID cookie instead of a JWT.

Step 3. Configuring TLS certificates (Docker)

To reduce the size of the container and to reduce the ability of an attacker to live off the land, the container only has the id-sea binary. This will need to be provided a list of trusted CA certificates, which is farily easy to do. Just mount them in via a docker volume.

  id-sea:
    image: ghcr.io/lachlan2k/id-sea:latest
    container_name: idsea
    restart: always
    volumes:
       - /etc/ssl/certs/ca-bundle.crt:/etc/ssl/certs/ca-certificates.crt:ro

Step 4. Configuring access control

Option A) Give all users access

If you want all authenticated users to be given access, simply set:

[access_control]
allow_all_emails=true
disable_acl_rules=true

Option B) Allow list users

If you only want a specific list of users to have access, you can supply an allow list. This is useful if you want to use a public OIDC provider, like Google, Microsoft of GitHub, but only want your users to have access:

[access_control]
email_allow_list=["[email protected]", "[email protected]", "*[email protected]"]
allow_all_emails=false
disable_acl_rules=true

Option C) Require user role

If you run your own OIDC provider, or have your own tenancy with full control of all users, you may wish to provide access based on a group or role. For example, you can require a mandatory role for all users:

[access_control]
mandatory_role="app-access"

Option D) Advanced ACLs

ID Sea allows you to create advanced access control lists (ACLs), so that certain users can only access certain hosts.

First, you must sort your hosts into "host groups", like so:

[access_control.host_groups]

admin = [ "*.server.lan" ]

tools = [
    "wiki.server.lan",
    "gitlab.server.lan"
]

media = [
    "plex.server.lan",
    "photos.server.lan"
]

Then, you can create rules, governing which roles can access which resources

[access_control.acls]
family-user = ["media"]
dev-user = ["media", "tools"]
admin-user = ["admin"]

Note on wildcard matchers

You may have noticed the use of wildcards throughout the configuration. For example, *.server.lan, or *[email protected]. ID Sea allows you to use wildcards in certain scenarios. Wildcard matching is very rudimentary -- a single wildcard can be placed at the start of the string and nowhere else.

Essentially, "wildcard" matching is only useful for matching suffixes. Wildcard matching is enabled for the following options:

  • Hosts names within a host_groups entry
  • redirect_allow_list
  • email_allow_list
  • mandatory_role

Step 5. Configure your reverse proxy

Coming soon

id-sea's People

Contributors

lachlan2k avatar jsmith-aura 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.