- Take me to the Lab
Solutions for Lab - OPA:
-
OPA stands for
Open Policy Agent. -
Install and run the latest OPA on the system in the background.
Details
Update VERSION below with the latest version available in the release page $ export VERSION=v0.27.1 $ curl -L -o opa https://github.com/open-policy-agent/opa/releases/download/${VERSION}/opa_linux_amd64 $ chmod 755 ./opa $ ./opa run -s & -
8181is the default port on which OPA runs. -
Regois the language used to write policies in OPA. -
Fix the error in the policy given at
/root/example.regoDetails
$ vi /root/example.rego Set "default allow = false" Run the below command to test policy $ ./opa test example.rego -
Load policy
/root/sample.regoto OPA with the name samplepolicy.
Details
Run Below command to import sample.rego in OPA
$ curl -X PUT --data-binary @sample.rego http://localhost:8181/v1/policies/samplepolicy