Users and RBAC
Chapter objectives
- Create and manage users
- Configure teams
- Define permissions (RBAC)
- Control access to resources
1 - User management
List of users
┌─────────────────────────────────────────────────────────────────┐
│ 👥 Users [+ Add user] │
├─────────────────────────────────────────────────────────────────┤
│ Username Role Teams Actions │
│ ──────────────── ──────────────────────────────────────────────│
│ admin Administrator - [⚙️] │
│ john.doe Standard user Dev, QA [⚙️] [🗑️] │
│ jane.smith Standard user Dev [⚙️] [🗑️] │
│ bob.wilson Standard user Production [⚙️] [🗑️] │
│ │
└─────────────────────────────────────────────────────────────────┘
Create a user
┌─────────────────────────────────────────────────────────────────┐
│ + Add user │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Username: [newuser ] │
│ │
│ Password: [•••••••••• ] │
│ Confirm: [•••••••••• ] │
│ │
│ Role: │
│ (•) Standard user │
│ ( ) Administrator │
│ │
│ Teams: [Select teams... ▼] │
│ ☑ Development │
│ ☐ Production │
│ ☐ QA │
│ │
│ [Create user] │
│ │
└────────────────────── ───────────────────────────────────────────┘
User roles
| Role | Description |
|---|---|
| Administrator | Full access to everything |
| Standard user | Restricted access based on permissions |
2 - Team management
List of teams
┌─────────────────────────────────────────────────────────────────┐
│ 👥 Teams [+ Add team] │
├─────────────────────────────────────────────────────────────────┤
│ Team name Members Leaders Actions │
│ ──────────────────────────────────────────────────────────────│
│ Development 3 john.doe [⚙️] [🗑️] │
│ Production 2 bob.wilson [⚙️] [🗑️] │
│ QA 2 jane.smith [⚙️] [🗑️] │
│ │
└───────────────────────────────────────────────── ────────────────┘
Create a team
┌─────────────────────────────────────────────────────────────────┐
│ + Add team │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Name: [Frontend Team ] │
│ │
│ Leaders: │
│ [Select leaders... ▼] │
│ ☑ john.doe │
│ │
│ [Create team] │
│ │
└─────────────────────────────────────────────────────────────────┘
Roles within a team
| Role | Permissions |
|---|---|
| Leader | Manage the team members |
| Member | Access based on the team's permissions |
3 - Environment access control
Configuration per environment
┌─────────────────────────────────────────────────────────────────┐
│ Environment access: production-docker │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Access management: │
│ ( ) Public - Accessible to any user │
│ (•) Restricted - Access limited to specific users/teams │
│ │
│ Authorized accesses: │
│ ─────────────────────────────────────────────────────────────│
│ │
│ ☑ Production Team [Environment admin ▼] │
│ ☑ bob.wilson [Environment admin ▼] │
│ ☐ Development Team [Read-only ▼] │
│ │
│ [+ Add access] │
│ │
└─────────────────────────────────────────────────────────────────┘
Access levels
| Level | Permissions |
|---|---|
| Environment admin | Manage everything |
| Operator | Manage containers, not the config |
| Helpdesk | View and restart |
| Read-only | View only |
4 - RBAC (Role-Based Access Control)
Concept
┌─────────────────────────────────────────────────────────────────┐
│ RBAC Model │
├─────────────────────────────────────────────────────────────────┤
│ │
│ User ────▶ Team ────▶ Role ────▶ Permissions │
│ │
│ john.doe → Dev Team → Operator → Start/Stop containers │
│ View logs │
│ Exec into containers │
│ │
│ bob → Prod Team → Admin → Full access │
│ │
└─────────────────────────────────────────────────────────────────┘
Granular permissions (Business Edition)
┌─────────────────────────────────────────────────────────────────┐
│ Role: Custom Operator │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Containers: │
│ ☑ View containers │
│ ☑ Start/Stop containers │
│ ☑ Restart containers │
│ ☑ View logs │
│ ☑ Execute into containers (console) │
│ ☐ Create containers │
│ ☐ Remove containers │
│ │
│ Images: │
│ ☑ View images │
│ ☐ Pull images │
│ ☐ Build images │
│ ☐ Remove images │
│ │
│ Stacks: │
│ ☑ View stacks │
│ ☐ Create/Edit stacks │
│ ☐ Remove stacks │
│ │
└─────────────────────────────────────────────────────────────────┘
5 - Resource access control
Stack access
┌─────────────────────────────────────────────────────────────────┐
│ Stack access control: wordpress │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Ownership: │
│ ( ) Public - Accessible to environment users │
│ (•) Restricted - Limited access │
│ │
│ Authorized: │
│ ─────────────────────────────────────────────────────────────│
│ ☑ Frontend Team │
│ ☑ john.doe │
│ │
└─────────────────────────────────────────────────────────────────┘
Volume access
┌─────────────────────────────────────────────────────────────────┐
│ Volume access control: postgres_data │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Ownership: │
│ ( ) Public │
│ (•) Restricted │
│ │
│ Authorized teams/users: │
│ ☑ Database Team │
│ │
└─────────────────────────────────────────────────────────────────┘
6 - External authentication
OAuth/OpenID Connect
┌─────────────────────────────────────────────────────────────────┐
│ Authentication: OAuth │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Provider: [Custom ▼] │
│ │
│ Client ID: [your-client-id ] │
│ Client Secret: [your-client-secret ] │
│ │
│ Authorization URL: │
│ [https://auth.example.com/authorize ] │
│ │
│ Token URL: │
│ [https://auth.example.com/token ] │
│ │
│ User identifier: [email ] │
│ │
│ Scopes: [openid email profile ] │
│ │
│ ☑ Auto-create users │
│ Default team: [None ▼] │
│ │
└─────────────────────────────────────────────────────────────────┘
LDAP (Business Edition)
┌─────────────────────────────────────────────────────────────────┐
│ Authentication: LDAP │
├─────────────────────────────────────────────────────────────────┤
│ │
│ LDAP Server: │
│ URL: [ldap://ldap.example.com:389 ] │
│ │
│ Reader DN: [cn=reader,dc=example,dc=com] │
│ Password: [•••••••••• ] │
│ │
│ User Search: │
│ Base DN: [ou=users,dc=example,dc=com] │
│ Filter: [(uid={0}) ] │
│ Username attribute: [uid ] │
│ │
│ Group Search (optional): │
│ Base DN: [ou=groups,dc=example,dc=com] │
│ Filter: [(member={0}) ] │
│ │
│ Admin group: [cn=portainer-admins ] │
│ │
└─────────────────────────────────────────────────────────────────┘
7 - Audit logs (Business Edition)
Log visualization
┌─────────────────────────────────────────────────────────────────┐
│ Audit Logs │
├─────────────────────────────────────────────────────────────────┤
│ Filter: [All users ▼] [All actions ▼] [Last 7 days ▼] │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Timestamp User Action Resource │
│ ──────────────────────────────────────────────────────────────│
│ 2024-01-15 14:30 john.doe Started container/nginx │
│ 2024-01-15 14:25 jane.smith Deployed stack/wordpress │
│ 2024-01-15 14:20 bob.wilson Created volume/data │
│ 2024-01-15 14:15 admin Updated user/john.doe │
│ 2024-01-15 14:10 john.doe Logged in - │
│ │
└─────────────────────────────────────────────────────────────────┘
Traced actions
| Category | Actions |
|---|---|
| Auth | Login, logout, failed login |
| Users | Create, update, delete |
| Teams | Create, update, delete, membership |
| Containers | Start, stop, remove, exec |
| Stacks | Deploy, update, remove |
| Settings | Configuration changes |
8 - Best practices
Account security
# ✅ Bonnes pratiques
- Mots de passe forts (12+ caractères)
- Utiliser des équipes pour regrouper les utilisateurs
- Appliquer le principe du moindre privilège
- Séparer les environnements dev/staging/prod
- Activer l'authentification externe si possible
- Revue régulière des accès
- Activer l'audit logging (Business)
Team organization
┌─────────────────────────────────────────────────────────────────┐
│ Organisation recommandée │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Par fonction: │
│ • Developers → accès dev/staging │
│ • QA Team → accès staging (read-only prod) │
│ • Ops Team → accès production │
│ • DBA Team → accès databases uniquement │
│ │
│ Par projet: │
│ • Project-A Team → ressources projet A │
│ • Project-B Team → ressources projet B │
│ │
└─────────────────────────────────────────────────────────────────┘
Permission matrix
| Environment | Dev Team | QA Team | Ops Team |
|---|---|---|---|
| Development | Admin | Read-only | Admin |
| Staging | Operator | Admin | Admin |
| Production | Read-only | Read-only | Admin |
Summary
| Feature | Description |
|---|---|
| Users | Individual accounts |
| Teams | Groups of users |
| Roles | Permission levels |
| Access control | Per environment/resource |
| OAuth/LDAP | External authentication |
| Audit logs | Traceability of actions |
Key points
- Use teams to simplify management
- Apply the principle of least privilege
- Separate access by environment
- External authentication improves security
Practical exercises
- Create a "Developers" team with 2 users
- Configure an environment with restricted access
- Test the different permission levels
- Configure OAuth authentication (if available)