Commit Graph

172 Commits

Author SHA1 Message Date
Martin
4ad0638429 Update services/proxy/README.md
Co-authored-by: Michael Barz <mbarz@owncloud.com>
2023-05-02 21:06:25 +02:00
mmattel
1d73b0e025 update proxy_tls description 2023-05-02 20:41:15 +02:00
Ralf Haferkamp
b7990875c1 oidc: Remove "aud" claim validation of logout tokens (#6156)
The "aud" claim of the logout token is supposed to contain the client-id
of the client for which the token was issued. Our current implementation of
validating that claim is somewhat broken. We only allow to configure a single
value for the allowed client id. But we have different client-ids
accessing oCIS.

This completely removes the current validation of the `aud` claim until
we come up with a working solution. As we currently require a session id
to be present in the logout token the risk not validating the `aud`
claim is pretty low.

Related: #6149
2023-04-27 10:34:09 +02:00
Andre Duffeck
be569b7c59 [full-ci] More cache cleanup (#6134)
* Make env var names consistent with the others

* Remove unused OCS cache

* Use the same cache database for shared caches

* Bump reva
2023-04-25 15:46:59 +02:00
Martin
9bf4b3eb18 Merge pull request #6119 from owncloud/update_readme_caching
[docs-only] Add caching/storing info to services where missing
2023-04-24 15:13:49 +02:00
Andre Duffeck
77bb3d8bcd [full-ci] Refactor stores (#6019)
* Streamline the store implementation with and into reva

* Adapt to the cache/store refactoring in reva

* Streamline config options and their env vars

* Apply suggestions from code review

Co-authored-by: Martin <github@diemattels.at>

* Use the same database for all stores

* Bump reva

* Configure stat and filemetadata cache separately

* Fix default config

---------

Co-authored-by: Martin <github@diemattels.at>
2023-04-24 15:13:35 +02:00
EParzefall
e2686f90b9 spelling fixes 2023-04-24 13:55:10 +02:00
mmattel
84d2d8dae9 [docs-only] Fix texts and typos in README.md files 2023-04-23 10:02:27 +02:00
Ralf Haferkamp
70a80125c3 Fix backchannel logout
Use access token to lookup session id. The userinfo endpoint does
not return the session id. Also add some debug logging.

Co-authored-by: Christian Richter <crichter@owncloud.com>
Co-authored-by: Michael Barz <mbarz@owncloud.com>
2023-04-20 18:04:52 +02:00
Christian Richter
a6ced1f99f Simplifiy Unmarshall function for stringAsBool struct
Co-authored-by: Julian Koberg <jkoberg@owncloud.com>
Signed-off-by: Christian Richter <crichter@owncloud.com>
2023-04-20 11:45:13 +02:00
Christian Richter
7b1be941b7 improve documentation strings for env vars
Signed-off-by: Christian Richter <crichter@owncloud.com>
2023-04-20 11:26:32 +02:00
Christian Richter
cec99493f2 Add workaround for chiRouter racecondition in chi.RegisterMethod()
Co-authored-by: Ralf Haferkamp <rhaferkamp@owncloud.com>
Signed-off-by: Christian Richter <crichter@owncloud.com>
2023-04-20 10:19:05 +02:00
Christian Richter
30bcf32062 incorporate requested changes
Signed-off-by: Christian Richter <crichter@owncloud.com>
2023-04-20 09:00:58 +02:00
Christian Richter
3d6d4c7c7c add missing http method
Signed-off-by: Christian Richter <crichter@owncloud.com>
2023-04-19 17:32:50 +02:00
Christian Richter
e88a0d7bc3 add tests for oidc backchannel logout
Signed-off-by: Christian Richter <crichter@owncloud.com>
2023-04-19 17:32:49 +02:00
Christian Richter
15691ae78a fix contexts, render result
Signed-off-by: Christian Richter <crichter@owncloud.com>
2023-04-19 17:32:25 +02:00
Jörn Friedrich Dreyer
d2d7c49df4 properly parse logout request
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-04-19 17:32:25 +02:00
Jörn Friedrich Dreyer
dc399a61ac implement backchannel logout, reuse useringo cache
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-04-19 17:32:25 +02:00
Christian Richter
a900d0ed8d Refactor caches
Signed-off-by: Christian Richter <crichter@owncloud.com>
2023-04-19 17:32:25 +02:00
Jörn Friedrich Dreyer
bc15b8a396 work on logout
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-04-19 17:32:25 +02:00
Jörn Friedrich Dreyer
b608d0b0f9 move verify access token code to oidc client
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-04-19 17:32:25 +02:00
Jörn Friedrich Dreyer
58dce9bed8 use our oidc client
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-04-19 17:32:25 +02:00
Jörn Friedrich Dreyer
97894acccd add missing error check, redirect stub
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-04-19 17:32:25 +02:00
Christian Richter
a3640b0565 extract full claims from jwt token to get session id
Signed-off-by: Christian Richter <crichter@owncloud.com>
2023-04-19 17:32:23 +02:00
Michael Barz
1f19462d44 Merge pull request #6076 from owncloud/policies-proxy-tus-uploads
fix: proxy policies middleware tus filename evaluation
2023-04-19 10:09:14 +02:00
Ralf Haferkamp
6059747491 proxy: Rework oidc role mapper to allow multiple matching roles
If multiple claims values have a valid matching for ocis roles, we'll pick
the ocis role that appears first in the mapping configuration.
2023-04-19 08:56:47 +02:00
Florian Schade
fdaf39f5d1 fix: proxy policies middleware tus filename evaluation
when uploading files via uppy (tus), the path does not give any information about the file, PUT contains the filename in the path, tus POST not.

this pr extracts the HeaderUploadMetadata from that POST request and enhances the policies grpc environment request with that information.

Therefore, the policies service is now able to evaluate proxy requests for tus uploads too.
2023-04-18 20:26:52 +02:00
mmattel
b2504035e0 fix readme service names 2023-04-12 18:40:41 +02:00
mmattel
255dd06c92 [docs-only] Fix readme.md for caches 2023-04-04 09:15:24 +02:00
Michael Barz
b2568972da Merge pull request #5992 from owncloud/basic-auth-header
do not send www-authenticate basic for Api requests
2023-04-03 15:22:09 +02:00
André Duffeck
d640719b7a Fix oidc auth cache 2023-04-03 14:00:11 +02:00
Michael Barz
df537ea98d do not send www-authenticate basic for Api requests 2023-04-03 11:34:42 +02:00
jkoberg
66a0d5a5ff avoid panic when oidcClient.Get fails
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2023-03-31 10:59:44 +02:00
kobergj
bfe8ed8db5 Merge pull request #5700 from owncloud/invitations
Invitations service
2023-03-28 15:27:56 +02:00
Dennis Sieben
e28603e633 - fixed typos 2023-03-27 08:54:51 +02:00
Jörn Friedrich Dreyer
f805cca363 initial invitations skeleton
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2023-03-24 11:42:48 +01:00
Jörn Friedrich Dreyer
6bec87f582 Proxy accesstoken cache store (#5829)
* refactor middleware options

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* use ocmemstore micro store implementaiton for token cache

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* refactor ocis store options, support redis sentinel

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* align cache configuration

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* database and tabe are used to build prefixes for inmemory stores

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* add global persistent store options to userlog config

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* log cache errors but continue

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* drup unnecessary type conversion

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* Better description for the default userinfo ttl

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* use global cache options for even more caches

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* don't log userinfo cache misses

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* default to stock memory store

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* use correct mem store typo string

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* split cache options, doc cleanup

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* mint and write userinfo to cache async

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* use hashed token as key

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* go mod tidy

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update docs

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update cache store naming

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* bring back depreceted ocis-pkg/store package for backwards compatability

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update changelog

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* Apply suggestions from code review

Co-authored-by: kobergj <jkoberg@owncloud.com>

* revert ocis-pkg/cache to store rename

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* add waiting for each step 50 milliseconds

* starlack check

---------

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Co-authored-by: kobergj <jkoberg@owncloud.com>
Co-authored-by: Viktor Scharf <scharf.vi@gmail.com>
2023-03-22 15:21:57 +01:00
Ralf Haferkamp
7e6b690ccf proxy: update README with notes about role assignment (#5878) 2023-03-20 21:03:41 +01:00
Jörn Friedrich Dreyer
474c4b848d upgrade to go1.20 and auto set go mem limit (#5732)
* upgrade to go1.19 and set go mem limit

* create ocis-pkg memlimit package

* use std automemlimit import

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* import automemlimit in every ocis service, drop ocis-pkg/memlimit package

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* bump go to 1.20

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* drop unused config options and env vars

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update all version numbers, add doc

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix lint

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update bingo and mockery

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* bump golangci-lint

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* fix selector test

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* Update changelog/unreleased/enhancement-memlimit.md

Co-authored-by: kobergj <juliankoberg@googlemail.com>

---------

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
Co-authored-by: Willy Kloucek <wkloucek@owncloud.com>
Co-authored-by: kobergj <juliankoberg@googlemail.com>
2023-03-20 17:22:02 +01:00
Ralf Haferkamp
98b4a6a23a Address some linter warnings
Response bodies need to be closed
2023-03-20 15:12:09 +01:00
Jörn Friedrich Dreyer
7f8e54b1c2 fix link 2023-03-20 15:12:09 +01:00
Ralf Haferkamp
1287bbc10d proxy: Cache the role Mapping for some time
Avoid torturing the settings service with "ListRoles" request for
every incoming request to the proxy.
The role Mapping is refreshed if cached data is older than 5 minutes.
2023-03-20 15:12:09 +01:00
Ralf Haferkamp
96ed144745 proxy: Add some missing doc strings 2023-03-20 15:12:09 +01:00
Ralf Haferkamp
a448c75c75 Extract role assignments from claims
Add a UserRoleAssigner implementation that extract role names from the
users' claims and creates role assignments in the settings service based
on a configured mapping of claim values to ocis role names.

Closes: #5669
2023-03-20 15:12:09 +01:00
Ralf Haferkamp
d57d52b33d proxy: Add an interface for user role assignment
This moves the lookup and the creation of the users' role assignemt out
of the user backend into its own interface. This makes the user backend
a bit simpler and allows to provide different implemenation for the user
role assignment more easily.
2023-03-20 15:12:09 +01:00
Ralf Haferkamp
490a835a3a proxy: Move CS3 User backend options to "functional" options
This will make it easier to add/remove options to the backend in the
future.
2023-03-20 15:12:09 +01:00
Ralf Haferkamp
88e8bb1b72 account_resolver: Handle user roles separately from user lookup
This removes the "withRoles" flag from the GetUserByClaims lookup and move the
functionality into a separate method. This should make the code a bit more readable
in preparation for maintaining the RoleAssignments from OIDC claims.
2023-03-20 15:12:09 +01:00
Ralf Haferkamp
f5cfa7e126 proxy: Move to mockery for generating mocks
To align with what we're using everywhere else.
2023-03-20 15:12:09 +01:00
Florian Schade
f38a9f4385 Introduce Policies-Service (#5716)
* add policies service
add policies proxy middleware
add policies event service
add policies grpc service
prepare ci and git environments (ci, make, readme, doc)

* add webfinger to the drone conf

* fix docs
remove not used virus scan postprocessing step

* relocate example rego file
implicitly enable and disable proxy and postprocessing policy checking by setting the query.
update configuration descriptions

* move policies
update readme

* use converter func to convert pp environment to actual environment
expose and test custom rego functions
add engine unit tests
add opa unit tests
update policies readme

Co-authored-by: Martin <github@diemattels.at>

* relocate sample policies to the deployments folder
change and document policies service port

* update index.md and small fix

* add health command
add version command
add debug server

---------

Co-authored-by: Martin <github@diemattels.at>
2023-03-14 16:08:22 +01:00
Ralf Haferkamp
a34a3b2a98 Cleanup some oidc related bits (#5751)
* Remove unused code from oidc module

* Use already existing Metadata type for jwks discovery

ocis-pkg/oidc already provides a type for the oidc metadata. Switch to
that instead of defining yet another custom type.

* oidc: Add helper to get IDP metadata
2023-03-07 14:43:42 +01:00