SaltDns. Access. Policy
(Salt v1.0.0)
The pure decision behind SaltDns.Access.
A principal is who asks:
{:user, roles}: a user, withrolesa map of organisation id to role (:owner | :admin | :editor | :viewer), their memberships;{:credential, credential}: any map or struct withorganisation_id,grants(a list, or:invalid),revoked_atandexpires_at.
A zone is any map or struct with name, organisation_id and status.
Rules, in order; the first that applies decides:
- Organisation isolation. A principal only ever acts on zones of
its own organisation(s). A user without a role in the zone's
organisation, and a credential of another organisation, are denied
whatever the role or grants say, including grants with zone
:any. - The name must be inside the zone, and neither zone nor name may contain a backslash (escaped labels are not understood here).
- A
disabledzone allows no:updateto anyone. - Users:
ownerandadminmay:read,:updateand:manage;editormay:readand:update;viewermay:read. - Credentials: revoked, expired and invalid-grant credentials are
denied; otherwise
SaltDns.Auth.Grants.allowed?/5decides.
:manage on the zone itself is asked as (:manage, zone, zone.name, "SOA").
pending zones are editable. Everything else is denied.
Summary
Functions
True when principal may do action on (name, type) of zone at now.
True when principal may use the certificate module in organisation_id.
True when principal may create a zone called name in organisation_id.
True when the user principal is :owner or :admin in organisation_id.
True when principal may manage the organisation's secondary nameservers:
owners and admins, and credentials of that organisation with one grant of
zone :any and action :manage.
Whether the principal may use routing (SaltDns.Proxy) in the organisation.
level is :read or :manage. Users: any member reads, owners and admins
manage. Credentials: the organisation matches, the credential is usable and
has a grant of zone :any with the action :proxy; no DNS grant and no
:certificates grant gives it.
Types
Functions
True when principal may do action on (name, type) of zone at now.
@spec certificates?( principal(), integer(), :read | :manage, String.t() | nil, DateTime.t() ) :: boolean()
True when principal may use the certificate module in organisation_id.
level is :read (list and show) or :manage (request, renew, disable).
Users: any member may read, owners and admins manage. Credentials: the
organisation matches, the credential is usable and has a grant with the
action :certificates for the zone (zone_name; nil asks about the
organisation as a whole and needs a grant of zone :any). A grant of
:read, :update or :manage never gives this, so a DNS token cannot touch
certificates.
@spec creates_zones?(principal(), integer(), String.t(), DateTime.t()) :: boolean()
True when principal may create a zone called name in organisation_id.
Users: owner or admin. Credentials: the organisation matches, the
credential is usable and one single grant has zone :any and action
:manage and covers the apex SOA of name. A grant for one named zone is
not enough, so a token cannot create zones it was not given in advance.
True when the user principal is :owner or :admin in organisation_id.
@spec manages_secondaries?(principal(), integer(), DateTime.t()) :: boolean()
True when principal may manage the organisation's secondary nameservers:
owners and admins, and credentials of that organisation with one grant of
zone :any and action :manage.
@spec proxy?(principal(), integer(), :read | :manage, DateTime.t()) :: boolean()
Whether the principal may use routing (SaltDns.Proxy) in the organisation.
level is :read or :manage. Users: any member reads, owners and admins
manage. Credentials: the organisation matches, the credential is usable and
has a grant of zone :any with the action :proxy; no DNS grant and no
:certificates grant gives it.