HXTool icon indicating copy to clipboard operation
HXTool copied to clipboard

Background scheduler credentials bug

Open belteguese0 opened this issue 3 years ago • 3 comments

Hi, I use 4.8-pre release and when I try to set Background Scheduler Credential here https://github.com/fireeye/HXTool/wiki/Background-Scheduler-Credentials the web UI raises an Internal Server Error Page.

ERROR:

2022-03-18 16:57:13,832] {app} {Thread-16441} ERROR - Exception on /settings [POST]

Traceback (most recent call last):

 File "/usr/lib/python3.7/[getpass.py](https://getpass.py/)", line 69, in unix_getpass

  old = termios.tcgetattr(fd)   # a copy to save

termios.error: (25, 'Inappropriate ioctl for device')

 

During handling of the above exception, another exception occurred:

 

Traceback (most recent call last):

 File "/usr/local/lib/python3.7/dist-packages/flask/[app.py](https://app.py/)", line 2070, in wsgi_app

  response = self.full_dispatch_request()

 File "/usr/local/lib/python3.7/dist-packages/flask/[app.py](https://app.py/)", line 1515, in full_dispatch_request

  rv = self.handle_user_exception(e)

 File "/usr/local/lib/python3.7/dist-packages/flask/[app.py](https://app.py/)", line 1513, in full_dispatch_request

  rv = self.dispatch_request()

 File "/usr/local/lib/python3.7/dist-packages/flask/[app.py](https://app.py/)", line 1499, in dispatch_request

  return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)

 File "/home/calogon/HXTool-master/hxtool_util.py", line 52, in is_session_valid

  ret = f(*args, **kwargs)

 File "/home/calogon/HXTool-master/[hxtool.py](https://hxtool.py/)", line 451, in settings

  hxtool_global.hxtool_scheduler.add_task_api_session(session['ht_profileid'], hx_api_object.hx_host, hx_api_object.hx_port, request.form.get('bguser'), request.form.get('bgpass'))

 File "/home/calogon/HXTool-master/hxtool_scheduler.py", line 131, in add_task_api_session

  keyring.set_password("hxtool_{}".format(profile_id), username, password)

 File "/usr/lib/python3/dist-packages/keyring/[core.py](https://core.py/)", line 63, in set_password

  _keyring_backend.set_password(service_name, username, password)

 File "/usr/lib/python3/dist-packages/keyring/backends/[chainer.py](https://chainer.py/)", line 53, in set_password

  return keyring.set_password(service, username, password)

 File "/usr/lib/python3/dist-packages/keyrings/alt/file_base.py", line 135, in set_password

  password_encrypted = self.encrypt(password.encode('utf-8'), assoc)

 File "/usr/lib/python3/dist-packages/keyrings/alt/[file.py](https://file.py/)", line 206, in encrypt

  cipher = self._create_cipher(self.keyring_key, salt, IV)

 File "/usr/lib/python3/dist-packages/keyring/util/[properties.py](https://properties.py/)", line 58, in __get__

  return self.fget(obj)

 File "/usr/lib/python3/dist-packages/keyrings/alt/[file.py](https://file.py/)", line 98, in keyring_key

  self._init_file()

 File "/usr/lib/python3/dist-packages/keyrings/alt/[file.py](https://file.py/)", line 105, in _init_file

  self.keyring_key = self._get_new_password()

 File "/usr/lib/python3/dist-packages/keyrings/alt/[file.py](https://file.py/)", line 59, in _get_new_password

  "Please set a password for your new keyring: ")

 File "/usr/lib/python3.7/[getpass.py](https://getpass.py/)", line 91, in unix_getpass

  passwd = fallback_getpass(prompt, stream)

 File "/usr/lib/python3.7/[getpass.py](https://getpass.py/)", line 126, in fallback_getpass

  return _raw_input(prompt, stream)

 File "/usr/lib/python3.7/[getpass.py](https://getpass.py/)", line 148, in _raw_input

  raise EOFError

belteguese0 avatar Mar 21 '22 09:03 belteguese0

Hi @belteguese0 - Which version of keyring are you using?

Thanks, Elazar

B0fH avatar Mar 29 '22 16:03 B0fH

Hi @B0fH, this version:

root@XXXXX:~# pip list| grep keyring keyring 17.1.1 keyrings.alt 3.1.1

Which are the steps to configure keyring? It's possible that is not properly configured as hxtool expected.

Thanks Emanuele

belteguese0 avatar Mar 30 '22 13:03 belteguese0

Hi @belteguese0 - The issue here is that you have HXTool deployed on a headless Linux system - which is fine - however, keyring is falling back to a file based keystore which it's prompting for a password. Kindly see https://keyring.readthedocs.io/en/latest/#using-keyring-on-headless-linux-systems for solution.

Thanks, Elazar

B0fH avatar Sep 15 '22 18:09 B0fH