Giter Site home page Giter Site logo

salesforce / pam_oidc Goto Github PK

View Code? Open in Web Editor NEW
49.0 11.0 6.0 40 KB

pam_oidc authenticates users with an OpenID Connect (OIDC) token.

License: BSD 3-Clause "New" or "Revised" License

Makefile 1.54% Go 91.54% C 6.08% Shell 0.84%
pam-module pam oidc openid-connect

pam_oidc's Introduction

pam_oidc

pam_oidc authenticates users with an OpenID Connect (OIDC) token.

Linux-PAM extensions are used, so currently the module only supports Linux. Contributions to support other operating systems are welcomed.

Example Usage

In /etc/pam.d/service:

auth required pam_oidc.so <options>

Example for Google:

auth required pam_oidc.so issuer=https://accounts.google.com aud=12345-v12345.apps.googleusercontent.com

Options

issuer

Required.

The issuer URL. The OpenID configuration should be available at issuer/.well-known/openid-configuration

aud

Required.

The audience value to expect. Tokens signed by the issuer but for a different audience will be rejected. This prevents tokens issued for a different purpose from being used for authentication.

user_template

Default: {{.Subject}}

A Go text/template that, when rendered with the JWT/OIDC claims, provides the expected username.

For example, {{.Subject}} would mean that users are expected to authenticate with the JWT sub claim as their username.

The trimPrefix and trimSuffix functions are available. For example {{.Subject | trimSuffix "@example.com"}} would mean a user whose token subject is [email protected] would authenticate as jdoe.

groups_claim_key

Default: groups

The name of the key within the token claims that specifies which groups a user is a member of.

If the token uses a key other than groups (e.g., {"roles":["a", "b", "c"]}), specifies groups_claim_key=roles.

authorized_groups

Default: (no value)

If specified, a comma-separated list of groups required for authentication to pass. A user must be a member of at least one of the groups in the list, if specified.

require_acr

Default: (no value)

If specified, the required value of the acr claim in the token for authentication to pass.

require_acrs

Default: (no value)

If specified, a comma-separated list of acrs one of which must match the acr claim in the token for authentication to pass.

http_proxy

Default: (no value)

If specified, an HTTP proxy used to connect to the issuer to discover OpenID Connect parameters.

Local Testing

A Vagrant VM is available for local testing:

vagrant up

By default, PAM is setup with Percona Server to accept OpenID Connect tokens from the Google Cloud SDK using email address as the username:

gcloud auth login
gcloud auth print-identity-token

Within the VM, create a database user to authenticate using PAM:

vagrant ssh

# within the Vagrant VM
sudo mysql -u root

# within the MySQL monitor
CREATE USER '[email protected]'@'%' IDENTIFIED WITH auth_pam;

With the token from gcloud auth print-identity-token, attempt to login:

TOKEN="..." # paste from `gcloud auth print-identity-token`

# The token must be specified using --password=... because it is too long for
# MySQL to accept interactively
mysql --user="[email protected]" --password="$TOKEN"

To debug failures, check the auth logs:

sudo tail -f /var/log/auth.log

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.