SaltDns. Access
(Salt v1.0.0)
The single authorisation boundary. The API, the UI and the RFC 2136
listener call authorize/5 before they touch data; SaltDns.Zones is an
internal, unauthorised layer and must not be called from a request path
without going through here first.
The actor is {:user, %SaltDns.Accounts.Scope{}} (a signed-in user) or
{:credential, %SaltDns.Credentials.Credential{}} (an authenticated API
token or TSIG key; authenticate it just before, a stale struct is trusted
for its revoked_at and expires_at).
case Access.authorize(actor, :update, zone, "www.example.com", "A") do
:ok -> Zones.put_rrset(zone, attrs, audit_actor)
{:error, :forbidden} -> ...
endThe rules are in SaltDns.Access.Policy: organisation isolation first,
then the user's role or the credential's grants. Organisations are never
revealed: every refusal is the same {:error, :forbidden}.
Summary
Functions
Like authorize/5 but returns a boolean.
Authorises action on the RRset (name, type) of zone.
Authorises READ of a zone of a customer (child) organisation of parent:
the actor must be owner or admin of parent and the zone's organisation
must be a child of parent. This is the only access a provider's user gets
to a child's zones; authorize/5 still refuses every write there, because
the user has no role in the child. Customers of customers are not seen:
only direct children count.
Authorises an action on the zone itself (its settings, deletion): the
apex SOA, which is how grants express :manage.
True when the actor may use the certificate module in the organisation (for
one zone, or for the organisation with nil). level is :read or :manage;
see SaltDns.Access.Policy.certificates?/5. Needs the :certificates grant
for credentials: DNS grants never give it.
True when the actor may create a zone called name in the organisation:
owners and admins, and credentials with a grant of zone :any and action
:manage that covers the new zone's apex (see Policy.creates_zones?/4).
True for users who are owner or admin of the organisation. Credentials never.
True when the actor may create, change and delete the organisation's
secondaries: owners and admins, and credentials with a grant of zone :any
and action :manage.
True when the actor may use routing (proxy groups, backends, routes, nodes)
in the organisation; see SaltDns.Access.Policy.proxy?/4. Credentials need
the :proxy grant of zone :any.
True when the actor is owner or admin of parent, the provider of customer
organisations (see SaltDns.Provisioning). Users only; credentials never.
Types
@type action() :: SaltDns.Access.Policy.action()
@type actor() :: {:user, SaltDns.Accounts.Scope.t()} | {:credential, SaltDns.Credentials.Credential.t()}
Functions
Like authorize/5 but returns a boolean.
@spec authorize(actor(), action(), SaltDns.Zones.Zone.t(), String.t(), String.t()) :: :ok | {:error, :forbidden}
Authorises action on the RRset (name, type) of zone.
@spec authorize_customer_zone( actor(), SaltDns.Accounts.Organisation.t(), SaltDns.Zones.Zone.t() ) :: :ok | {:error, :forbidden}
Authorises READ of a zone of a customer (child) organisation of parent:
the actor must be owner or admin of parent and the zone's organisation
must be a child of parent. This is the only access a provider's user gets
to a child's zones; authorize/5 still refuses every write there, because
the user has no role in the child. Customers of customers are not seen:
only direct children count.
@spec authorize_zone(actor(), action(), SaltDns.Zones.Zone.t()) :: :ok | {:error, :forbidden}
Authorises an action on the zone itself (its settings, deletion): the
apex SOA, which is how grants express :manage.
@spec can_certificates?( actor(), SaltDns.Accounts.Organisation.t(), :read | :manage, String.t() | nil ) :: boolean()
True when the actor may use the certificate module in the organisation (for
one zone, or for the organisation with nil). level is :read or :manage;
see SaltDns.Access.Policy.certificates?/5. Needs the :certificates grant
for credentials: DNS grants never give it.
@spec can_create_zone?(actor(), SaltDns.Accounts.Organisation.t(), String.t()) :: boolean()
True when the actor may create a zone called name in the organisation:
owners and admins, and credentials with a grant of zone :any and action
:manage that covers the new zone's apex (see Policy.creates_zones?/4).
@spec can_manage_credentials?(actor(), SaltDns.Accounts.Organisation.t()) :: boolean()
True for users who are owner or admin of the organisation. Credentials never.
@spec can_manage_secondaries?(actor(), SaltDns.Accounts.Organisation.t()) :: boolean()
True when the actor may create, change and delete the organisation's
secondaries: owners and admins, and credentials with a grant of zone :any
and action :manage.
@spec can_proxy?(actor(), SaltDns.Accounts.Organisation.t(), :read | :manage) :: boolean()
True when the actor may use routing (proxy groups, backends, routes, nodes)
in the organisation; see SaltDns.Access.Policy.proxy?/4. Credentials need
the :proxy grant of zone :any.
@spec can_read_customers?(actor(), SaltDns.Accounts.Organisation.t()) :: boolean()
True when the actor is owner or admin of parent, the provider of customer
organisations (see SaltDns.Provisioning). Users only; credentials never.