Commit graph

3224 commits

Author SHA1 Message Date
Caleb Doxsey
eef4c6f2c0
kubernetes docs (#1087)
* wip

* wip

* remove dead code

* add logging about errors for caching credentials

* rename subcommand

* add kubernetes docs
2020-07-16 12:15:41 -06:00
Caleb Doxsey
5df10d1539
pomerium-cli k8s exec-credential (#1073)
* wip

* wip

* remove dead code

* add logging about errors for caching credentials

* rename subcommand
2020-07-16 11:40:43 -06:00
Cuong Manh Le
ee1f9093ee
internal/directory: use both id and name for group (#1086)
Fixes #1085
2020-07-17 00:15:11 +07:00
Caleb Doxsey
96424dac0f
implement google cloud serverless authentication (#1080)
* add google cloud serverless support

* force ipv4 for google cloud serverless

* disable long line linting

* fix destination hostname

* add test

* add support for service accounts

* fix utc time in test
2020-07-16 08:25:14 -06:00
Travis Groth
58810cdb52
internal/directory/google: return both group e-mail and id (#1083)
* internal/directory/google: return both group e-mail and id
2020-07-16 07:19:30 -04:00
Cuong Manh Le
8e56db7830
docs/docs: add changelog for #1055 (#1084) 2020-07-16 09:57:25 +07:00
Dmitri Farkov
253addcad6
config: change certificates config key parsing to attempt Base64 decoding first. (#1055) 2020-07-15 21:15:57 +07:00
Cuong Manh Le
a5db94434d
pkg/storage: add package docs (#1078) 2020-07-15 10:30:37 +07:00
Travis Groth
8ebf06dd71
Force redirect scheme to https (#1075) 2020-07-14 23:11:22 -04:00
Cuong Manh Le
2f84dd2aff
Add storage backend interface (#1072)
* pkg: add storage package

Which contains storage.Backend interface to initial support for multiple
backend storage.

* pkg/storage: add inmemory storage

* internal/databroker: use storage.Backend interface

Instead of implementing multiple databroker server implementation for
each kind of storage backend, we use only one databroker server
implementation, which is supported multiple storage backends, which
satisfy storage.Backend interface.
2020-07-15 09:42:01 +07:00
Caleb Doxsey
a70254ab76
kubernetes apiserver integration (#1063)
* sessions: support bearer tokens in authorization

* wip

* remove dead code

* refactor signed jwt code

* use function

* update per comments

* fix test
2020-07-14 08:33:24 -06:00
Caleb Doxsey
5f6a67e6eb
use custom binary for arm64 linux release (#1065) 2020-07-14 07:59:26 -06:00
Renovate Bot
645f0a2ff8 chore(deps): update module google.golang.org/api to v0.29.0 2020-07-14 00:08:55 +00:00
Cuong Manh Le
58fb6ea3c4
proxy: fix invalid session after logout in forward auth mode (#1062)
Currently, authorize service does handle unauthenticated request in
forward auth mode, and return status 401.

But proxy has not handled the response yet, and always returns 403 for
both unauthenticated and unauthorized request. That breaks session
handling in forward auth mode. That said, if user was signed out, or for
any reason, authorize service return 401 status, proxy does not redirect
user to re-signin, but always return 403.

To fix it, proxy is changed to handle envoy check response in more
details, to distinguish between 401 and 403 status.

Thanks to @simbaja for rasing the problem and come up with original fix.

Fixes #1014
Fixes #858
2020-07-14 01:07:49 +07:00
Renovate Bot
7437a4967d chore(deps): update module envoyproxy/go-control-plane to v0.9.6 2020-07-13 11:17:51 +00:00
Renovate Bot
fda39942ad chore(deps): update golang.org/x/net commit hash to ab34263 2020-07-13 09:31:08 +00:00
Renovate Bot
2e763ac289 chore(deps): update google.golang.org/genproto commit hash to 8698661 2020-07-13 06:14:28 +00:00
Renovate Bot
c6bdd0be5e chore(deps): update golang.org/x/crypto commit hash to 948cd5f 2020-07-13 05:14:25 +00:00
renovate[bot]
51c8de70ba
chore(deps): update module open-policy-agent/opa to v0.21.1 (#1061)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2020-07-12 22:13:57 -07:00
Cuong Manh Le
58f39db91d
authorize: clear session state if session was deleted in databroker (#1053)
When user signin to 2 sites "a.example.com" and "b.example.com", we're
using the same session for user when accessing those sites. When user
singout from "a.example.com", that session is marked as deleted, thus
user now can not access "b.example.com" nor re-signin to get new access.
User must wait the cookie is expired, or delete the cookie manually to
re-signin to "b.example.com".

This is also affected if user signout from authenticate service
dashboard page directly.

To fix this, we will clear the session state if the session was deleted,
authorize service will return unauthorized, so the user will be
redirected to re-authenticate.

Updates #1014
Updates #858
2020-07-11 08:46:02 +07:00
Cuong Manh Le
d40f294586
authorize: include "kid" in JWT header (#1049)
Fixes #1046
2020-07-09 12:39:53 +07:00
Cuong Manh Le
6f3817aee5
pkg/grpc: fix wrong audit protoc gen file (#1048) 2020-07-08 22:57:12 +07:00
Caleb Doxsey
73105c0b08
audit: add protobuf definitions (#1047) 2020-07-08 07:23:03 -06:00
Cuong Manh Le
de54e449f0
docs/recipes: add local oidc example (#1045)
docs/recipes: add local oidc example

Closes #1042
2020-07-08 08:59:02 +07:00
Cuong Manh Le
2c3c7b837d
docs/configuration: add doc for trailing slash limitation in "To" field (#1040)
Due to the limitation of envoy, it can't handle rewriting of "From"
field without path to a destination with path.

Updates #880
Updates #1033
2020-07-07 11:35:59 +07:00
Renovate Bot
f80a72d680 chore(deps): update google.golang.org/genproto commit hash to 8e8330b 2020-07-07 01:53:44 +00:00
Cuong Manh Le
9821476086 proxy: fix redirect url with traefik forward auth
With Traefik in forward auth mode, when accessing:

	https://example.com/foo

traefik will send a request like this to proxy:

	https://pomerium?uri=https://example.com

The path "/foo" is passed to proxy via "X-Forwarded-Uri" instead of via
query parameters. When proxy redirects request to authenticate, it only
set the "pomerirum_redirect_url" to the value of "uri".

So after authentication success, the user will be redirected to example.com
instead of example.com/foo. If "X-Forwarded-Uri" is present, we should
add it to redirect uri, so the user will be redirected to right place.
2020-07-04 01:23:44 +07:00
Cuong Manh Le
0ecdbf2db3 authenticate: fix wrong SignIn telemetry name 2020-07-04 00:46:33 +07:00
Cuong Manh Le
d764981618
internal/controlplane: set envoy prefix rewrite if present (#1034)
While at it, also refactoring buildPolicyRoutes.

Fixes #1033
Fixes #880
2020-07-03 09:35:36 +07:00
Cuong Manh Le
846d709ba4 proxy: fix wrong forward auth request
When proxy receives forward auth request, it should forward the request
as-is to authorize for verification. Currently, it composes the check
request with actual path, then send the request to authorize service.

It makes the request works accidently, because the composed check
request will satisfy the policy un-intentionally. Example, for forward
auth request:

	http://pomerium/?uri=https://httpbin.localhost.pomerium.io

the composed request will look like:

	&envoy_service_auth_v2.AttributeContext_HttpRequest{
		Method:   "GET",
		Headers:  map[string]string{},
		Path:     "",
		Host:     "httpbin.localhost.pomerium.io",
		Scheme:   "https",
	}

This check request has at least two problems.

First, it will make authorize.handleForwardAuth always returns false,
even though this is a real forward auth request. Because the "Host"
field in check request is not the forward auth host, which is "pomerium"
in this case.

Second, it will accidently matches rule like:

	policy:
	  - from: https://httpbin.localhost.pomerium.io
	    to: https://httpbin
	    allowed_domains:
	      - pomerium.io

If the rule contains other conditions, like "prefix", or "regex":

	policy:
	  - from: https://httpbin.localhost.pomerium.io
	    prefix: /headers
	    to: https://httpbin
	    allowed_domains:
	      - pomerium.io

Then the rule will never be triggered, because the "/headers" path can
be passed in request via "X-Forwarded-Uri" (traefik), instead of
directly from the path (nginx).

To fix this, we just pass the forward auth request as-is to authorize.

Fixes #873
2020-07-03 00:00:20 +07:00
Cuong Manh Le
48639a48fb authorize: honor X-Forwarded-Uri in forward auth mode
Some ingress like traefik set the X-Forwarded-Uri header instead
of passing the actual path in request, we should hornor and use
that header in forward auth mode.

While at it, refactoring the handleForwardAuth to return earlier instead
of nested condition, and add more tests to cover all cases.
2020-07-03 00:00:20 +07:00
Renovate Bot
e482fef247 chore(deps): update module google.golang.org/protobuf to v1.25.0 2020-07-02 16:07:51 +00:00
Caleb Doxsey
09621ee263
pkg: add grpcutil package (#1032) 2020-07-01 15:21:19 -06:00
Caleb Doxsey
fae02791f5
cryptutil: move to pkg dir, add token generator (#1029)
* cryptutil: move to pkg dir, add token generator

* add gitignored files

* add tests
2020-06-30 15:55:33 -06:00
Cuong Manh Le
b90885b4c1
cache: fix data race in NotifyJoin (#1028)
In 35af5c0b91, the check for multiple
cache servers in NotifyJoin is made to be done in a goroutine. That can
lead to a data race, because the memberlist can be changed at the time
the goroutine was run. go warns about this race when test memberlist was
run with "-race".

To fix this, we pass the nil check as argument to goroutine.
2020-07-01 00:11:40 +07:00
Travis Groth
6ab797eb0b
ci: support rc releases (#1011) 2020-06-30 11:19:49 -04:00
Cuong Manh Le
65150f2c3d
docs: document preserve_host_header with policy routes to static ip (#1024)
Fixes #1012
2020-06-30 14:26:08 +07:00
Travis Groth
e27ee4dd32
authorize/evaluator/opa: set client tls cert usage explicitly (#1026) 2020-06-29 17:21:54 -04:00
Renovate Bot
f8491b48ee chore(deps): update google.golang.org/genproto commit hash to ee7919e 2020-06-29 20:07:28 +00:00
Renovate Bot
a18f48b209 chore(deps): update module google.golang.org/grpc to v1.30.0 2020-06-29 17:34:09 +00:00
Cuong Manh Le
f938554968
internal/controlplane: enable envoy use remote address (#1023)
Fixes #1013
2020-06-29 23:06:34 +07:00
Renovate Bot
ad232bf10e chore(deps): update module prometheus/client_golang to v1.7.1 2020-06-29 06:43:00 +00:00
Renovate Bot
8e9f886818 chore(deps): update golang.org/x/sync commit hash to 6e8e738 2020-06-29 03:16:20 +00:00
Renovate Bot
0300be3ed1 chore(deps): update golang.org/x/net commit hash to 4c52546 2020-06-29 01:28:06 +00:00
Cuong Manh Le
ecdf7ee1a9
cache: add test for runMemberList (#1007) 2020-06-26 23:54:14 +07:00
Cuong Manh Le
53588396ad
Allow specify go executable in Makefile (#1008) 2020-06-26 23:53:47 +07:00
Cuong Manh Le
320d92a37e
integration: add dummy value for idp_service_account (#1009)
After 1d1311a240, policy with groups rule
requires idp_service_account set.
2020-06-26 12:32:51 -04:00
Caleb Doxsey
091b71f12e
grpc: rename internal/grpc to pkg/grpc (#1010)
* grpc: rename internal/grpc to pkg/grpc

* don't ignore pkg dir

* remove debug line
2020-06-26 09:17:02 -06:00
Jeff Hubbach
a98d39c5af
Docs: Update Istio VirtualService example (#1006)
It's necessary to specify the destination port for Pomerium services
2020-06-25 18:15:34 -07:00
Travis Groth
c049d87362
docs: document service account requirements (#999) 2020-06-25 19:32:36 -04:00