Team Management
New as of 1.2
Team management is available in Dokku Pro 1.2 and later.
Team management controls which users may run which commands against which apps and services.
You group users into teams, grant each team access to a set of commands, apps, and services,
and a user gets the combined access of every team they belong to. This page covers the
teams:* CLI commands; to manage the same teams from the browser, see
Managing Teams.
teams:app-add <team> [<app> ...] # add an app to a team
teams:app-remove <team> [<app> ...] # remove an app from a team
teams:apps-set <team> <app> ... # set the apps for a team
teams:command-add <team> [<command> ...] # allow a team to access specific command(s)
teams:command-remove <team> [<command> ...] # remove team access to specific command(s)
teams:commands-set <team> <command> ... # set the commands for a team
teams:create <team> # create a team
teams:destroy <team> # destroy a team
teams:list # list all teams
teams:member-add <team> [<user> ...] # add a user to a team
teams:member-remove <team> [<user> ...] # remove a user from a team
teams:members-set <team> <user> ... # set the members for a team
teams:owner-add <team> [<user> ...] # add a team owner
teams:owner-remove <team> [<user> ...] # remove a team owner
teams:owners-set <team> <user> ... # set the owners for a team
teams:service-add <team> [<service-type> <service>] # add a service to a team
teams:service-remove <team> [<service-type> <service>] # remove a service from a team
teams:services-set <team> <service-type> <service> ... # set the services for a team
teams:team-report <team> # display a report about a team
teams:whoami # outputs current user
teams:whois <user> # outputs user information
The teams plugin can be disabled safely if you do not need it. Dokku core has native
support for the plugin, but not every community plugin does; those must be updated to
participate in the team system (see the plugin development documentation).
How It Works
Dokku Pro's team system is made of the following objects:
- Teams - groups of users that are granted permission to run commands against apps and services.
- Admins - a special team of users with full access to the entire Dokku system.
- Owners - a team can have one or more owners. Owners can add and remove other owners and administer team membership. Owners do not inherit the command, app, or service access a member has, but they can grant themselves membership in their own teams to gain it.
- Members - team members have the access to commands, apps, and services the team grants.
- Commands - almost any dokku command can be added to or removed from a team; combining commands with apps and services is what lets members act on the system.
- Apps - Dokku apps can be added to or removed from teams, and are combined with the team's commands to scope actions.
- Services - Dokku services can be added to or removed from teams, the same way. All official datastore plugins are supported as services by Dokku Pro.
To show how the system might work, here are a few hypothetical teams:
- Team Name: "elevated-access"
- Owners:
camila - Members:
jose,michael - Commands:
* - Apps:
* - Services:
*
- Owners:
- Team Name: "restricted-users"
- Owners:
camila - Members:
eli,danielle - Commands:
git-*,postgres:create,apps:list - Apps:
node-js-app - Services:
- Owners:
- Team Name: "fancy-users"
- Owners:
camila - Members:
eli - Commands:
git-*,apps:* - Apps:
ruby-app - Services:
- Owners:
With the above setup, the following holds true:
- Both the
joseandmichaelusers can perform almost every action1 in the system. - The users
elianddaniellecan performgit-*operations for thenode-js-appapp - necessary for deployments - as well as create postgres databases and list thenode-js-app. - The
eliuser additionally sees theruby-appin their output, and can perform git actions as well as any action in theapps:command-space for theruby-app.apps:commands that do not require app access - such as app creation viaapps:create- are also available toeli. - Finally, if
jose,michael, andelicreate apps - as allowed by their commands - they become owners of those apps and can run all app-specific commands against them.
Team permissions restrict commands to apps and services, so users cannot escalate access by being added to groups that combine non-overlapping resources with a different set of available commands.
Installing the Teams Plugin
Before usage, install the plugin:
# make the plugin available for dokku
sudo dokku-pro teams:install
# enable the teams plugin in dokku
sudo dokku plugin:enable teams
# enable the users plugin in dokku
sudo dokku plugin:enable users
# enable integration with dokku
sudo dokku teams:enable
Warning
As of Dokku Pro 1.2.x, there is a bug in creating cache directories used by the teams
plugin. Work around it by running
mkdir -p /var/lib/dokku/data/teams && chown dokku:dokku /var/lib/dokku/data/teams as
the root user on your host.
Installing the plugin and enabling it in Dokku exposes the CLI commands, but the
teams:enable command must also be run in order to:
- set up custom triggers that add and remove teams when apps or services are created
- integrate with the authentication system in Dokku and official Dokku plugins
- set up the initial
dokku@adminteam - create app-specific teams (without any initial users or owners) for each existing app
Note
The dokku@admin team is a special team that grants access to all commands for all apps
and services. When teams:enable is first triggered, all existing users - as reported by
the ssh-keys plugin - are migrated into the dokku@admin team if it does not already
exist. Users added via the initial web UI are also added to the dokku@admin team.
Permissions for the dokku@admin team cannot be changed.
Checking the Current User
Note
Users can always check who they are via the teams:whoami command.
The teams:whoami command reports the current user, including their name and all the teams
they are associated with.
=====> root user information
User app membership:
User app ownership:
User is global admin: true
User membership: elevated-access
User ownership: elevated-access
User service membership:
User service ownership:
Username: root
Show a single field with the corresponding flag:
# show only the username
dokku teams:whoami --username
# show only the user membership, space-delimited
dokku teams:whoami --user-membership
Output can also be shown as JSON. Note that the membership and ownership values are a single space-delimited string rather than an array.
Checking a Specific User
Note
This command can only be run for the current user, or by a global admin.
The teams:whois command reports information about a given user, including their name and all
the teams they are associated with.
=====> root user information
User app membership:
User app ownership:
User is global admin: true
User membership: elevated-access
User ownership: elevated-access
User service membership:
User service ownership:
Username: root
Users that do not exist do not error, but their permissions are empty.
Show a single field with the corresponding flag:
# show only the username
dokku teams:whois root --username
# show only the user membership, space-delimited
dokku teams:whois root --user-membership
Output can also be shown as JSON. Note that the membership and ownership values are a single space-delimited string rather than an array.
Listing Teams
List teams with teams:list. This includes only teams the logged-in user has access to; for
non-owners, that is only the teams they belong to.
Logged-in admins see all teams on the server, whether or not they belong to them.
Creating Teams
Reserved team names
A few team types are special:
dokku@admin- global admin users.dokku@app--${APP}- managed automatically per app.dokku@service--${SERVICE_TYPE}-${SERVICE}- managed automatically per service.
Custom team names must therefore not include the dokku@ prefix.
A user in the admin group can create a team with teams:create.
The user that created the team is set as its owner.
Destroying Teams
A team can be destroyed by an admin or a team owner with teams:destroy.
! WARNING: Potentially Destructive Action
! This command will destroy the team elevated-access.
! To proceed, type "elevated-access"
> elevated-access
Destroying elevated-access
Destroying a team that does not exist, or one the current user cannot access, returns an error.
Owners and Members
Adding Owners to a Team
Warning
Non-existent users can be added as owners to pre-configure a team. Destroying the user does not remove them from the team. This behavior is subject to change in the future.
Admins and team owners can administer a team's permissions and membership. Add owners with
teams:owner-add.
Removing Owners From a Team
Admins and team owners can remove owners with teams:owner-remove.
A team must have at least one owner; attempting to remove the last owner returns an error.
Adding a User to a Team
Warning
Non-existent users can be added as members to pre-configure a team. Destroying the user does not remove them from the team. This behavior is subject to change in the future.
Adding a user to a team with teams:member-add grants them everything the team allows.
A user can belong to multiple teams, combining overlapping permissions to broaden their access.
Removing a User From a Team
Removing a user from a team with teams:member-remove revokes any access not covered by their
other teams.
Command Management
Warning
Internal teams cannot have their command access modified.
Commands must be whitelisted before a team can run them. Running a command that is not whitelisted returns an error.
Admin-Only Commands
For security reasons, the following commands may only be run by an admin. This list is subject to change as Dokku and Dokku Pro evolve.
- domains:add-global
- domains:clear-global
- domains:remove-global
- domains:set-global
- events
- events:list
- events:off
- events:on
- git:allow-host
- git:auth
- logs:vector-start
- logs:vector-stop
- network:create
- network:destroy
- network:exists
- network:info
- network:list
- network:rebuildall
- shell
- trace:on
Additionally, any command invoked with the --global flag is executable only by an admin.
Allowing Access to Specific Commands
Note
Only admins can add commands to a team.
Grant command access with teams:command-add.
Commands can be globbed with the * operator. When present, the entry is treated as a POSIX
regex for command matching, which can whitelist all commands or a subset of a plugin's
commands.
If a team has no commands added, its members cannot run any command on an app or service, regardless of other permissions.
Removing Access to Specific Commands
Remove a previously added command with teams:command-remove.
Commands are matched as a literal string against those currently associated with the team.
App Access
Warning
Internal teams cannot have their app access modified.
By default, teams have no access to any app. Any command that acts on an app is not executable - and returns an opaque error that does not reveal whether the app exists - until the app is added to a team.
Allowing Access to Specific Apps
Note
Only admins can add apps to a team.
Add apps to a team with teams:app-add.
Non-existent apps can be specified, allowing you to pre-configure permissions before an app exists. As a result, app permissions are not removed from teams when an app is deleted. Permissions do persist through clones and renames.
The special * operator grants access to all apps. It is not treated as a regex and
overrides any other apps currently attached to the team.
Removing Access to Specific Apps
Remove apps from a team with teams:app-remove.
The special * operator can also be removed from a team.
Service Access
Warning
Internal teams cannot have their service access modified.
Service plugins can also take advantage of the team system. Services do not need to be whitelisted in Dokku core; they simply use the appropriate service "namespace" for access control (see the plugin development documentation).
If a service plugin supports the team system and a user lacks access to the service, an opaque error - one that does not indicate whether the service exists - is returned.
Allowing Access to a Service
Note
Only admins can add services to a team.
Add a service to a team with teams:service-add, giving a service-type and a service name.
Non-existent services can be specified, allowing you to pre-configure permissions before a service exists. As a result, service permissions are not removed from teams when a service is deleted.
All services of a service-type can be allowed with the * operator. It is not treated as a
regex and cannot be combined with other characters. Adding it overrides any other services of
that type attached to the team.
All services of all service-types can be whitelisted by giving only a * for the
service-type argument. It is not treated as a regex and cannot be combined with other
characters. Adding it overrides any other service settings on the team.
Removing Access to a Service
Remove a service from a team with teams:service-remove, giving a service-type and a service
name.
The * operator can be removed the same way it was added.
Displaying a Team Report
Global admins can get a report about a team with teams:team-report.
=====> dokku@admin team information
Team apps:
Team commands:
Team is internal: true
Team is internal app team: false
Team is internal service team: false
Team members:
Team name: dokku@admin
Team owners: admin1 default
Team services:
Pass a flag to output only the value you want. For example:
Integrating Custom Plugins
A plugin that wants to implement the team system can call any of the following plugin triggers:
plugn trigger user-auth SSH_USER SSH_NAME COMMAND- exits with an error if the user does not have access to the command. Used for commands that do not interact with a specific app or service.plugn trigger user-auth-app SSH_USER SSH_NAME APP- exits with an opaque error if the user does not have access to the app.plugn trigger user-auth-service SSH_USER SSH_NAME SERVICE_TYPE SERVICE_NAME- exits with an opaque error if the user does not have access to the service.
Each plugin must implement these triggers before any logic runs. Plugins should avoid calling
the dokku binary directly, since a command may not be available to a user, so commands that
mutate state may partially fail.
The following triggers are already implemented in Dokku core:
user-auth- implemented within the dokku binary itself.user-auth-app- implemented by any plugin that callscommon.DokkuApps()(Go) ordokku_apps(shell).
-
As noted in the Admin-Only Commands section, some commands require global administrative access to be performed by users. ↩