Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jira plugin fails with Kerberos authentication #204

Open
psss opened this issue Oct 4, 2019 · 13 comments
Open

Jira plugin fails with Kerberos authentication #204

psss opened this issue Oct 4, 2019 · 13 comments

Comments

@psss
Copy link
Owner

psss commented Oct 4, 2019

After porting the code to Python 3 Jira plugin stopped working. Example config file:

[general]
email = Petr Šplíchal <psplicha@redhat.com>

[osci]
type = jira
project = OSCI
url = https://projects.example.com/

While with Python 2 issues are successfully fetched, Python 3 gives the following error:

 [ ERROR ] 500 Server Error: Internal Server Error for url:
 https://projects.example.com/step-auth-gss
@psss
Copy link
Owner Author

psss commented Oct 4, 2019

@frenzymadness, this is the Jira issue.

@frenzymadness
Copy link

It works for me

$ git pull origin master  # pull from my fork
From github.com:frenzymadness/did
 * branch            master     -> FETCH_HEAD
Already up to date.
[lbalhar@localhost did]$ python3 setup.py build
running build
running build_py
creating build
creating build/lib
creating build/lib/did
copying did/base.py -> build/lib/did
copying did/__init__.py -> build/lib/did
copying did/cli.py -> build/lib/did
copying did/utils.py -> build/lib/did
copying did/stats.py -> build/lib/did
creating build/lib/did/plugins
copying did/plugins/confluence.py -> build/lib/did/plugins
copying did/plugins/footer.py -> build/lib/did/plugins
copying did/plugins/header.py -> build/lib/did/plugins
copying did/plugins/nitrate.py -> build/lib/did/plugins
copying did/plugins/__init__.py -> build/lib/did/plugins
copying did/plugins/items.py -> build/lib/did/plugins
copying did/plugins/pagure.py -> build/lib/did/plugins
copying did/plugins/git.py -> build/lib/did/plugins
copying did/plugins/redmine.py -> build/lib/did/plugins
copying did/plugins/jira.py -> build/lib/did/plugins
copying did/plugins/google.py -> build/lib/did/plugins
copying did/plugins/rt.py -> build/lib/did/plugins
copying did/plugins/gitlab.py -> build/lib/did/plugins
copying did/plugins/trac.py -> build/lib/did/plugins
copying did/plugins/sentry.py -> build/lib/did/plugins
copying did/plugins/bugzilla.py -> build/lib/did/plugins
copying did/plugins/wiki.py -> build/lib/did/plugins
copying did/plugins/github.py -> build/lib/did/plugins
copying did/plugins/gerrit.py -> build/lib/did/plugins
copying did/plugins/trello.py -> build/lib/did/plugins
running build_scripts
creating build/scripts-3.7
copying and adjusting bin/did -> build/scripts-3.7
changing mode of build/scripts-3.7/did from 664 to 775
[lbalhar@localhost did]$ PYTHONPATH=build/lib/ bin/did this year
 ERROR  No module named 'googleapiclient'
Status report for this fiscal year (2019-03-01 to 2020-02-29).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Lumír Balhar <lbalhar@redhat.com>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Issues created in osci: 1
    * OSCI-504 - Jenkins installability check failed

* Issues created in tt: 1
    * TT-66 - [TEST] Issue for testing did

$ head bin/did
#!/usr/bin/python3
# coding: utf-8

My configuration contains two jira projects (OSCI and TT) from the internal Jira instance.

[general]
email = Lumír Balhar <lbalhar@redhat.com>

[osci]
type = jira
project = OSCI
url = <internal URL>

[tt]
type = jira
project = TT
url = <internal URL>

I've also tried a test witho your configuration and it also works:

$ PYTHONPATH=build/lib/ bin/did this year
 ERROR  No module named 'googleapiclient'
Status report for this fiscal year (2019-03-01 to 2020-02-29).

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Petr Šplíchal <psplicha@redhat.com>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Issues created in osci: 28

… etc …

I am running on Fedora 30, all updates installed. What do you think makes a difference?

@psss
Copy link
Owner Author

psss commented Oct 18, 2019

Interesting. After reinstalling with pip -e . I was able to fetch the stats. But when repeated once more the query failed. Third time worked again. It behaves in some non-deterministic way. Need to investigate more.

@psss
Copy link
Owner Author

psss commented Oct 18, 2019

Works reliably when packaged as rpm though. Perhaps something wrong in the dependencies? Also, when running under venv I need to:

export REQUESTS_CA_BUNDLE=/etc/pki/tls/certs/ca-bundle.crt

Otherwise it fails with CERTIFICATE_VERIFY_FAILED. Could this be related?

@lukaszachy
Copy link
Collaborator

lukaszachy commented Nov 1, 2019

Does it work for you these days? Since Oct 30 we have troubles to connect also with python2 version.

500 Server Error: Internal Server Error for url:<internal URL>/step-auth-gss

I'm not sure whether direct (as by web browser) access of that URL should work, but it ends up with 500 as well. When I didn't have kinit it was returning 401.

@frenzymadness
Copy link

IIRC the URL was working in browser and IMHO it should so it might be a problem in Jira.

@lukaszachy
Copy link
Collaborator

Thanks. Looks that gss-api access to Jira instance was cancelled and we are advised to use Local Account (or so was the answer in the Ticket).

@psss
Copy link
Owner Author

psss commented Nov 4, 2019

Interesting, I was able to connect to Jira using the python jira module:

from jira import JIRA

options = {"server": "https://example.com/"}
jira = JIRA(options, kerberos=True)

issue = jira.issue('TT-1')
print(issue.fields.summary)

So it seems kerberos authentication is not turned off... We could possibly update did to use jira python module. Need to check what is the recommended single-sign-on way.

@psss psss changed the title Jira plugin fails with Python 3 Jira plugin fails with Kerberos authentication Nov 18, 2019
@lukaszachy
Copy link
Collaborator

Copying here Standa Zidek's comment from the email:

I was able to fix my scripts just by changing '/step-auth-gss' to '/rest/auth/1/session'

@psss
Copy link
Owner Author

psss commented Nov 19, 2019

I tried that already but it doesn't seem to help.

lukaszachy added a commit to lukaszachy/did that referenced this issue Nov 19, 2019
lukaszachy added a commit to lukaszachy/did that referenced this issue Nov 19, 2019
@lukaszachy
Copy link
Collaborator

Hm, I've patched jira.py but for some projects I'm having

DEBUG  Connecting to <internal url>
Traceback (most recent call last):
  File "/usr/local/bin/did", line 42, in <module>
    did.cli.main()
  File "/usr/local/lib/python3.7/site-packages/did/cli.py", line 210, in main
    user_stats.check()
  File "/usr/local/lib/python3.7/site-packages/did/stats.py", line 157, in check
    stat.check()
  File "/usr/local/lib/python3.7/site-packages/did/stats.py", line 157, in check
    stat.check()
  File "/usr/local/lib/python3.7/site-packages/did/stats.py", line 77, in check
    self.fetch()
  File "/usr/local/lib/python3.7/site-packages/did/plugins/jira.py", line 141, in fetch
    self.stats = Issue.search(query, stats=self)
  File "/usr/local/lib/python3.7/site-packages/did/plugins/jira.py", line 104, in search
    batch, listed(data["issues"], "issue")))
KeyError: 'issues'

Returned data are
{'errorMessages': ["The value 'PROJECT' does not exist for the field 'project'."], 'errors': {}}

Funny it worked for one project, but not the others :/ Seems as permission issue.

@thrix
Copy link

thrix commented Dec 15, 2019

So we do not have yet any working solution?

@psss
Copy link
Owner Author

psss commented Jan 6, 2020

Only to use login and password. See the internal did wiki for more details.

psss added a commit to mweetman-redhat/did that referenced this issue Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants