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>
This commit is contained in:
Florian Schade
2023-03-14 16:08:22 +01:00
committed by GitHub
co-authored by Martin
parent d06d2012be
commit f38a9f4385
48 changed files with 3106 additions and 284 deletions
+3 -1
View File
@@ -23,7 +23,9 @@ plugins:
ocis.services.store.v0;\
ocis.messages.store.v0;\
ocis.services.eventhistory.v0;\
ocis.messages.eventhistory.v0"
ocis.messages.eventhistory.v0;\
ocis.services.policies.v0;\
ocis.messages.policies.v0"
- name: openapiv2
path: ../../.bingo/protoc-gen-openapiv2
@@ -0,0 +1,49 @@
syntax = "proto3";
package ocis.messages.policies.v0;
option go_package = "github.com/owncloud/ocis/v2/protogen/gen/ocis/messages/policies/v0";
message User {
message ID {
string opaque_id = 1;
}
ID id = 1;
string username = 2;
string mail = 3;
string display_name = 4;
repeated string groups = 5;
}
message Resource {
message ID {
string storage_id = 1;
string opaque_id = 2;
string space_id = 3;
}
ID id = 1;
string name = 2;
uint64 size = 3;
string url = 4;
}
message Request {
string method = 1;
string path = 2;
}
enum Stage {
STAGE_PP = 0;
STAGE_HTTP = 1;
}
message Environment {
Stage stage = 1;
User user = 2;
Request request = 3;
Resource resource = 4;
}
@@ -0,0 +1,51 @@
syntax = "proto3";
package ocis.services.policies.v0;
option go_package = "github.com/owncloud/ocis/protogen/gen/ocis/service/policies/v0";
import "ocis/messages/policies/v0/policies.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
import "google/api/annotations.proto";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "ownCloud Infinite Scale policies";
version: "1.0.0";
contact: {
name: "ownCloud GmbH";
url: "https://github.com/owncloud/ocis";
email: "support@owncloud.com";
};
license: {
name: "Apache-2.0";
url: "https://github.com/owncloud/ocis/blob/master/LICENSE";
};
};
schemes: HTTP;
schemes: HTTPS;
consumes: "application/json";
produces: "application/json";
external_docs: {
description: "Developer Manual";
url: "https://owncloud.dev/services/policies/";
};
};
service policiesProvider {
rpc Evaluate(EvaluateRequest) returns (EvaluateResponse) {
option (google.api.http) = {
post: "/api/v0/policies/evaluate",
body: "*"
};
};
}
message EvaluateRequest {
string query = 1;
ocis.messages.policies.v0.Environment environment = 2;
}
message EvaluateResponse {
bool result = 1;
}