Jenkins Security And Backup Setup

Jenkins Security

In Jenkins, you have the ability to setup users and their relevant permissions on the Jenkins instance. By default, you will not want everyone to be able to define jobs or other administrative tasks in Jenkins. So Jenkins has the ability to have a security configuration in place.

To configure Security in Jenkins, follow the steps given below.

Step 1

Click on Manage Jenkins and choose the ‘Configure Global Security’ option.

Step 2

Click on Enable Security option. As an example, let’s assume that we want Jenkins to maintain its own database of users, so in the Security Realm, choose the option of ‘Jenkins’ own user database’.

By default you would want a central administrator to define users in the system, hence ensure the ‘Allow users to sign up’ option is unselected. You can leave the rest as it is for now and click the Save button.

Step 3

You will be prompted to add your first user. As an example, we are setting up an admin user for the system.

Step 4

It’s now time to setup your users in the system. Now when you go to Manage Jenkins, and scroll down, you will see a ‘Manage Users’ option. Click this option.

Step 5

Just like you defined your admin user, start creating other users for the system. As an example, we are just creating another user called ‘user’

Step 6

Now it’s time to setup your authorizations, basically who has access to what. Go to Manage Jenkins → Configure Global Security.

Now in the Authorization section, click on ‘Matrix based security’

Step 7

If you don’t see the user in the user group list, enter the user name and add it to the list. Then give the appropriate permissions to the user.

Click on the Save button once you have defined the relevant authorizations.

Your Jenkins security is now setup.

Jenkins Backup

Jenkins has a backup plugin that can be used to backup critical configuration settings related to Jenkins. Follow the steps given below to have a backup in place.

Step 1

Click on Manage Jenkins and choose the ‘Manage Plugins’ option

Step 2

In the available tab, search for ‘Backup Plugin’. Click On Install without Restart. Once done, restart the Jenkins instance

Step 3

Now when you go to Manage Jenkins, and scroll down you will see ‘Backup Manager’ as an option. Click on this option.

Step 4

Click on Setup.

Step 5

Here, the main field to define is the directory for your backup. Ensure it’s on another drive which is different from the drive where your Jenkins instance is setup. Click on the Save button.

Step 6

Click on the ‘Backup Hudson configuration’ from the Backup manager screen to initiate the backup.

The next screen will show the status of the backup

To recover from a backup, go to the Backup Manager screen, click on Restore Hudson configuration.

The list of backup’s will be shown, click on the appropriate one to click on Launch Restore to begin the restoration of the backup.