grundic / teamcity-web-parameters

Teamcity plugin that provides dynamic parameters for builds from web service
MIT License
44 stars 16 forks source link

Authentication failures to secure Jenkins #18

Open Jaff opened 7 years ago

Jaff commented 7 years ago

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?

grundic commented 7 years ago

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.

Jaff commented 7 years ago

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 notifications@github.com 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:///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 commented 7 years ago

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 commented 7 years ago

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

grundic commented 7 years ago

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.

Jaff commented 7 years ago

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?

grundic commented 7 years ago

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

Jaff commented 7 years ago

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

grundic commented 7 years ago

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.