Day 70: Jenkins User Management & Authorization - Role-Based Access Control π

Welcome back! π Day 70 of the 100 Days Cloud DevOps Challenge, and today we're implementing Jenkins Role-Based Access Control! This is security best practice - controlling who can access what in your CI/CD platform with granular permissions. Let's secure! π―
π― The Mission - Configure User Access Control
π TASK TICKET #DEV-8070 - Jenkins RBAC Implementation
Priority: HIGH | Type: Security Configuration
Server: Jenkins | Access: Web UI
REQUIREMENT:
- Configure user access for development team
- Implement role-based permissions
- Remove anonymous access
- Secure existing jobs
IMPLEMENTATION:
1. Login to Jenkins
- Username: admin
- Password: Adm!n321
2. Create User:
- Username: javed
- Password: BruCStnMT5
- Full Name: Javed
3. Configure Authorization:
- Strategy: Project-based Matrix Authorization
- javed: Overall Read permission
- Anonymous: Remove all permissions
- admin: Retain Overall Administer
4. Job Permissions:
- javed: Read permission only
- No other permissions (Agent, SCM, etc.)
SUCCESS CRITERIA:
- User created successfully
- Matrix authorization configured
- Anonymous access removed
- Job permissions set correctly
This is enterprise security implementation! π
π οΈ Complete Implementation
Step 1: Access Jenkins UI
1. Click "Jenkins" button on top bar
2. Login page appears
3. Enter credentials:
Username: admin
Password: Adm!n321
4. Click "Sign in"
Logged in successfully! β
Step 2: Create New User
Navigate to User Management:
1. From Dashboard, click "Manage Jenkins" (left sidebar)
2. Click "Manage Users" (or "Users" section)
3. Click "Create User" button (top left)
4. Fill in the form:
Create User form:
βββββββββββββββββββββββββββββββββββββββββββ
β Create User β
βββββββββββββββββββββββββββββββββββββββββββ€
β Username: [javed] β
β Password: [BruCStnMT5] β
β Confirm: [BruCStnMT5] β
β Full name: [Javed] β
β E-mail: [javed@example.com] β
β (optional) β
β β
β [Create User] β
βββββββββββββββββββββββββββββββββββββββββββ
Enter exactly:
Username: javed
Password: BruCStnMT5
Confirm password: BruCStnMT5
Full name: Javed
E-mail: (can leave blank or add email)
Click "Create User" β
User created successfully! You'll see javed in the user list.
Step 3: Install Matrix Authorization Plugin
Before configuring authorization, need to install plugin:
1. Go to "Manage Jenkins"
2. Click "Manage Plugins" (or "Plugins")
3. Click "Available plugins" tab
4. Search for: "Matrix Authorization Strategy Plugin"
5. Check the checkbox: β Matrix Authorization Strategy Plugin
6. Click "Install" button
7. On installation page, check:
β Restart Jenkins when installation is complete
and no jobs are running
8. Wait for installation to complete
9. Jenkins will automatically restart
Plugin installation progress:
βββββββββββββββββββββββββββββββββββββββββββ
β Installing Plugins/Upgrades β
βββββββββββββββββββββββββββββββββββββββββββ€
β β Matrix Authorization Strategy Plugin β
β installed successfully β
β β
β β Restart Jenkins when installation β
β is complete and no jobs are running β
β β
β Status: Restarting Jenkins... β
βββββββββββββββββββββββββββββββββββββββββββ
Wait for restart (30-60 seconds)
IMPORTANT: Wait for login page to reappear. Don't click "Finish" immediately!
Step 4: Login After Restart
After Jenkins restarts:
1. Login page reappears
2. Login again:
Username: admin
Password: Adm!n321
3. Back to Dashboard
Step 5: Configure Global Security Settings
Navigate to Security Configuration:
1. Click "Manage Jenkins"
2. Click "Configure Global Security"
(or "Security" β "Configure Global Security")
3. You'll see Security Realm and Authorization sections
Security Configuration page:
βββββββββββββββββββββββββββββββββββββββββββ
β Configure Global Security β
βββββββββββββββββββββββββββββββββββββββββββ€
β Security Realm: β
β β¦Ώ Jenkins' own user database β
β β Allow users to sign up β
β β
β Authorization: β
β β¦Ώ Project-based Matrix Authorization β
β Strategy β
β β
β [Configure permissions below] β
βββββββββββββββββββββββββββββββββββββββββββ
Step 6: Select Authorization Strategy
In Authorization section:
1. Find "Authorization" dropdown/radio buttons
2. Select "Project-based Matrix Authorization Strategy"
β¦Ώ Project-based Matrix Authorization Strategy
3. Matrix permission table will appear below
Note: If you don't see this option, verify Matrix Authorization
plugin installed successfully
Why Project-based Matrix?
Options:
- Logged-in users can do anything
(Too permissive)
- Matrix-based security
(Global only)
- Project-based Matrix Authorization Strategy β
(Global + per-project permissions)
- Role-Based Strategy
(Requires additional plugin)
Step 7: Configure Admin Permissions
In the permission matrix:
1. You'll see "User/group to add" field
2. Type: admin
3. Click "Add" button
4. Check ALL permissions for admin user:
β Overall - Administer (this checks all)
Or manually check all boxes in admin row
5. This ensures admin retains full access
Permission matrix for admin:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User/group | Overall | Credentials | Agent | Job β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β admin | β Adm | β All | β All | β All β
β | β Cfg | | | β
β | β Read | | | β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Step 8: Add Javed User with Read Permission
Add javed to permission matrix:
1. In "User/group to add" field, type: javed
2. Click "Add" button
3. javed appears as new row in matrix
4. For javed, check ONLY:
β Overall - Read
5. Leave all other permissions unchecked for javed
IMPORTANT: Only check "Overall > Read" - nothing else!
Permission matrix with javed:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User/group | Overall | Credentials | Job β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β admin | β Administer | β All | β Allβ
β | β Configure | | β
β | β Read | | β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β javed | β Administer | β All | β Allβ
β | β Configure | | β
β | β Read | | β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Step 9: Remove Anonymous User Permissions
Check for Anonymous user:
1. Look for "Anonymous" row in permission matrix
2. If exists, uncheck ALL permissions:
β Overall - Administer
β Overall - Configure
β Overall - Read
β (Uncheck everything)
3. Or click "Delete" (trash icon) to remove Anonymous entirely
This removes anonymous access completely
No anonymous access:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β User/group | Overall | Credentials | Job β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β admin | β Administer | β All | β Allβ
β javed | β Read (only) | β All | β Allβ
β Anonymous | β (removed/none) | β All | β Allβ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Click "Save" at bottom of page β
Step 10: Configure Job-Specific Permissions
For existing job(s):
1. Go to Jenkins Dashboard
2. Click on the existing job name
3. Click "Configure" (left sidebar)
4. Scroll down to find "Enable project-based security" checkbox
5. Check: β Enable project-based security
6. Permission matrix appears for this job
7. Add javed:
- In "User/group to add": javed
- Click "Add"
8. For javed, check ONLY:
β Job - Read
9. Leave unchecked:
β Job - Build
β Job - Cancel
β Job - Configure
β Job - Delete
β Job - Discover
β Job - Move
β Job - Workspace
β SCM - Tag
β Run - Delete
β Run - Replay
β Run - Update
10. Click "Save"
Job-specific permissions:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Enable project-based security β
β β Enable project-based security β
β β
β User/group | Job | SCM | Run β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β admin | β All | β All| β Allβ
β javed | β Read (only) | β | β β
β | β Build, Configure... | | β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Step 11: Test User Access
Test javed user login:
1. Logout from admin account
- Click "admin" (top right)
- Click "Log out"
2. Login as javed:
Username: javed
Password: BruCStnMT5
3. Verify javed can:
β See Dashboard (Overall Read)
β View job list
β Click on job to view (Job Read)
4. Verify javed CANNOT:
β Access "Manage Jenkins"
β Create new jobs
β Build jobs
β Configure jobs
β Delete anything
5. Logout and login back as admin
Javed's view (limited):
βββββββββββββββββββββββββββββββββββββββββββ
β Jenkins [javed βΌ] β
βββββββββββββββββββββββββββββββββββββββββββ€
β (No "Manage Jenkins" link) β
β β
β Jobs: β
β ββ existing-job [view only] β
β β
β (No "New Item" button) β
βββββββββββββββββββββββββββββββββββββββββββ
Step 12: Complete Verification
# SSH to Jenkins server for CLI verification
ssh root@jenkins
# Create verification script
cat > verify-rbac.sh << 'EOF'
#!/bin/bash
echo "=== Jenkins RBAC Configuration Verification ==="
echo ""
echo "1. Jenkins Users:"
if [ -f /var/lib/jenkins/users/users.xml ]; then
sudo grep '<string>' /var/lib/jenkins/users/users.xml | sed 's/.*<string>\(.*\)<\/string>.*/\1/'
echo " β Users file exists"
else
echo " β Users file not found"
fi
echo ""
echo "2. User 'javed' Details:"
if sudo ls /var/lib/jenkins/users/javed* >/dev/null 2>&1; then
echo " β User 'javed' exists"
FULL_NAME=$(sudo grep '<fullName>' /var/lib/jenkins/users/javed*/config.xml | sed 's/.*<fullName>\(.*\)<\/fullName>.*/\1/')
echo " Full Name: $FULL_NAME"
else
echo " β User 'javed' not found"
fi
echo ""
echo "3. Security Configuration:"
if sudo grep -q "ProjectMatrixAuthorizationStrategy" /var/lib/jenkins/config.xml; then
echo " β Project-based Matrix Authorization enabled"
else
echo " β Matrix Authorization not configured"
fi
echo ""
echo "4. Global Permissions Check:"
if sudo grep -q '<permission>hudson.model.Hudson.Administer:admin</permission>' /var/lib/jenkins/config.xml; then
echo " β admin has Administer permission"
fi
if sudo grep -q '<permission>hudson.model.Hudson.Read:javed</permission>' /var/lib/jenkins/config.xml; then
echo " β javed has Read permission"
fi
echo ""
echo "5. Anonymous User Check:"
if sudo grep -q 'anonymous' /var/lib/jenkins/config.xml; then
echo " β Anonymous user may have permissions"
else
echo " β No anonymous permissions found"
fi
echo ""
echo "6. Installed Authorization Plugin:"
if [ -d /var/lib/jenkins/plugins/matrix-auth ]; then
echo " β Matrix Authorization Strategy Plugin installed"
PLUGIN_VERSION=$(sudo grep 'Plugin-Version' /var/lib/jenkins/plugins/matrix-auth/META-INF/MANIFEST.MF | cut -d' ' -f2)
echo " Version: $PLUGIN_VERSION"
else
echo " β Matrix Authorization Plugin not found"
fi
echo ""
echo "7. Security Realm:"
if sudo grep -q 'HudsonPrivateSecurityRealm' /var/lib/jenkins/config.xml; then
echo " β Jenkins own user database enabled"
fi
echo ""
echo "8. Job Configuration:"
JOB_COUNT=$(sudo ls -1d /var/lib/jenkins/jobs/*/ 2>/dev/null | wc -l)
echo " Total jobs: $JOB_COUNT"
if [ $JOB_COUNT -gt 0 ]; then
for job in /var/lib/jenkins/jobs/*/config.xml; do
if [ -f "$job" ]; then
JOB_NAME=$(basename $(dirname "$job"))
if sudo grep -q "project-based security" "$job" 2>/dev/null; then
echo " β $JOB_NAME has project-based security"
fi
fi
done
fi
echo ""
echo "β VERIFICATION COMPLETE"
EOF
chmod +x verify-rbac.sh
./verify-rbac.sh
Expected output:
=== Jenkins RBAC Configuration Verification ===
1. Jenkins Users:
admin
javed
β Users file exists
2. User 'javed' Details:
β User 'javed' exists
Full Name: Javed
3. Security Configuration:
β Project-based Matrix Authorization enabled
4. Global Permissions Check:
β admin has Administer permission
β javed has Read permission
5. Anonymous User Check:
β No anonymous permissions found
6. Installed Authorization Plugin:
β Matrix Authorization Strategy Plugin installed
Version: 3.2.1
7. Security Realm:
β Jenkins own user database enabled
8. Job Configuration:
Total jobs: 1
β existing-job has project-based security
β VERIFICATION COMPLETE
All RBAC configuration verified! π
π Understanding Jenkins Authorization
Authorization Strategies
1. Anyone can do anything:
β No security
β Anonymous full access
β Not production-safe
Use: Never in production
2. Logged-in users can do anything:
β οΈ Basic authentication required
β οΈ No role separation
β οΈ All users have full access
Use: Small trusted teams only
3. Matrix-based security:
β Granular permissions
β Per-user control
β Only global permissions
β No per-job control
Use: Simple environments
4. Project-based Matrix Authorization (Our choice):
β Granular permissions
β Per-user control
β Global permissions
β Per-job permissions
Use: Enterprise environments β Best practice
5. Role-Based Strategy:
β Role definitions
β User assignment to roles
β Reusable permissions
β Easier management at scale
Use: Large teams with many users
Permission Types
Overall Permissions:
Administer:
- Full system access
- Manage Jenkins
- Install plugins
- Configure security
- Create/delete jobs
Configure:
- Change system settings
- Manage credentials
- Configure tools
Read:
- View dashboard
- See job list
- Access public pages
Job Permissions:
Read:
- View job configuration
- See build history
- Access workspace
Build:
- Trigger builds
- Build with parameters
Configure:
- Modify job settings
- Change pipeline
- Update SCM
Delete:
- Remove job
- Permanent action
Workspace:
- Browse workspace
- View files
Credentials Permissions:
Create:
- Add new credentials
Delete:
- Remove credentials
Manage Domains:
- Organize credentials
Update:
- Modify existing credentials
View:
- See credential metadata (not secrets)
Matrix Authorization Structure
Permission inheritance:
Global Permissions
βββ admin (Administer) β Full access
βββ javed (Read) β Limited access
βββ Anonymous (None) β No access
Job-Specific Permissions (overrides):
βββ Project A
β βββ admin (All)
β βββ javed (Read)
βββ Project B
βββ admin (All)
βββ javed (Read + Build)
Security Best Practices
User Management:
β Principle of least privilege
β Separate admin accounts
β Unique user credentials
β Regular access reviews
β Disable unused accounts
β Enforce strong passwords
Anonymous Access:
β Remove all permissions
β Disable anonymous browsing
β Require authentication
β Force login page
Admin Protection:
β Limited admin accounts
β Separate admin/user accounts
β Admin access logging
β 2FA for admins (if available)
π‘ Key Takeaways
β¨ Project-based Matrix enables granular control
β¨ Overall Read gives dashboard access only
β¨ Job Read allows viewing without modification
β¨ Anonymous removal prevents unauthorized access
β¨ Admin Administer maintains full control
β¨ Per-job security enables project isolation
β¨ Least privilege improves security posture
β¨ Matrix plugin required for advanced RBAC
π Quick Interview Questions
Q: What's the difference between Matrix-based and Project-based Matrix Authorization? A: Matrix-based: Global permissions only, applied uniformly across Jenkins. Project-based Matrix: Global permissions PLUS per-project permissions, enabling different access levels for different jobs. Project-based provides more granular control.
Q: Why remove anonymous user permissions? A: Security: Prevents unauthorized access to build information, job configurations, and system settings. Anonymous access can expose: source code, credentials, build logs, pipeline definitions. Production Jenkins should require authentication.
Q: What's the risk of granting "Overall Administer" permission? A: Full system control: install plugins, modify security, delete jobs, access all credentials, execute arbitrary code, shut down Jenkins. Only trusted administrators should have this permission. Use separate admin accounts.
Q: Can a user with only "Overall Read" create jobs? A: No. Overall Read allows: view dashboard, see job list, access Jenkins UI. Cannot: create jobs, build, configure, manage Jenkins. Need "Job Create" permission under Overall category for job creation.
Q: What happens if you give "Job Build" but not "Job Read"? A: User can trigger builds but cannot see job details, configuration, or build history. Unusual configuration. Typically: Read < Build < Configure < Delete (progressive permissions).
Q: How do per-project permissions override global permissions? A: Project permissions ADD to global permissions (don't subtract). If user has global "Overall Read" and project "Job Build", they can read globally AND build that specific project. Cannot restrict below global level.
Q: What's the security implication of "Workspace" permission? A: Allows browsing job workspace, viewing checked-out source code, build artifacts, temporary files. May expose: passwords in scripts, API keys in config files, sensitive data in files. Grant carefully.
Q: How do you handle user offboarding in Jenkins? A: (1) Disable user account (don't delete immediately), (2) Remove from all permission matrices, (3) Audit their job history, (4) Review credentials they created, (5) Update shared credentials, (6) Document access removal, (7) Delete account after retention period.
Q: Can you implement role-based access without plugins? A: Limited. Project-based Matrix provides basic RBAC (assign permissions per user/group). For true roles (define role, assign users to role), need Role-Based Authorization Strategy plugin. Matrix requires managing users individually.
Q: What's the purpose of "Configure" permission vs "Administer"? A: Configure: Modify Jenkins settings (tools, clouds, system properties) but cannot change security settings, install plugins, or manage users. Administer: Full unrestricted access including security. Configure is subset of Administer.
Advanced Questions:
Q: How does Jenkins handle permission precedence with multiple groups? A: Additive: User gets union of all permissions from all groups. If user in Group A (Read) and Group B (Build), they have Read + Build. No permission subtraction - always adding. Most permissive wins.
Q: What are the security risks of "Script Console" access? A: Execute arbitrary Groovy code with Jenkins server privileges: access file system, modify running jobs, read all credentials, install malware, disable security, create backdoors. Only admin should access. Equivalent to server root access.
Q: How do you audit permission changes in Jenkins? A: Enable audit trail plugin, review /var/lib/jenkins/config.xml history (version control), check Jenkins system log, monitor security events. Best practice: store config in Git with approval workflow.
Q: Can you implement LDAP/AD integration with Matrix authorization? A: Yes. Configure Security Realm (LDAP) and Authorization Strategy (Matrix) separately. LDAP authenticates users, Matrix controls permissions. Can reference LDAP groups in permission matrix. Best for enterprise environments.
Q: What's the performance impact of complex permission matrices? A: Each permission check queries matrix. Large matrices (hundreds of users/jobs) can slow Jenkins. Solutions: use groups instead of individual users, cache permissions, use Role-Based plugin for better performance, limit permission inheritance depth.
π Final Thoughts
You've successfully implemented Role-Based Access Control in Jenkins! This is enterprise security standard.
What you accomplished: β
Created user account (javed)
β
Installed Matrix Authorization plugin
β
Configured Project-based Matrix Authorization
β
Set Overall Read permission for javed
β
Removed Anonymous access completely
β
Retained admin Administer permissions
β
Configured job-specific Read permission
β
Tested access control
Security configuration:
Users:
βββ admin (Administer - Full access)
βββ javed (Read - Limited access)
βββ Anonymous (Removed - No access)
Global Permissions:
βββ admin: Overall Administer β
βββ javed: Overall Read β
βββ Anonymous: None β
Job Permissions:
βββ admin: All permissions β
βββ javed: Read only β
Real-world impact:
Least privilege (users have minimum needed access)
Audit trail (know who did what)
Compliance (meet security requirements)
Risk reduction (limit blast radius)
Team collaboration (safe delegated access)
Skills acquired:
User management
RBAC implementation
Matrix authorization
Permission configuration
Security best practices
Access control testing
Next steps:
Create more user roles
Implement LDAP integration
Enable audit logging
Setup credential management
Configure folder-level permissions
This is enterprise security excellence! πͺ
Day: 70/100
Challenge: KodeKloud Cloud DevOps
Date: January 14, 2026
Topic: Jenkins User Management & Authorization
How do you handle access control in your CI/CD? Share your RBAC strategies! π



