#4016 password auth only works with explicit CLI parameters
Opened by trawets. Modified

Attempting to use password auth for a local koji setup, and have found that the user/password combination only works when set via the CLI.

~/.koji/config :

[koji]
;url of XMLRPC server
server = https://kojihub/kojihub
;url of web interface
weburl = https://kojihub/koji
;url of package download site
topurl = https://kojihub/kojifiles
;path to the koji top directory
topdir = /mnt/koji
authtype = password
user = foo
password = bar

try to say hello...

[kojihub@kojihub ~]$ koji -d moshimoshi
2024-02-18 18:54:46,676 [DEBUG] koji: Opening new requests session
Traceback (most recent call last):
  File "/usr/bin/koji", line 331, in <module>
    rv = locals()[command].__call__(options, session, args)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/koji_cli/commands.py", line 7474, in handle_moshimoshi
    activate_session(session, options)
  File "/usr/lib/python3.12/site-packages/koji_cli/lib.py", line 769, in activate_session
    session.login()
  File "/usr/lib/python3.12/site-packages/koji/__init__.py", line 2671, in login
    sinfo = self.callMethod('login', self.opts['user'], self.opts['password'], **kwargs)
                                     ~~~~~~~~~^^^^^^^^
KeyError: 'user'

but explicitly setting the user/password on the command line, it works!

$ koji -d --user foo --password bar moshimoshi
2024-02-18 18:56:11,396 [DEBUG] koji: Opening new requests session
successfully connected to hub
yo, foo!
You are using the hub at https://kojihub/kojihub
Authenticated via password

I'm running the packages from Fedora 39:

$ rpm -qa |grep koji
python3-koji-1.33.1-2.fc39.noarch
koji-1.33.1-2.fc39.noarch
python3-koji-hub-1.33.1-2.fc39.noarch
koji-hub-1.33.1-2.fc39.noarch
python3-koji-web-1.33.1-2.fc39.noarch
koji-web-1.33.1-2.fc39.noarch

the password auth option is only meant for testing or debugging. It should not be used in production.

Metadata Update from @mikem:
- Custom field Size adjusted to None

Yeah, this was all in service of setting up a local dev environment. VMs on a single machine, not even exposed over the network.

Hi, I fix it in PR #4445

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/koji/issues/4016

Please continue any further discussion there.

Metadata