Intentions define access control for services via Connect and are used to control which services may establish connections. Intentions can be managed via the API, CLI, or UI.
---
# Intentions
Intentions define access control for services via Connect and are used
to control which services may establish connections. Intentions can be
managed via the API, CLI, or UI.
Intentions are enforced by the [proxy](/docs/connect/proxies.html)
or [natively integrated application](/docs/connect/native.html) on
inbound connections. After verifying the TLS client certificate, the
[authorize API endpoint](#) is called which verifies the connection
is allowed by testing the intentions. If authorize returns false the
connection must be terminated.
The default intention behavior is defined by the default
[ACL policy](/docs/guides/acls.html). If the default ACL policy is "allow all",
then all Connect connections are allowed by deafult. If the default ACL policy
is "deny all", then all Connect connections are denied by default.
## Intention Basics
Intentions can be managed via the
[API](#),
[CLI](#),
or UI. Please see the respective documentation for each for full details
on options, flags, etc.
Below is an example of a basic intention to show the basic attributes
of an intention. The full data model of an intention can be found in the
[API documentation](#).
```
$ consul intention create -deny web db
Created: web => db (deny)
```
The intention above is a deny intention with a source of "web" and
destination of "db". This says that connections from web to db are not
allowed and the connection will be rejected.
### Wildcard Intentions
An intention source or destination may also be the special wildcard
value `*`. This matches _any_ value and is used as a catch-all. Example:
```
$ consul intention create -deny web '*'
Created: web => * (deny)
```
This example says that the "web" service cannot connect to _any_ service.
### Metadata
Arbitrary string key/value data may be associated with intentions. This
is unused by Consul but can be used by external systems or for visibility
in the UI.
```
$ consul intention create \
-deny \
-meta description='Hello there' \
web db
...
$ consul intention get web db
Source: web
Destination: db
Action: deny
ID: 31449e02-c787-f7f4-aa92-72b5d9b0d9ec
Meta[description]: Hello there
Created At: Friday, 25-May-18 02:07:51 CEST
```
## Precedence and Match Order
Intentions are matched in an implicit order based on specificity, preferring