Git Product home page Git Product logo

louketo-proxy's People

Contributors

antmanler avatar aszc avatar chrisns avatar codepainters avatar fredbi avatar gambol99 avatar jangaraj avatar jits avatar johannesdienstdbsystel avatar johanneslanger avatar leoluk avatar lionelnicolas avatar livetocode avatar msuret avatar nl5887 avatar noseka1 avatar nuru avatar pgagnon avatar pjeby avatar pskopek avatar robbiemcmichael avatar rrmoelker avatar rvion avatar schen1 avatar snowjet avatar stang avatar stefan-improbable avatar stianst avatar timgent avatar vad1mo 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  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

louketo-proxy's Issues

Allow tokens from different clients

I want to allow tokens from different clients. How can I do that? I tried the following:

match-claims:
  aud: (.*?)

I am getting the log:

INFO[0000] the token must container the claim: aud, required: (.*?) 

After calling the endpoint with an token created by another client-id, I am getting:

ERRO[0040] access token failed verification              client_ip=w.x.y.z.  error=oidc: JWT claims invalid: invalid claims, 'aud' claim and 'client_id' do not match, aud=<otherClientId>, client_id=<configuredClientId>

He still claims, that the aud must be <configuredClientId>

Support Identity provider with self-signed certificate

@gambol99 First of all thanks for your great work on this project :)

In our test environment we have a keycloak installation which has a self signed certificate. The proxy fails to start when retrieving the discovery URL:

_time="2016-11-07T10:10:51Z" level=warning msg="failed to get provider configuration from discovery url: https://<keycloak-url>/auth/realms/<realm>, Get https://<keycloak-url>/auth/realms/<realm>/.well-known/openid-configuration: x509: certificate signed by unknown authority"

I would suggest to add a config option --skip-openid-provider-tls-verify to allow a self-signed certs for test environments!

If you want I can try and contribute

Option to allow cookie to be sent over insecure connections

Newest version of keycloak proxy doesn't allow the cookie to be sent over insecure connections. This is good as default behaviour but it would be good to be able to override this setting as when setting up things in dev it is annoying to need to set up TLS before setting up keycloak proxy

url query string state

the auhorization url appears to truncate the state= so urls with query string aren't getting fully redirected i.e.

state=/api?dksdj&jdksjds => state=/api?

Developer guide

Could do with a section on building locally and contributing. Sure I am doing something wrong but after running:

go get
go install
go build
docker build .
docker run xxxxx

I get:

docker: Error response from daemon: Container command '/opt/keycloak-proxy' not found or does not exist..

Docker image

Hi,

Is there a docker image somewhere ?
I can see the Dockerfile in the repo, but couldn't find the image on the hub.

Thanks !

cookie-domain bug

Currently the cookie-domain flag is set as a StringSlice. Therefore if you pass --cookie-domain foo.com on startup, dropping a cookie fails with:

net/http: invalid Cookie.Domain "[foo.com]"; dropping domain attribute

Using a config file works correctly.

stuck in an infinite loop

with keycloak-proxy compiled from master, I got stuck in a infinite redirection cycle
(tested with keycloak 1.9.1.Final)

 keycloak-prooxy-mater \
    --discovery-url=https://auth.rvion.fr/auth/realms/master/.well-known/openid-configuration \
    --listen=:3000 \
    --client-id=unprotectedservice \
    --upstream-url=http://unprotectedservice:8080 \
    --redirection-url=http://keycloakproxy:3000 \
    --client-secret=secret \
    --resource="uri=/" \
    --verbose=true

when I access http://keycloakproxy:3000, I'm redirected to keycloak. Then, I login on keycloak, and I'm redirected back to http://keycloakproxy:3000/oauth/callback?xxx. But then, it enter in a redirection loop, and chrome shows me an error message

I see in the logs:

ERRO[0016] failed to get session, redirecting for authorization  error=authentication session not found
INFO[0016] incoming authorization request from client address: 37.161.218.27:41982  access_type= client_ip=37.161.218.27:41982
ERRO[0019] failed to get session, redirecting for authorization  error=authentication session not found
INFO[0019] incoming authorization request from client address: 37.161.218.27:41982  access_type= client_ip=37.161.218.27:41982
ERRO[0057] failed to get session, redirecting for authorization  error=authentication session not found
INFO[0057] incoming authorization request from client address: 37.161.218.27:41982  access_type= client_ip=37.161.218.27:41982
INFO[0058] issuing a new access token for user, email: [email protected]  duration=58.995194544s [email protected] expires=07 May 16 20:55 +0000 idle=0
ERRO[0058] failed to get session, redirecting for authorization  error=authentication session not found
INFO[0058] incoming authorization request from client address: 37.161.218.27:41982  access_type= client_ip=37.161.218.27:41982
INFO[0058] issuing a new access token for user, email: [email protected]  duration=59.588883831s [email protected] expires=07 May 16 20:55 +0000 idle=0
ERRO[0058] failed to get session, redirecting for authorization  error=authentication session not found
INFO[0058] incoming authorization request from client address: 37.161.218.27:41982  access_type= client_ip=37.161.218.27:41982
INFO[0058] issuing a new access token for user, email: [email protected]  duration=59.290884249s [email protected] expires=07 May 16 20:55 +0000 idle=0
ERRO[0058] failed to get session, redirecting for authorization  error=authentication session not found
INFO[0058] incoming authorization request from client address: 37.161.218.27:41982  access_type= client_ip=37.161.218.27:41982
INFO[0059] issuing a new access token for user, email: [email protected]  duration=59.92635992s [email protected] expires=07 May 16 20:55 +0000 idle=0
ERRO[0059] failed to get session, redirecting for authorization  error=authentication session not found
...

Container runs as root?

From the dockerfile looks like this runs as root currently. Could this be updated to not run as root?

Cross compile and add to releases

Hey,
We've got a user who can't use docker, and is on windows
Could you therefore also have some cross compiles to different archs and have travis put them in the release artifacts?
I need something like:

GOOS=windows GOARCH=amd64 ./bin/godep go build -a -o bin/keycloak-proxy-amd64.exe
GOOS=windows GOARCH=386 ./bin/godep go build -a -o bin/keycloak-proxy-i386.exe

buggy behaviour on ssl handshake fail with cloudflare

in my setup, ssl for both stuff.rvion.fr and keycloak-proxy.rvion are provided by cloudflare
image

when I run keycloak-proxy with

    --discovery-url=https://auth.rvion.fr/auth/realms/master/.well-known/openid-configuration \
    --listen=:8443 \
    --client-id=stuff \
    --upstream-url=https://stuff.rvion.fr/ \
    --redirection-url=https://keycloak-proxy.rvion.fr:8443/ \
    --client-secret=plop \
    --resource="uri=/" \
    --secure-cookie=false \
    --encryption-key=AgXa7xRcoClDEU0ZDSH4X0XhL5Qy2Z2j \
    --enable-refresh-tokens=true \
    --verbose=true

and when I contact https://keycloak-proxy.rvion.fr:8443/,

cloudflare error page "ssl handshake fail" appears and refresh every ~0.5 seconds

keycloak-proxy log says:

nothing

when session expired without --enable-refresh-tokens, restarting the proxy with --enable-refresh-tokens don't refresh tokens

when session expired without --enable-refresh-tokens, restarting the proxy with --enable-refresh-tokens don't refresh tokens and user has to delete cookies (or logout?).

indeed, after the restart with --enable-refresh-tokens, logs shows:

ERRO[0024] unable to find a refresh token for the client: [email protected]  [email protected] error=authentication session not found
INFO[0024] incoming authorization request from client address: 37.161.206.246:63591  access_type= client_ip=37.161.206.246:63591

until I manually remove cookies

command options need to merge

At present maps and arrays when specified on the command line do not merge into any possible options from a config file. i.e you wanna add a quick --add-claims=, at present this would overwrite the ones in the config file ... Just need to append and merge maps

Basic Auth support

It would be great, if it would be possible to authenticate a upstream server with basic auth.

--upstream-username=foobar
--upstream-password=supersecret

I've tried --headers but it's failing:

--headers "authorization=Basic <redacted>"
[error] invalid tag 'authorization=Basic <redacted>=' should be key=pair

keycloak-proxy hangs when misconfigured

  • I configured keycloak-proxy with the wrong config name: "upstream" instead of "upstream-url
  • I ran the keycloak-proxy on a kubernetes cluster and it started up fine
  • When I hit it with a request it crashes (crash look backoff)
  • Nothing is logged

Few changes would be good:

  • If mandatory configuration is missing the proxy shouldn't start and should log out an appropriate error
  • The the proxy has issues when running it should log them out

JWE support

Hey,

First of all great work on the keycloak proxy. Looks pretty good!

A current use case we have is supporting JWE as we do not want to send plain JWTs to the clients in every case. Keycloak currently does not support this. What are your thoughts on configurable JWE support within the proxy. The scenario is basically to encrypt the tokens before being sent to the clients.

login handler only called locally

Hi,

I was just looking at the latest changes. The localhost origin requirement for the login handler caught my eye. What is the motivation behind it? Do you expect something else to terminate the client connection and proxy locally to the keycloak-proxy. Maybe it makes sense to be explained in more details in the docs?

forwarding agent support

Would be nice to have forwarding agent support .. i.e. the proxy loads it logs in, requesting an access token. A application/micro-service seated behind and can proxy through service with the proxy adding the authorization header into the outgoing requests .. We could that verify resource access on the other end.

Login endpoint requires url params for username and password

Main issue with this is that nginx logs will include the full url including the query string, and don't want username and password to be logged.

Instead suggest having these as part of the body of the post request in the same way that the keycloak server does typically (x-www-form-urlencoded).

endpoints

  • provide an endpoint for to display the current sessions access token
  • provide an endpoint to test if a session is expired

unix socket listen

We can currently proxy forward to a unix socket, it's a minor change to permit listening on it

[proposal] extend ressource access patterns

while reading #80, I had an idea about extending ressource access declarations

As of now, access policy is declared with a coma separated list of roles names, (, meaning OR)

--resource='uri:/logs/project1|roles=project1,project2'

what about replacing , with [+, *, (, )]

--resource='uri:/logs/project1|roles=r1+r2*r3+r4'                # r1 OR (r2 and r3) OR r4
--resource='uri:/logs/project1|roles=r1+r2*(r3+r4+(r5*r6))'    

where (+ and * come from logic notation)

  • + being OR
  • * being AND
  • ( and ) allow to nest expressions.

the behaviour is simple and is fully descibed, and it seems powerfull enough to support lots of usage cases.

note: I thought about + and * to avoid conflicts with | current usage and & meaning in URIs.
(as shown in the example given in #80, avoiding conflict with | and & is important so that

--resource='uri:/logs/%roles%|roles=test1+test2*(test3+test4)

correctly match

uri:/logs/test1
uri:/logs/test2*test3
uri:/logs/test2*test4

)


if you like the idea, how about also adding a NOT (!) operator so one can use roles to temporarilly ban people, etc.

--resource='uri:/logs/project1|roles=!banned

Feature request: don't always redirect

Please could there be a configuration setting that would prevent the proxy redirecting on no-auth and just return valid HTTP status code (401 Unauthorized and 403 Forbidden)?
Perhaps optionally combined with when the request Content-Type: application/json (or maybe even wildcarded to application/*?

This is particularly useful for APIs that javascript access since the browser won't permit the cross origin request to the keycloak service (without whitelisting all potential clients there), so it allows a javascript front end to better handle the status and direct the user to authenticate.

[proposal] resource syntax normalisation (eg. normalizing "uri:" and "roles=")

as of now, ressource syntax read as

--resource='uri:/logs|roles=test1

how about unifying the format to something like

--resource='uri=/logs|roles=test1|name=rvion|after=2015-03-21T00:18:56Z'

documentation would be much easier, and you open gates to feature expansion in an easy way.
I can imagine the resourceflag becoming resources (with an s) along some documentation saying

ressources are defined like this:

expr def
resources ruleset [ ; ruleset ]
ruleset `match [
match check = values

checks can be

1. roles check

roles= explanation
rolename any role name you want to grant access
expr1 + expr2 match when either expr1 OR expr2 match
expr1 * expr2 match when both expr1 AND expr2 match
! expr negate expression
(expr) allow define sub expressions
  • provides %roles% to be used in following rulesets

example:
...

2.uri check

uri= explanation
segment [ / segment]
* * match one segment
** ** match any number of segment

provides %url%
provides %last-segment% to following rulesets


๐Ÿ‘ each ruleset would provide template for next ruleset, so implementation would be very easy, with no dependency resolution to do. if you want to use %role% in uri, or in whatever else, you just have to write your resource with ruleset in the correct order for keycloak-proxy to resolve them.

๐Ÿ‘ it becomes very easy to write things like

--resources="roles=user"

when you only want to take roles into account.

no more

--resources="uri:/|roles=user""

when uri doesn't matter.

๐Ÿ‘ yaml implementation should be very straighforward too as there is a direct encoding.

allow the upstream "Authorization" header to not be sent

I am wanting to use keycloak-proxy with grafana proxy auth module.

I have run into an issue where grafana detects the Authorization header and attempts to verify it as a grafana api key, and therefore throws an error.

One option could be to get grafana to disable api key checking, but I thought it may be simple to do it in here ?

url tokenization

Would be nice to permit tokenizing the url for role extraction .. i.e. instead of using

--resource='uri:/logs/project1|roles=project1'
--resource='uri:/logs/project2|roles=project2'

Its preferable to use

--resource='uri:/logs/%role%'

proxy protocol

i've been meaning to do this for a well but adding proxy protocol is a desirable

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.