teamcity-web-parameters icon indicating copy to clipboard operation
teamcity-web-parameters copied to clipboard

Authentication failures to secure Jenkins

Open Jaff opened this issue 8 years ago • 9 comments

Hi, trying to authenticate to Jenkins on https, I am getting failure even with correct login credentials. I attempted using curl and the method returning correct results is: curl -g --basic -u 'user:pass' 'https:////api/json?tree=lastBuild[number,description]'

Any way to get the extra param '-g' in there?

Jaff avatar Jan 17 '17 00:01 Jaff

Hello!

Thank you for your bug request. I will try to address this problem soon. In a meanwhile, could you please try to use escaped url in configuration, like

https://<YOURHOSTNAME>/api/json?tree=lastBuild%5Bnumber,description%5D

Also, could you please have a look at the logs and check for some stacktrace? It would help much to figure out original problem.

grundic avatar Jan 19 '17 10:01 grundic

Thanks, I will try that. I'll also need to run another query, filtering jobs with descriptions including specific text (for branch) but I'm not confident with my json skills.

Sent from my iPhone

On Jan 19, 2017, at 02:55, Grigory Chernyshev [email protected] wrote:

Hello!

Thank you for your bug request. I will try to address this problem soon. In a meanwhile, could you please try to use escaped url in configuration, like

https://<YOURHOSTNAME>/api/json?tree=lastBuild%5Bnumber,description%5D — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Jaff avatar Jan 19 '17 17:01 Jaff

That did not help. nothing in logs, but the parameters dialog contained this after I changed the tree=lastBuild%5Bnumber,description%5D to tree=builds%5Bnumber,description%5D: Failed to parse Json format com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "builds" (class ru.mail.teamcity.web.parameters.data.Options), not marked as ignorable (one known property: "options"]) at [Source: org.apache.http.client.entity.LazyDecompressingInputStream@3a734b83; line: 1, column: 12] (through reference chain: ru.mail.teamcity.web.parameters.data.Options["builds"]) FWIW, the above query succeeds with a curl request in shell.

Jaff avatar Jan 24 '17 01:01 Jaff

Do we have any update on this problem? Are you able to reproduce?

Jaff avatar Jan 31 '17 22:01 Jaff

Hi @Jaff, I've tried to use the url http://localhost:8099/options.json?tree=lastBuild[number,description] and I have seen no errors: request was done and options were shown. Does you Jenkins uses self signed certificated and maybe you have to use -k, --insecure option? I will try to run the plugin on some SSL server, maybe that's the case.

grundic avatar Feb 01 '17 07:02 grundic

I do not use -k when making curl request; I am fairly certain cert is self-signed, but is not publically available. Using -g with curl avoids escaping square brackets. Any change I can make in existing plugin to help?

Jaff avatar Feb 01 '17 18:02 Jaff

Can you please provide more details, so I could debug it?

  • Full url that you are using (I've tried with https://server/job/folder/job/build/api/json?tree=lastBuild[number,description])
  • Response from the Jenkins. For me it looks like
{
"_class": "hudson.model.FreeStyleProject",
"lastBuild": {
"_class": "hudson.model.FreeStyleBuild",
"description": null,
"number": 1
}
}
  • Do you have any errors on screen (where the field should be rendered) or in the logs?

grundic avatar Feb 03 '17 17:02 grundic

You have seen errors above, nothing in logs. Perhaps it is Jenkins version to blame, our server is running 1.626

Jaff avatar Feb 04 '17 05:02 Jaff

What response do you get from Jenkins? By default, plugin expects the response to be in specific format and won't accept arbitrary json data.

grundic avatar Feb 07 '17 10:02 grundic