Run a policy decision point server.
mpe serve --bundle <file> [--port <port>] [--protocol <protocol>]
The serve command starts a gRPC/HTTP server that acts as a Policy Decision Point (PDP). It can serve:
| Option | Alias | Description | Default |
|---|---|---|---|
--bundle | -b | PolicyDomain bundle file(s) | Required |
--port | TCP port to serve on | 9000 | |
--protocol | -p | Protocol: generic or envoy | generic |
--name | -n | Domain name for multiple bundles | |
--opa-flags | Additional OPA flags | --v0-compatible | |
--no-opa-flags | Disable OPA flags |
mpe serve -b my-domain.yml
# Server listening on port 9000
mpe serve -b my-domain.yml --port 8080
mpe serve -b my-domain.yml -p envoy --port 9001
mpe serve -b base.yml -b app.yml -n my-app
The generic protocol accepts PORC expressions directly:
{
"principal": {
"sub": "user@example.com",
"mroles": ["mrn:iam:role:admin"]
},
"operation": "api:users:read",
"resource": {
"id": "mrn:app:users"
},
"context": {}
}
{
"allow": true
}
The Envoy protocol is compatible with Envoy External Authorization:
# Envoy configuration
http_filters:
- name: envoy.filters.http.ext_authz
typed_config:
"@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthz
grpc_service:
envoy_grpc:
cluster_name: ext_authz
timeout: 0.25s
transport_api_version: V3
clusters:
- name: ext_authz
type: STRICT_DNS
lb_policy: ROUND_ROBIN
http2_protocol_options: {}
load_assignment:
cluster_name: ext_authz
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: mpe-server
port_value: 9001
Configure logging via environment variables:
# Log level
export MPE_LOG_LEVEL=.:debug
# Log format (json or text)
export MPE_LOG_FORMATTER=text
mpe serve -b my-domain.yml
FROM golang:1.21-alpine as builder
WORKDIR /app
COPY . .
RUN go build -o mpe ./cmd/mpe
FROM alpine:latest
COPY --from=builder /app/mpe /usr/local/bin/
COPY policies/ /policies/
ENTRYPOINT ["mpe", "serve"]
CMD ["-b", "/policies/domain.yml", "--port", "9000"]
docker build -t mpe-server .
docker run -p 9000:9000 mpe-server
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |