"Trigger builds remotely" does not appear after installing Build Token Root Plugin in Jenkins - jenkins

I have installed Build Token Root Plugin (Version 1.2) in Jenkins. But the "Trigger builds remotely" options doesn't appear.
The end goal is to trigger Jenkins from SlackBot. I followed this tutorial.
I must be doing something very silly. Please help.
Stackoverflow articles referred with no vain
Hudson - missing Trigger builds remotely option
Triggering builds remotely in Jenkins

You need to read it: Quick and Simple Security
Enable the security setting, go to http://yourhost/jenkins/configureSecurity and select enable security, then choose Delegate to servlet container for security realm and Legacy mode for authorization strategy. Or, you may click on the Manage Jenkins link on the left side of the main Jenkins dashboard page to get to the configuration page, then click Configure Global Security.
To log into Jenkins go to http://yourhost/jenkins/loginEntry, or click on the login link located on the top right hand corner of any Jenkins Dashboard page.
This will bring you to the Login page. Enter the user name and password, and click on the Submit button. This will take you back to the main Jenkins dashboard. You will now see the Manage Jenkins link on the left side of the page.
To logout simply click the logout link located on the top right hand corner of any Jenkins dashboard page.
Anonymous read access required
The preceding instructions require that anonymous users have read access to Jenkins. If you disable overall read access for anonymous users, the Build Token Root Plugin allows use of tokens.

Be carreful while applying the accepted answer. It locked me out of Jenkins.
Here is an alternative:
* Security Realm: Jenkins' own user database (uncheck Allow users to sign up)
* Authorization: Logged-in users can do anything
The “Trigger builds remotely” then appears.

Related

How to remove Credentials section from Jenkins homepage?

I currently have the Jenkins Credentials plugin installed on an apache webserver. The global jenkins security is set to "logged in users can do everything" and anonymous users can only read.
I want to remove this section from the homepage on the left side:
How can I achieve this?
Under 'Configure Global Security', try changing from 'Logged in users can do anything' to 'Matrix-based security' or 'Project-based Matrix Authorization Strategy', and you should see a table that allows you to disable the credentials options for authenticated users.
https://jenkins.io/doc/book/using/using-credentials/#configuring-credentials
Although if you're an admin I think it shows up regardless.

Jenkins: Limit Credentials to 'Manage Jenkins > Configure System'

We would like to use the GitHub Pull Request Builder plugin in Jenkins, however in order to use this plugin you are required to enter credentials in the 'Manage Jenkins > Configure System' section that gives access to a given GitHub Enterprise server.
Our issue is that credentials giving access to all of github are too strong to be stored in the credentials manager. I know that you can limit the scope of credentials by using the Folders plugin, however this just limits access to those credentials to jobs in certain folders. Is there a way to restrict credentials so they can only be used in the 'Manage Jenkins > Configure System' section?
Our issue is that credentials giving access to all of github are too strong to be stored in the credentials manager.
This is why you can also use a Personal Access Token. Check the documentation for the plugin at: https://go.cloudbees.com/docs/plugins/pull-request-builder-for-github/. This is not the official plugin page but having read both, this one keeps to the best practices in terms of credentials. The important bits are:
Go to your GitHub settings page.
In the left sidebar, click Personal Access Token.
Click Generate new token.
Give your token a descriptive name
Select the scopes to grant to this token. Pull request tester plugin require permission to administer repository hooks and access repositories: repo, public_repo, admin:repo_hook, repo:status.
Then you can follow the rest of the guide to enter the token in the plugin configuration pages.
Hope this helps.

How to create a user in jenkins?

I just installed Jenkins in my machine running Ubuntu.
But when I access http://localhost:8080/ jenkins asks me for my username and password... but I have no idea what they are!
How can I log in Jenkins? (Sorry for the noob question, first time using Jenkins)
Any help is welcome!
Edit: So far I got this:
I can remove security by changing the config.xml setting
<useSecurity>true</useSecurity>
to
<useSecurity>false</useSecurity>
And now I can access my Jenkins... But I still dont know how to create a user =/
in jenkins go to Manage Jenkins > Configure Global Security and select the "Enable Security" check box.
select "Jenkins Own User Database" for the security realm and then select "Logged in Users can do anything" or a matrix based strategy (If you have multiple users with different permissions) for the Authorization.
Once you log in Jenkins as admin, Manage Jenkins > Configure Global Security and select the "Enable Security" check box. select "Jenkins Own User Database" for the security realm under access control and then select "Logged in Users can do anything" under Authorization and Save it.
click on Manage jenkins>>Manage User >> Create User
Complete the details.
Jenkins asks me for my username and password... but I have no idea what they are!
It depends how you configured Jenkins Access Control/Security Realm in your Configure Global Security page which determines the user authentication method, whether to use Jenkins own independent user database or external database (such as LDAP, Active Directory, Unix NIS, etc.).
If its using its own database, you can try to decrypt Jenkins passwords from credentials.xml. Otherwise disable useSecurity in your config.xml file, restart Jenkins and follow the steps. You should be asked to provide the initial password from the initialAdminPassword file (if you don't, make sure you've changed the right file and restarted Jenkins correctly).
To create user, you need to go to select your authentication method in Configure Global Security and create user either externally or if you've selected Jenkins’ own user database and tick Allow users to sign up, then hit Save button which would allow you to create user from the Jenkins interface.
Login to your Jenkins server via web URL. (http://jenkins_ip or jenkins_url:8080)
Jenkins >> Manage Jenkins >> Manage Users >> Create User >> Provide the username, password, email & click on Create User.
To edit or reset or modify the password of the Jenkins' own user database users,
Jenkins >> Manage Jenkins >> Manage Users >> Click the user-id from the existing user list >> Configure >> Save
You should find a file in secrets folder called initialAdminPassword with the info
Steps to create a new user
Login into Jenkins
Go to Manage Jenkins
Go to Create Users
Enter all the details – Username, Password, Confirm Pwd, FullName, Email
Select Create User
This LINK has detailed steps on how to create Jenkins user.
Here is the summary:
After setting
<useSecurity>false</useSecurity>
Restart Jenkins:
sudo systemctl restart jenkins
Click on People on the left-hand navigation menu.
Click on the Admin. (Skip and move on to step 4 if you don't have any user).
Delete the user account.
Navigate to Jenkins / Manage Jenkins.
Click on Configure Global Security
Check the Enable Security check box. (If you don't have this item, skip and move on to next and you will able to create/add user)
Under Security Realm, select Jenkins’ own user database
In the Authorization section, select Logged-in users can do
anything.
Unselect Allow anonymous read access.
Click Save to save your changes.
By default Jenkins uses it's own database for user management.
Go to People on Jenkins dashboard to see Users that you have, if you are not able to find an option to add user there, don't be disheartened, read on.
Go to Manage Jenkins and scroll down to bottom, second last option should be Manage Users.
By default every logged-in user can do anything, to change this, go to Manage Jenkins -> Configure Global Security -> Access Control -> Authorization -> Matrix-based security
AT THIS POINT IF YOU DON'T KNOW WHAT TO DO, PLEASE DON'T MAKE ANY CHANGES. DON'T SAVE OR APPLY.

Jenkins: Use personal credentials for project

I'm hosting a project on my Jenkins server. That project has a GitHub repo and I have it set up so it automatically builds new commits. In order for that to work, I need to input credentials for a github account that has full access to the repo.
The problem is, that if I want him to add his login info to the credentials list, I'd have to give him acces to all credentials on the server (I don't want that).
I tried using the credentials under "{username}" > "Credentials", but those didn't show up in the project setup (even with 100% access to everything on the server).
Is there a way for the user to store his credentials and use them for the project without giving him full access to all credentials on the server?
Add the user's credentials under Global security and then allow project based Matrix Authorization Strategy per project as shown:
I found the answer in this mailing list entry:
In short: You need to
install and activate the Authorize Projects Plugin,
enable "run as specific user" strategy in global security settings,
enable this for the project in question.
This allows you to use the credentials for this specific user.
Enabling ssh-agent is the final step to make this work conveniently.

How can I set the jenkins authentication token?

On my Jenkins build server, I want to set an Authentication Token so that only users that know the token can fire off builds. (As described here.)
This doc page says that it should be configurable under my job's "Build Triggers" configuration.
However, my server has no such fields, and I'm running the latest version (1.546). Mine looks like this:
.
As you can see, this doesn't really look like the docs say it should.
How can I set this token?
You're missing the Trigger builds remotely (e.g., from scripts) Build Trigger:
This is only visible with Security enabled. To get this option from a freshly downloaded 1.546 WAR, I changed Configure Global Security from Anyone can do anything to at least Logged-in users can do anything. For ease/speed of testing, under Security Realm I selected Jenkins’ own user database and Allow users to sign up:
You can go to http://Jenkins-IP/jobs/me/configure to check and change your API access token. Also check whether the user you intend to use has necessary permissions to execute the builds in Manage Jenkins>Configure Global Security
Each jenkins user gets an authentication token - applicable since version 1.426 (more).
You can see yours, provided you are logged in your jenkins server, at http://your.jenkins.server/me/configure
(press 'show API token' button)
Then you can copy and paste it in your scripts (e.g. see here for an example usage).

Resources