Git Product home page Git Product logo

evry / docker-oidc-proxy Goto Github PK

View Code? Open in Web Editor NEW
120.0 8.0 59.0 515 KB

Docker Image built on Alpine Linux for secure OpenID Connect (OIDC) proxy authentication

Home Page: https://hub.docker.com/r/evry/oidc-proxy/

License: MIT License

Shell 23.39% Lua 39.42% Dockerfile 37.19%
openid-client cookie-session docker docker-image alpine alpine-linux nginx nginx-proxy oidc oidc-single-sign-on

docker-oidc-proxy's Introduction

evry/oidc-proxy Image Layers

Docker Image for OpenID Connect proxy authentication. Useful for putting services behind Keycloak and other OpenID Connect authentication.

This is Image used Nginx for proxying request and OpenResty with the lua-resty-openidc library to handle OpenID Connect authentication.

"Docker OIDC Proxy overview"

Supported tags and respective Dockerfile links

How to use this image

This proxy is controlled through environment variables, so there is no need to mess with any configuration files unless you want to of course. The following environment variables is used in this image:

  • OID_SESSION_SECRET: secret value for cookie sessions

  • OID_SESSION_CHECK_SSI: check SSI or not (on or off)

  • OID_SESSION_NAME: cookie session name

  • OID_REDIRECT_PATH: Redirect path after authentication

  • OID_DISCOVERY: OpenID provider well-known discovery URL

  • OID_CLIENT_ID: OpenID Client ID

  • OID_CLIENT_SECRET: OpenID Client Secret

  • OID_USE_PKCE: Enable PKCE (true or false, default is false)

  • OIDC_AUTH_METHOD: OpenID Connect authentication method (client_secret_basic or client_secret_post)

  • OIDC_RENEW_ACCESS_TOKEN_ON_EXPIRY: Enable silent renew of access token (true or false)

  • PROXY_HOST: Host name of the service to proxy

  • PROXY_PORT: Port of the service to proxy

  • PROXY_PROTOCOL: Protocol to the service to proxy (http or https)

  • ADD_HOST_HEADER: pass the proxy host header downstream (true or false)

docker run \
  -e OID_DISCOVERY=https://my-auth-server/auth \
  -e OID_CLIENT_ID=my-client \
  -e OID_CLIENT_SECRET=my-secret \
  -e PROXY_HOST=my-service \
  -e PROXY_PORT=80 \
  -e PROXY_PROTOCOL=http \
  -p 80:80 \
  evry/oidc-proxy

License

This Docker image is licensed under the MIT License.

Software contained in this image is licensed under the following:

Supported Docker versions

This image is officially supported on Docker version 1.12.

Support for older versions (down to 1.0) is provided on a best-effort basis.

User Feedback

Documentation

Issues

If you have any problems with or questions about this image, please contact us through a GitHub issue.

Contributing

You are invited to contribute new features, fixes, or updates, large or small; we are always thrilled to receive pull requests, and do our best to process them as fast as we can.

Before you start to code, we recommend discussing your plans through a GitHub issue, especially for more ambitious contributions. This gives other contributors a chance to point you in the right direction, give you feedback on your design, and help you find out if someone else is working on the same thing.

docker-oidc-proxy's People

Contributors

bjorges avatar davidkarlsen avatar gregnr avatar r0wi avatar starefossen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-oidc-proxy's Issues

WSS Support

Hello

I see that out of the box your nginx configuration doesn't handle websocket proxy
Missing 2 directives :

proxy_set_header Connection        "Upgrade";
proxy_set_header Upgrade           $http_upgrade;

It can be good to be able to use it (OR) :

  • By default / for all, updating directives here
  • Using dedicated env var like ENABLE_WSS_SUPPORT or so
  • ...

Thanks for the work !

Regards

There was an error while logging in: request to the redirect_uri path but there's no session state found

I was looking for a openid connect op reverse proxy to authenticat with Azure AD and sit in openshift in front of an application server assuming I get it all to run and run not as root.
Initially I had the problem noted above on the checking issuer.
I tried the latest release of the lua-resty files listed in the docker file, trying all the master releases and got the error
"There was an error while logging in: request to the redirect_uri path but there's no session state found"
It looks like the error in
zmartzone/lua-resty-openidc#213
The error is raised line 1324 of openidc.lua as the session isn't present from the error called.
I'm grateful for any thoughts. I tried turning debug on in the dockerfile and rebuilding, but maybe I need to do that in the openresty docker to get that to work to provide more information.

Releases on github and docker hub

Hey,

I used this repo to successfully place a proxy in of the kubernetes dashboard. I only have one little problem. At this moment this repo does not have "official" releases or versions. The image deployed on docker hub is tagged as latest. I would like for it to have a version number so I can use without worrying that a new version will break my setup.

Stijn De Haes

Reverse proxy question

I want to know if this could be used to act as a reverse proxy that.

Essentially I have a lot of services that are not capable of doing the OIDC flow, but have an API backend that supports OIDC and would like to use it.

I was wondering if I could use this as a reverse proxy to allow a another container access to an OIDC protected cloud API.

Thanks!

Site freezes after few minutes of inactiveness

Hey,
we are a ReactJS application with OICD (same as your example with your Nginx image), and we experience the following issue:

A user who hasn't been active for few hours and attempts to keep working gets errors until the site is hard refreshed.

By watching the Network tab in the developer tools we get CORS error with the our Authorization Server for some reason.
Moreover, this behavior started after we moved to OIDC authentication (we used Kerberos before).

In addition, in our environment each user is a member of many security groups, that fact causes the ID token and the Access token to be very large, therefore our session cookie is extremely large.
Are there any solutions to this problem?
Thank you!

Discovery url handshake failed

When browsing to http://<ip>:<port>/ I get
There was an error while logging in: accessing discovery url (https://example.net/auth/realms/master/.well-known/openid-configuration) failed: handshake failed

When attaching to the docker console, if I do curl https://example.net I get
curl: (35) error:1400442E:SSL routines:CONNECT_CR_SRVR_HELLO:tlsv1 alert protocol version

I use nginx as a reverse proxy. This is my nginx config. Other docker containers or browsers have no problems with retrieving this url.

    server {
        listen  443 ssl;
        server_name  example.net;
        ssl_certificate     <location to cert>;
        ssl_certificate_key <location to cert>;
        ssl_protocols TLSv1.3;
        ssl_prefer_server_ciphers off;
        root /usr/share/nginx/html;
        
        location / {
            proxy_pass http://<ipofservice>:<portofservice>;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
    }

SSL error - self signed certs

openidc.lua:486: failed: 18: self signed certificate, client: 172.24.0.1, server: _, request: "GET / HTTP/1.1", host: "localhost:9099"

version: '3'

services:
  fathom:
    image: usefathom/fathom:latest
    command: ./fathom --config=/config/.env server
    depends_on:
      - postgres_fathom
    volumes:
      - ./fathom.env:/config/.env
    ports:
      - 8446:8080

  postgres_fathom:
    image: postgres:latest
    volumes:
      - ./data:/var/lib/postgresql/data
      - db_data:/var/lib/postgresql/data
    environment:
      PGDATA: /var/lib/postgresql/data/fathom
      POSTGRES_DB: ${POSTGRES_DB}
      POSTGRES_USER: ${POSTGRES_USER}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}

  nginx_openid:
    image: "evry/oidc-proxy"
    environment: 
      - OID_DISCOVERY=https://localhost:8444/auth/realms/master/protocol/openid-connect/auth
      - OID_CLIENT_ID=nginx
      - OID_CLIENT_SECRET=0fd32218-8e31-45ac-8b53-d6b523ab99b6
      - PROXY_HOST=fathom
      - PROXY_PORT=8446
      - PROXY_PROTOCOL=https
      - OID_SESSION_CHECK_SSI=off
      - OID_SESSION_NAME=oidc_auth
      - OID_REDIRECT_PATH=/redirect_uri
    ports:
     - "9099:80"

OIDCCryptoPassphrase

I'm currently using Apache with mod_auth_openidc, and I specify OIDCCryptoPassphrase. In order to switch to this proxy, wouldn't I also have to specify this? I don't see a way to do it?

Persistent keycloak

The keycloak container isn't persistent...
The keycloak client secret is known only after creating the client, but when the docker-compose file is running you can't change the env vars of the proxy container... once you change the environment variable you need to restart the compose file, which restarts keycloak and resets the client.

What I did is i added a persistent postgres container & set keycloak to use the postgres db.

README

Hi,
the readme has a typo of the word protocol, however it is spelt "protofol".
I tried to submit a PR to change this, however the branch permissions did not let me.
thanks

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.