Commit graph

243 commits

Author SHA1 Message Date
Bobby DeSimone
7d7e997e79
proxy: verify endpoint strip added callback params (#368)
- proxy: use distinct host route for forward-auth handlers
- proxy: have auth middleware set pomerium headers for request and response
2019-10-15 15:36:00 -07:00
Bobby DeSimone
0e85b2b1cb
bug: fix forward-auth redirect (#364) 2019-10-13 11:09:30 -07:00
Bobby DeSimone
badd8d69af
internal/sessions: refactor how sessions loading (#351)
These chagnes standardize how session loading is done for session
cookie, auth bearer token, and query params.

- Bearer token previously combined with session cookie.
- rearranged cookie-store to put exported methods above unexported
- added header store that implements session loader interface
- added query param store that implements session loader interface

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-10-06 10:47:53 -07:00
Bobby DeSimone
a96aec57d5
proxy: add per-route request headers setting (#346)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-10-04 14:51:52 -07:00
Bobby DeSimone
c95a72e12a
proxy: fix dashboard path prefix (#347)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-10-04 08:36:36 -07:00
Bobby DeSimone
7016534d87
proxy: use custom 404 handler (#348)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-10-04 08:36:23 -07:00
Bobby DeSimone
eaa1e7a4fb
proxy: support external access control requests (#324)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-10-03 21:22:44 -07:00
Bobby DeSimone
df822a4bae
all: support insecure mode
- pomerium/authenticate: add cookie secure setting
- internal/config: transport security validation moved to options
- internal/config: certificate struct hydrated
- internal/grpcutil: add grpc server mirroring http one
- internal/grpcutil: move grpc middleware
- cmd/pomerium: use run wrapper around main to pass back errors
- cmd/pomerium: add waitgroup (block on) all servers http/grpc

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-10-02 18:44:19 -07:00
Travis Groth
251ab0d527
internal/config: Switch to using struct scoped viper instance (#332)
* Switch to using struct scoped viper instance

* Rename NewXXXOptions

* Handle unchecked errors from viper.BindEnv
2019-10-01 18:16:36 -04:00
Bobby DeSimone
782ffbeb3e
proxy: use middleware to manage request flow
proxy: remove duplicate error handling in New
proxy: remove routeConfigs in favor of using gorilla/mux
proxy: add proxy specific middleware
proxy: no longer need to use middleware / handler to check if valid route. Can use build in 404 mux.
internal/middleware: add cors bypass middleware

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-09-25 12:28:37 -07:00
Bobby DeSimone
7c755d833f
authenticate: encrypt & mac oauth2 callback state
- cryptutil: add hmac & tests
- cryptutil: rename cipher / encoders to be more clear
- cryptutil: simplify SecureEncoder interface
- cryptutil: renamed NewCipherFromBase64 to NewAEADCipherFromBase64
- cryptutil: move key & random generators to helpers

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-09-23 19:15:52 -07:00
Bobby DeSimone
cfeb5e1ef9
Merge pull request #310 from desimone/bug/262
proxy: handle double slash in paths
2019-09-18 19:54:38 -07:00
Bobby DeSimone
c315b62df4
Merge pull request #304 from desimone/bug/fix-group-impersonation
proxy: fix group impersonation bug
2019-09-18 19:54:17 -07:00
Bobby DeSimone
664fb8b0ea
proxy: remove csrf checks from proxied routes
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-09-18 12:47:30 -07:00
Bobby DeSimone
21e215ccea
proxy: handle double slash in paths
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-09-16 20:34:04 -07:00
Bobby DeSimone
decf661eb0
proxy: fix group impersonation bug
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-09-16 19:23:55 -07:00
Bobby DeSimone
dc12947241
all: refactor handler logic
- all: prefer `FormValues` to `ParseForm` with subsequent `Form.Get`s
- all: refactor authentication stack to be checked by middleware, and accessible via request context.
- all: replace http.ServeMux with gorilla/mux’s router
- all: replace custom CSRF checks with gorilla/csrf middleware
- authenticate: extract callback path as constant.
- internal/config: implement stringer interface for policy
- internal/cryptutil: add helper func `NewBase64Key`
- internal/cryptutil: rename `GenerateKey` to `NewKey`
- internal/cryptutil: rename `GenerateRandomString` to `NewRandomStringN`
- internal/middleware: removed alice in favor of gorilla/mux
- internal/sessions: remove unused `ValidateRedirectURI` and `ValidateClientSecret`
- internal/sessions: replace custom CSRF with gorilla/csrf fork that supports custom handler protection
- internal/urlutil: add `SignedRedirectURL` to create hmac'd URLs
- internal/urlutil: add `ValidateURL` helper to parse URL options
- internal/urlutil: add `GetAbsoluteURL` which takes a request and returns its absolute URL.
- proxy: remove holdover state verification checks; we no longer are setting sessions in any proxy routes so we don’t need them.
- proxy: replace un-named http.ServeMux with named domain routes.

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-09-16 18:01:14 -07:00
Yuchen Ying
27a3870373 Add tls_server_name option to policy file. 2019-09-07 04:09:49 +00:00
Bobby DeSimone
380d314404
authenticate: make service http only
- Rename SessionState to State to avoid stutter.
- Simplified option validation to use a wrapper function for base64 secrets.
- Removed authenticates grpc code.
- Abstracted logic to load and validate a user's authenticate session.
- Removed instances of url.Parse in favor of urlutil's version.
- proxy: replaces grpc refresh logic with forced deadline advancement.
- internal/sessions: remove rest store; parse authorize header as part of session store.
- proxy: refactor request signer
- sessions: remove extend deadline (fixes #294)
- remove AuthenticateInternalAddr
- remove AuthenticateInternalAddrString
- omit type tag.Key from declaration of vars TagKey* it will be inferred
  from the right-hand side
- remove compatibility package xerrors
- use cloned http.DefaultTransport as base transport
2019-09-04 16:27:08 -07:00
Travis Groth
247cf4781d
Disable serviceconfig (#289) 2019-08-29 19:44:31 -04:00
Bobby DeSimone
6e6ab3baa0
httputil: use http error wrapper
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-08-24 09:15:07 -07:00
Travis Groth
b3fa7023f6
Fix dockerhub tests (#267)
* Remove race condition in tests
2019-08-15 06:28:57 -04:00
Travis Groth
ba37ed2305
GRPC Improvements 2019-08-14 18:14:09 -04:00
Bobby DeSimone
8002e74982
proxy: enable client certificate in transport
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-08-12 15:08:18 -07:00
Bobby DeSimone
a962877ad4
config: fix url type regression (#253)
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-08-03 12:08:26 -07:00
Travis Groth
790619ef01
Restore info metrics (#252) 2019-08-03 12:58:21 -04:00
Bobby DeSimone
2c1953b0ec
internal/config: pass urls by value
Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-08-02 15:46:18 -07:00
Travis Groth
30243097d2 Prevent nil pointer when reloading in single service mode 2019-08-01 22:50:21 -04:00
Bobby DeSimone
5edfa7b03f
telemetry: add tracing
- telemetry/tace: add traces throughout code
- telemetry/metrics: nest metrics and trace under telemetry
- telemetry/tace: add service name span to HTTPMetricsHandler.
- telemetry/metrics: removed chain dependency middleware_tests.
- telemetry/metrics: wrap and encapsulate variatic view registration.
- telemetry/tace: add jaeger support for tracing.
- cmd/pomerium: move `parseOptions` to internal/config.
- cmd/pomerium: offload server handling to httputil and sub pkgs.
- httputil: standardize creation/shutdown of http listeners.
- httputil: prefer curve X25519 to P256 when negotiating TLS.
- fileutil: use standardized Getw

Signed-off-by: Bobby DeSimone <bobbydesimone@gmail.com>
2019-07-24 09:20:16 -07:00
Travis Groth
db63956b0e Add info metrics 2019-07-20 08:53:35 -04:00
Bobby DeSimone
b85f8de05f
development: use golangci-lint 2019-07-13 18:28:51 -07:00
Travis Groth
e635c9bb3b HTTP metrics improvements
- Switch to ochttp plugin
- Add HTTP request metrics
- Relabel for consistency
2019-07-11 22:49:54 -04:00
Travis Groth
4bd4b27f28 GRPC metrics improvements
- change to ocgrpc plugin
- rename labels to be more consistent
- refactor view registration patterns
- add server metrics- add client request size metrics
2019-07-10 22:35:56 -04:00
Bobby DeSimone
7558d5b0de
internal/config: refactor option parsing
- authorize: build whitelist from policy's URLs instead of strings.
- internal/httputil: merged httputil and https package.
- internal/config: merged config and policy packages.
- internal/metrics: removed unused measure struct.
- proxy/clients: refactor Addr fields to be urls.
- proxy: remove unused extend deadline function.
- proxy: use handler middleware for reverse proxy leg.
- proxy: change the way websocket requests are made (route based).

General improvements
- omitted value from range in several cases where for loop could be simplified.
- added error checking to many tests.
- standardize url parsing.
- remove unnecessary return statements.

- proxy: add self-signed certificate support. #179
- proxy: add skip tls certificate verification. #179
- proxy: Refactor websocket support to be route based. #204
2019-07-07 09:39:31 -07:00
Bobby DeSimone
15ab8a61a2
proxy: add auth redirect to internal urls 2019-07-06 11:46:25 -07:00
Travis Groth
989062db8e Allow empty policies at startup 2019-07-02 06:25:25 -04:00
Travis Groth
77338bd4e9 Add GRPC Client Metrics 2019-06-28 06:35:27 -04:00
Travis Groth
d303a95985 Add proxy client metrics instrumentation
* New set of client request oriented metrics
* RoundTripper chain to instrument requests
2019-06-21 18:55:02 -04:00
Bobby DeSimone
4d4293fc46
internal/logs: make non error conditions less scary in logs
internal/metrics: simplified struct definition with fmt -s.
internal/metrics: added full path to package name.
2019-06-17 08:40:18 +02:00
Bobby DeSimone
a7637cdf49
proxy: allow custom redirect url to be set following signout 2019-06-13 21:39:29 -07:00
Bobby DeSimone
cf0f98536a
authenticate: programmatic access support
- authenticate: added a token exchange api endpoint that converts
  an identity provider's JWT into a pomerium session.
- internal/identity: authenticate now passes context.
- internal/identity: removed extraneous GetSignInURL from okta.
- internal/sessions: add rest store
- update go.mod / go.sum depedencies.
- docs: add programmatic examples in shell and python
2019-06-12 14:51:19 -07:00
Bobby DeSimone
554e62108f
authorize: fix headers when impersonating
- Add user impersonation docs.
- Add navbar link to v0.0.5 docs.
2019-06-11 15:40:28 -07:00
Travis Groth
64eb992854 Protect Options from being mutated by services
- Change Options URLs from pointers to values

- Remove special handling for AuthenticateURL checksum

- Change Options itself to a value
2019-06-04 22:47:07 -04:00
Bobby DeSimone
4ce4e1e124
proxy: fix internal service url (#163) 2019-06-04 12:56:25 -07:00
Bobby DeSimone
bade9f50e6
internal/httputil: use error structs for http errors (#159)
The existing implementation used a ErrorResponse method to propogate
and create http error messages. Since we added functionality to
troubleshoot, signout, and do other tasks following an http error
it's useful to use Error struct in place of method arguments.

This fixes #157 where a troubleshooting links were appearing on pages
that it didn't make sense on (e.g. pages without valid sessions).
2019-06-03 20:00:37 -07:00
Tejasvi Nareddy
f966e5ab19 (proxy, internal/config, internal/log, docs): opt-in websocket support 2019-06-01 22:39:46 -04:00
Travis Groth
8c2beac6f1 Add automatic configuration reloading and
policy handling
2019-06-01 14:52:10 -04:00
Bobby DeSimone
77f3933560
internal/config: change internal-authenticate-addr to url (#154) 2019-05-31 17:53:58 -07:00
u5surf
c274112ecc all: fix incorrect http status codes #135 2019-05-29 12:57:02 +09:00
Bobby DeSimone
66b4c2d3cd
authenticate/proxy: add user impersonation, refresh, dashboard (#123)
proxy: Add user dashboard. [GH-123]
proxy/authenticate: Add manual refresh of their session. [GH-73]
authorize: Add administrator (super user) account support. [GH-110]
internal/policy: Allow administrators to impersonate other users. [GH-110]
2019-05-26 12:33:00 -07:00