Jenkins Github oAuth 404 error in callback - github

i am trying to use Jenkins' Github oAuth plugin (https://wiki.jenkins-ci.org/display/JENKINS/Github+OAuth+Plugin)
Name: Name of app
URL: http://server:8080
Cacllback: http://server:8080/securityRealm/finishLogin
When i enable Github oAuth, it did pop up to say whether I want to allow this Appliation from Github, then I click Allow.
So the authenticate step went through, but I hit 404 because The requested resource (/securityRealm/finishLogin) is not available.
There is nothing in Tomcat manager that says securityRealm, is there something else I need to set up to use this plugin?

If you do not have jenkins served at server:port then the callback will not be present. More than likely you are serving from server:port/jenkins because you are using tomcat and this is what is specified in the web.xml for the jenkins war.
The callback location for your server is going to be
server:port/jenkins/securityRealm/finishLogin
if you are using a Servlet container like tomcat or jetty.

Be sure to have the plugin correctly configured in your settings.
After entering the Client ID and Client Secret you get from github and restarting Jenkins it should work.
I ran into the same problem and this worked for me.

When I was in the process of setting up the OAUTH plugin, I found it handy to check the /var/lib/jenkins/config.xml file for correct settings:
<securityRealm class="org.jenkinsci.plugins.GithubSecurityRealm">
<githubWebUri>https://github.com</githubWebUri>
<githubApiUri>https://api.github.com</githubApiUri>
<clientID>3d404d2blah42ruSerious27</clientID>
<clientSecret>{AQAwZXfnxuJQxEL9iEEXuXPmW5BdeadBeefBreDactedJMcw==}</clientSecret>
<oauthScopes>read:org,user:email</oauthScopes>
</securityRealm>

It seems the issue is you need to have a Security Realm set beforehand for the route to be available. I did the following steps to get it working:
Install Github Oauth plugin (restarted Jenkins for good measure)
Go to Manage Jenkins -> Configure Global Security
Tick Enable Security and choose Github Authentication Plugin
Under "Authorization", make sure "Anyone can do anything" and click Save at the bottom. (Previously, I filled in all of the settings and hit save, however I was still receiving a 404 and locked myself out).
At this point, I tried to hit http://:8080/securityRealm/finishLogin and it responded with a HTTP/1.1 302 Found.
After I confirmed I was not receiving a 404 any longer for the resource, I went back into "Configure Global Security" and setup the rest of the plugin with the Client ID and Client Secret, selected "Github Commiter Authorization Strategy" for Authorization, added my username, saved and now able to auth via Github.
Hope this helps.
Jenkins Version: version 1.558
Github Auth plugin: version 0.14

Related

Is there a way to import a Bamboo Spec file via the REST API?

I currently try to automate the process of creating a new Bamboo linked repository and start the scan. I've already looked over the documentation of the REST API, tried to generate a new plan and enabling a scan, but that didn't work.
I also tried the Java Maven Package from Atlassian, but that needs user credentials as an authentication method, whilst I need to authenticate via a Security token. There is a link to an API in that Maven Package, which I tried to send a request to with the yaml code, but it always responds with the status code 500 and a Java Stacktrace. It's probably due to a wrong request body, but I can't figure out, how to include the yaml content the same way, as the maven package.
Is there a way to create a linked repository via the REST API?
Thanks in advance!
Is there a way to create a linked repository via the REST API?
No and there won't ever be one because they're deprecating the Bamboo server in favour of their cloud-based alternative (which is based on a totally different API). See https://jira.atlassian.com/browse/BAM-18453
Java Maven Package from Atlassian
What package is that? Based on what I said earlier the only way for you to programmatically create a linked repo is to mimic the browser POST request to updateLinkedRepository.action. That means that you'll need to login first to get a JSESSIONID cookie (xsrf token can be disabled, see https://confluence.atlassian.com/bamkb/rest-api-calls-fail-due-to-missing-xsrf-token-899447048.html#RESTAPIcallsfailduetoMissingXSRFToken-Workaround). Ping me if you need help, I still have ansible code for the login part.

Unable to clone git repository in Eclipse using https and SSH links

While trying to clone a Git repository in Eclipse Luna, I'm getting the error shown below using the https link:
I added the said values in the Git configuration using this link - "SSL host could not be verified" error but I'm still getting the same error.
I'm sure that the URL is correct. Not too sure if there's something wrong with proxy settings (I don't think so).
On the other hand, I tried the ssh link by generating keys and putting them into the enterprise gitlab account and also on the pc (windows) but I'm still being unsuccessful doing that and getting the same error shown in the image below except for the last point.
I checked the error log, while using the https link it says 'not authorized' and 'Auth fail' when I try to use the ssh link.
I'm listed as the member of the repository and I'm using my email and password of the enterprise account to access it, but no luck.
Help much appreciated. Thank you.
First, if you are using a private GitHub Enterprise in an enterprise, SSH URLS are rarely allowed.
For HTTPS URLs, you need to make sure your proxy configuration ignore host setting in Eclipse includes the domain name of the GitHub Enterprise (on premise) private server, or it will try to contact the proxy every time (and fail)
I have face same problem. To resolve this problem make sure your repository access level is public. It will solve this issue.
Assuming that your company uses their own certificate authority, their root certificate has most probably been added to your computer's trust store. However, Java by default uses its own trust store, so Eclipse does not know about it.
The best solution is to make Eclipse use the system trust store. See this answer for Windows or this answer for macOS.

How to configure eclipse to access an endpoint over the SSL protocol?

When I access EndPoint within Google Chrome I get a response. Can you see in picture below:
When I try to access EndPoint from within eclipse. The following error occurs:
I configured the EndPoint certificate in eclipse. As shown in the figure below:
Is there another configuration needed to access the Endpoint within eclipse?
The Internet proxy was not configured in eclipse.
After configuring the proxy in eclipse it worked perfectly.
thanks :D

Invalid xml:base in Teamcity nuget feed

I try to setup teamcity nuget feed. But when i try download package form nuget server i get next error in VS output window:
when i try get definition of nuget feed i see next:
in Administration / Global settings / Server URL i have valid dmin name of my server. How can i change xml:base attribute in feed definition?
I don't think there is an issue with TeamCity. From what I can see you are hosting TeamCity locally on your development machine and you are successfully downloading your own packages (1st picture). The error that you are seeing in chrome is absolutely fine.
However the issue that it appears you are having is that you have not configured either VisualStudio or your solution in VisualStudio to download from more than one place. The package that is failing is NancyFx which presumably you are not hosting from TeamCity so therefore you need to go and get it from the public NuGet Server. In order to achieve this you either have to configure VisualStudio or your solution file to search multiple package sources.
https://docs.nuget.org/ndocs/tools/package-manager-ui#package-sources
From TeamCity support "Change base URL in FeedService":
It looks like you have a reverse proxy and it is not properly
configured. Please refer to TeamCity HowTo documentation about this:
https://confluence.jetbrains.com/pages/viewpage.action?pageId=74845225#HowTo...-SetUpTeamCitybehindaProxyServer
It seems HTTP proxy does not pass Host header correctly. When browser
makes a request it sets Host to hostname from browser address bar. If
proxy changes Host to something else, or removes it, then feed will
have URLs pointing to localhost, because TeamCity server does not know
that there is an HTTP proxy somewhere.
Please check that HTTP proxy preserves original Host header.

Cannot connect to SonarQube from Eclipse

I'm trying to connect my Eclipse IDE to my company's sonar server instance, but I can't figure out why it doesn't work.
When I access the server (https://mycompany.com/sonar, for example purposes) through the browser, it works perfectly. In Eclipse, I added the url to the servers section of SonarQube and the same credentials I used in the browser. When I hit Test Connection, I get the error message:
Unable to connect: Query: https://mycompany.com/sonar//api/authentication/validate
I'm using the native option in Eclipse's network settings, since I'm not behind any proxy. The company SonarQube server version is 4.5.5.
Am I doing something wrong? Does anyone know how to fix this?
Edit: the certificate is also added to JRE
I suspect the /api/aut is due to some UI truncation, just expand the 'Add SonarQube Server' window to verify that.
You are trying to connect to an HTTPS URL, is the server certificate trusted by Java ? Use keytool to do that, as explained in this post.
Check the sonar link you have configured in eclipse - https://mycompany.com/sonar**//**api/authentication/validate
You need to give the url https://mycompany.com/sonar and not https://mycompany.com/sonar/