Commit graph

855 commits

Author SHA1 Message Date
Cuong Manh Le
1640151bc1
databroker server backend config (#1127)
* config,docs: add databroker storage backend configuration

* cache: allow configuring which backend storage to use

Currently supported types are "memory", "redis".
2020-07-23 10:42:43 +07:00
Travis Groth
c9182f757e
docs: Fix incorrect example middleware (#1128)
* Fix incorrect example middleware
2020-07-22 14:33:45 -04:00
Caleb Doxsey
1ad243dfd1
directory.Group entry for groups (#1118)
* store directory groups separate from directory users

* fix group lookup, azure display name

* remove fields restriction

* fix test

* also support email

* use Email as name for google'

* remove changed file

* show groups on dashboard

* fix test

* re-add accidentally removed code
2020-07-22 11:28:53 -06:00
Cuong Manh Le
489cdd8b63
internal/controlplane: using envoy strip host port matching (#1126)
* internal/controlplane: using envoy strip host port matching

With envoy 1.15.0 release, strip host port matching setting allows
incoming request with Host "example:443" will match again route with
domains match set to "example".

Not that this is not standard HTTP behavior, but it's more convenient
for users.

Fixes #959

* docs/docs: add note about enable envoy strip host port matching
2020-07-22 23:51:57 +07:00
Caleb Doxsey
504197d83b
custom rego in databroker (#1124)
* add support for sub policies

* add support for sub policies

* update authz rego policy to support sub policies
2020-07-22 10:44:05 -06:00
Cuong Manh Le
1d82be2c0e
internal/databroker: fix wrong server version init (#1125) 2020-07-22 04:32:44 +07:00
Cuong Manh Le
99785cbb5b
internal/databroker: store server version (#1121)
Storing server version when creating new server. After then, we can
retrieve the version from backend when server restart.

With storage backend which supports persistent, the server version
won't change after restarting.
2020-07-22 03:50:22 +07:00
Cuong Manh Le
26f099b49d
redis storage backend (#1082)
* pkg/storage: add redis storage backend

* pkg/storage/redis: set record create time correctly

* pkg/storage/redis: add docs

* pkg/storage/redis: run test with redis tag only

* pkg/storage/redis: use localhost

* pkg/storage/redis: use 127.0.0.1

* pkg/storage/redis: honor REDIS_URL env

* .github/workflows: add missing config for redis service

* .github/workflows: map redis ports to host

* pkg/storage/redis: use proto marshaler instead of json one

* pkg/storage/redis: use better implementation

By using redis supported datastructure:

 - Hash for storing record
 - Sorted set for storing by version
 - Set for storing deleted ids

List operation will be now performed in O(log(N)+M) instead of O(N) like
previous implementation.

* pkg/storage/redis: add tx to wrap redis transaction

* pkg/storage/redis: set record type in New

* pkg/storage/redis: make sure tx commands appear in right order

* pkg/storage/redis: make deletePermanentAfter as argument

* pkg/storage/redis: make sure version is incremented when deleting

* pkg/storage/redis: fix linter

* pkg/storage/redis: fix cmd construction
2020-07-22 03:07:20 +07:00
Caleb Doxsey
858077b3b6
authorize: custom rego policies (#1123)
* add support for custom rego policies

* add support for passing custom policies
2020-07-21 12:09:26 -06:00
bobby
d5433f8431
depedency: bump envoy to 1.15.0 (#1119)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2020-07-21 08:25:37 -07:00
bobby
1912e32927
deps: update envoy to 1.14.4 (#1076)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2020-07-20 21:12:44 -07:00
Travis Groth
75f2ed93ea
Set loopback address by ipv4 IP (#1116) 2020-07-20 22:31:48 -04:00
Travis Groth
bfc726ec3f
prevent dirty git state during release (#1117) 2020-07-20 18:00:03 -04:00
Travis Groth
a1b6bfec56
docs: Cloud Run / GCP Serverless (#1101)
* Add GCP Serverless and Cloud Run docs
2020-07-20 14:00:52 -04:00
Cuong Manh Le
e8d3ce1a2e
authorize,proxy: allow traefik forward auth without uri query (#1103)
In #1030, the fix was done without aware of the context that traefik
forward auth mode did allow request without the "?uri=". Previosuly,
this is done in proxy, and by converting the forward auth request to
actual request. The fix is #1030 prevent this conversion, to makre
authorize service aware of which is forward auth request.

But that causes traefik forward auth without "?uri" stop working. Fixing
it by making the authorize service also honor the forwarded uri header,
too.

Fixes #1096
2020-07-21 00:58:14 +07:00
bobby
e85226b609
grpc: use relative paths in codegen (#1106)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2020-07-20 06:40:11 -07:00
Caleb Doxsey
fff782e04c
authorize: add evaluator store (#1105)
* add evaluator store

* handle arrays
2020-07-20 07:39:34 -06:00
Renovate Bot
d2656ecd67 chore(deps): update google.golang.org/genproto commit hash to 11fb19a 2020-07-20 08:00:29 +00:00
Cuong Manh Le
9dae633fe5
internal/frontend/assets/html: make timestamp human readable (#1107)
Since we switch to use databroker, time in template is now protobuf
timestamp instead of time.Time, that causes it appears in raw form
instead of human-readable format.

Fix this by converting protobuf timestamp to time.Time in template.
There's still a breaking change, though. The time will now appears in
UTC instead of local time.

Fixes #1100
2020-07-20 13:35:57 +07:00
Renovate Bot
0f17fb0d95 chore(deps): update module spf13/cobra to v1 2020-07-20 03:22:08 +00:00
Renovate Bot
2a99088cdf chore(deps): update module open-policy-agent/opa to v0.22.0 2020-07-20 02:27:34 +00:00
Renovate Bot
c2e487a996 chore(deps): update github.com/skratchdot/open-golang commit hash to eef8423 2020-07-20 01:06:57 +00:00
bobby
ffb6b395e2
deployment: fix pomerium-cli release (#1104)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2020-07-17 12:45:16 -07:00
Travis Groth
ca6715d3c5
Move examples repo into main repo (#1102) 2020-07-17 14:23:06 -04:00
Caleb Doxsey
b79e73b8b8
config: add support for policies stored in the databroker (#1099)
* wip

* always use databroker config source

* add test

* valid policy, remove debug lines
2020-07-17 10:35:29 -06:00
Cuong Manh Le
821f2e9000
config: allow setting directory sync interval and timeout (#1098)
Updates #567
2020-07-17 23:11:27 +07:00
Travis Groth
25867501d4
ci: Add cloudrun build (#1097)
* add cloudrun image build
2020-07-17 12:01:30 -04:00
Cuong Manh Le
408f201d16
authorize/evaluator/opa/policy: fix allow rules with impersonate (#1094)
Currently, with impersonated request, the real user email/group still
has effects.

Example:

	data.route_policies as [{
	    "source": "example.com",
	    "allowed_users": ["x@example.com"]
	}] with
	input.databroker_data as {
	    "session": {
	        "user_id": "user1"
	    },
	    "user": {
	        "email": "x@example.com"
	    }
	} with
	input.http as { "url": "http://example.com" } with
	input.session as { "id": "session1", "impersonate_email": "y@example.com" }

Here user "x@example.com" is allowed, but was impersonated as
"y@example.com". As the rules indicated, the request must be denied,
because it only allows "x@example.com", not "y@example.com". The current
bug causes the request is still allowed.

To fix it, when evaluates rules for allowed email/group/domain, we must checking
that the impersonate email/groups is not set/empty.

Fixes #1091
2020-07-17 22:07:11 +07:00
Cuong Manh Le
59c17fb497
internal/directory: improve google user groups list (#1092)
Skip group without members, so it saves us time to handle group members,
and reduce the size of groups.

While at it, also querying API with the fields we need.

Fixes #567
2020-07-17 16:51:26 +07:00
Caleb Doxsey
02b4e4b619
fix deep copy of config (#1089) 2020-07-17 10:42:24 +07:00
Caleb Doxsey
d3a7ee38be
options refactor (#1088)
* refactor config loading

* wip

* move autocert to its own config source

* refactor options updaters

* fix stuttering

* fix autocert validate check
2020-07-16 14:30:15 -06:00
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