HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/auth/__pycache__/yubico.cpython-310.pyc
o

�N�g��@s�dZddlZe�e�ZzddlmZmZdZWne	y"dZYnwdd�Z
dd	�Zd
d�ZedkrMd
dddd�iiZ
edd�rGed�dSed�dSdS)a
Provide authentication using YubiKey.

.. versionadded:: 2015.5.0

:depends: yubico-client Python module

To get your YubiKey API key you will need to visit the website below.

https://upgrade.yubico.com/getapikey/

The resulting page will show the generated Client ID (aka AuthID or API ID)
and the generated API key (Secret Key). Make a note of both and use these
two values in your /etc/salt/master configuration.

  /etc/salt/master

  .. code-block:: yaml

    yubico_users:
      damian:
        id: 12345
        key: ABCDEFGHIJKLMNOPQRSTUVWXYZ


  .. code-block:: yaml

    external_auth:
      yubico:
        damian:
          - test.*


Please wait five to ten minutes after generating the key before testing so that
the API key will be updated on all the YubiCloud servers.

�N)�Yubico�yubico_exceptionsTFcCsVi}ztd�|d�rttd|���\|d<|d<W|SWdSty*YdSw)z1
    Grab the YubiKey Client ID & Secret Key
    �yubico_usersN�id�key)�__opts__�get�list�values�KeyError)�username�user�r�D/opt/saltstack/salt/lib/python3.10/site-packages/salt/auth/yubico.py�__get_yubico_users3s���rc
Cs\t|�}t|d|d�}z|�|�WStjy-}z
t�d|�WYd}~dSd}~ww)z,
    Authenticate against yubico server
    rrzUnable to verify YubiKey `%s`NF)rrZverifyrZStatusCodeError�log�info)r�passwordZ_cred�client�errr�authFs��rcOsdS)NFr)r�args�kwargsrrr�groupsUsr�__main__rZdamianZ12345ZABC123)rrZOPTZ
AuthenticatedzFailed to authenticate)�__doc__�logging�	getLogger�__name__rZ
yubico_clientrrZ
HAS_YUBICO�ImportErrorrrrr�printrrrr�<module>s$&
�
�