Contents

Linux OPA

OPA

OPA
OPA stands for Open Policy Agent.
Policy-based control for cloud native environments.
Official

Installation

1
2
3
export OPA_VERSION=v0.27.1
curl -L -o opa https://github.com/open-policy-agent/opa/releases/download/${OPA_VERSION}/opa_linux_amd64
chmod 755 ./opa
1
./opa run -s &

Test Policy

1
./opa test <rego-file-name>

View Policies

1
curl http://localhost:8181/v1/policies

Load Policy

1
2
# Structure
curl -X PUT --data-binary @<rego-policy-file-name> http://localhost:8181/v1/policies/<policy-name>
1
2
# Example
curl -X PUT --data-binary @sample.rego http://localhost:8181/v1/policies/samplepolicy

Unload Policy

1
curl -X DELETE http://localhost:8181/v1/policies/<policy-name>
1
curl -X DELETE http://localhost:8181/v1/policies/samplepolicy

OPA Default Information

Default PortLanguage
8181Rego