Skip to content

Commit 85eaacd

Browse files
authored
docs: Add note about v1.0 addr behaviour (#7398)
Fixes #7360 Also https://github.com/orgs/open-policy-agent/discussions/662#discussioncomment-12338962t Signed-off-by: Charlie Egan <charlie@styra.com>
1 parent 83c8e0e commit 85eaacd

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

docs/content/deployments.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,18 @@ We can run OPA as a server using Docker:
4141

4242
```bash
4343
docker run -p 8181:8181 openpolicyagent/opa \
44-
run --server --log-level debug
44+
run --server --log-level debug --addr=0.0.0.0:8181
4545
```
4646

47+
{{< info >}}
48+
We have to use `--addr` here to bind to all interfaces to ensure OPA is
49+
accessible from outside the container. This is not necessary when running OPA
50+
in other environments.
51+
52+
More information can be found in the
53+
[security documentation](../security/#interface-binding).
54+
{{< /info >}}
55+
4756
Test that OPA is available:
4857

4958
```

docs/content/v0-upgrade.md

+24
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,30 @@ OPA binary of version 1.0 or later.
470470
If you run into any issues while upgrading a Rego project, please drop a message
471471
in the #help channel on the [OPA Slack](https://slack.openpolicyagent.org/).
472472

473+
## Upgrading OPA Instances
474+
475+
Prior to OPA 1.0, when running in server mode (`opa run --server/-s`), OPA would
476+
bind to all interfaces by default. In OPA 1.0,
477+
[OPA will bind to `localhost`](https://github.com/open-policy-agent/opa/issues/6286)
478+
by default instead. Though not inherently insecure in a trusted environment,
479+
it's good practice to bind OPA to localhost by default if OPA is not intended to
480+
be exposed to remote services.
481+
482+
If you need to replicate the v0.x behaviour, you can use the `--addr` flag to
483+
bind to all interfaces. For example:
484+
485+
```sh
486+
opa run --server --addr 0.0.0.0:8181
487+
```
488+
489+
{{< info >}}
490+
When running OPA in a container, binding to all interfaces is required
491+
when the instance needs to be accessed by the host or another container.
492+
{{< /info >}}
493+
494+
More information can be found in the
495+
[security documentation](../security/#interface-binding).
496+
473497
## Upgrading for Go Integrations
474498

475499
Both users of the

0 commit comments

Comments
 (0)