Yubico / yubikey-manager-qt

Cross-platform application for configuring any YubiKey over all USB interfaces.
https://developers.yubico.com/yubikey-manager-qt/
BSD 2-Clause "Simplified" License
237 stars 30 forks source link

Cannot run ykman cli under another user context #333

Closed reuven-cohen closed 1 year ago

reuven-cohen commented 1 year ago

Steps to reproduce

su - $username -c '/Applications/YubiKey\ Manager.app/Contents/MacOS/ykman piv info'

or running the command via script via JAMF.

Expected result

I was expecting to get an output of info pertaining to the inserted YubiKey token similar to what happens when I run the basic command in terminal.

Actual results

qml: Return value of PyObject call is NULL: Traceback (most recent call last):

File "qrc:///py/cli.py", line 12, in run return main()

File "/Applications/YubiKey Manager.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/ykman/cli/main.py", line 378, in main cli(obj={})

File "/Applications/YubiKey Manager.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1128, in call return self.main(*args, **kwargs)

File "/Applications/YubiKey Manager.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/core.py", line 1034, in main _verify_python_env()

File "/Applications/YubiKey Manager.app/Contents/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/click/_unicodefun.py", line 100, in _verify_python_env raise RuntimeError("\n\n".join(extra))

RuntimeError: Click will abort further execution because Python was configured to use ASCII as encoding for the environment. Consult https://click.palletsprojects.com/unicode-support/ for mitigation steps.

This system lists some UTF-8 supporting locales that you can pick from. The following suitable locales were discovered: af_ZA.UTF-8, am_ET.UTF-8, be_BY.UTF-8, bg_BG.UTF-8, ca_ES.UTF-8, cs_CZ.UTF-8, da_DK.UTF-8, de_AT.UTF-8, de_CH.UTF-8, de_DE.UTF-8, el_GR.UTF-8, en_AU.UTF-8, en_CA.UTF-8, en_GB.UTF-8, en_IE.UTF-8, en_NZ.UTF-8, en_US.UTF-8, es_ES.UTF-8, et_EE.UTF-8, eu_ES.UTF-8, fi_FI.UTF-8, fr_BE.UTF-8, fr_CA.UTF-8, fr_CH.UTF-8, fr_FR.UTF-8, he_IL.UTF-8, hr_HR.UTF-8, hu_HU.UTF-8, hy_AM.UTF-8, is_IS.UTF-8, it_CH.UTF-8, it_IT.UTF-8, ja_JP.UTF-8, kk_KZ.UTF-8, ko_KR.UTF-8, lt_LT.UTF-8, nl_BE.UTF-8, nl_NL.UTF-8, no_NO.UTF-8, pl_PL.UTF-8, pt_BR.UTF-8, pt_PT.UTF-8, ro_RO.UTF-8, ru_RU.UTF-8, sk_SK.UTF-8, sl_SI.UTF-8, sr_YU.UTF-8, sv_SE.UTF-8, tr_TR.UTF-8, uk_UA.UTF-8, zh_CN.UTF-8, zh_HK.UTF-8, zh_TW.UTF-8

Other info

[Anything else you would like to add?]

dainnilsson commented 1 year ago

Using the embedded ykman CLI tool in the MacOS YubiKey Manager.app directory is no longer recommended. Instead, we recommend that you install ykman separately, either via Homebrew or our MacOS .pkg installer.

reuven-cohen commented 1 year ago

@dainnilsson Thanks, using the CLI installer and calling it from /usr/local/ykman/ykman worked.