View Issue Details

IDProjectCategoryView StatusLast Update
0001207bareos-coreGeneralpublic2022-07-13 11:54
Reporterbigz Assigned Tobruno-at-bareos  
Status closedResolutionwon't fix 
PlatformLinuxOSanyOS Version5
Product Version19.2.6 
Summary0001207: python-bareos do not work anymore after sslpsk improvement
DescriptionI have a crash when I use 19.2.6 version of python-version in a TLS-PSK configuration.
Look at the crash message that come from sslpsk dependency => "CRITICAL Exception raised: <method 'do_handshake' of '_ssl._SSLSocket' objects> returned a result with an error set"
sslpsk dependency introduce a use of binary use of identity and password (

I do a fix in my fork github repo (

I plan to push a pull request on the officiel repo in order to fix the problem. I need your opinion before.
Steps To Reproducebuild a venv with sslpsk master branch

-> % git clone --quiet
-> % cd bareos/python-bareos
-> % python --quiet install [master|]
zip_safe flag not set; analyzing archive contents...
bareos.__pycache__.__init__.cpython-37: module references __file__
-> % git clone --quiet
-> % cd sslpsk
-> % python --quiet install
-> % pip list [test|]
Package Version
--------------- -------
Click 7.0
elasticsearch 7.5.1
pip 20.0.2
python-bareos 18.2.5
python-dateutil 2.8.1
setuptools 39.0.1
six 1.14.0
sslpsk 1.0.0
urllib3 1.25.8
-> % cd ../bareos/python-bareos/bin
-> % python -d --name bareos-dir --port 9101 --address bareos-dir -p $PASS --tls-psk-require [master|]
DEBUG bconsole.<module>: options: {'name': 'bareos-dir', 'password': 'VT4NzHnQ9w5SDid0', 'port': '9101', 'address': 'bareos-dir', 'protocolversion': 2, 'tls_psk_require': True}
DEBUG lowlevel.__init__: init
DEBUG lowlevel.__connect_plain: connected to bareos-dir:9101
DEBUG lowlevel.__connect_tls_psk: identity = R_CONSOLEbareos-dir, password = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TypeError: a bytes-like object is required, not 'str'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "", line 34, in <module>
    director = bareos.bsock.DirectorConsole(**bareos_args)
  File "/home/mathieu/.pyenv/versions/test-bareos/lib/python3.7/site-packages/python_bareos-18.2.5-py3.7.egg/bareos/bsock/", line 120, in __init__
    self.connect(address, port, dirname, ConnectionType.DIRECTOR, name, password)
  File "/home/mathieu/.pyenv/versions/test-bareos/lib/python3.7/site-packages/python_bareos-18.2.5-py3.7.egg/bareos/bsock/", line 108, in connect
    return self.__connect()
  File "/home/mathieu/.pyenv/versions/test-bareos/lib/python3.7/site-packages/python_bareos-18.2.5-py3.7.egg/bareos/bsock/", line 126, in __connect
  File "/home/mathieu/.pyenv/versions/test-bareos/lib/python3.7/site-packages/python_bareos-18.2.5-py3.7.egg/bareos/bsock/", line 206, in __connect_tls_psk
  File "/home/mathieu/.pyenv/versions/test-bareos/lib/python3.7/site-packages/sslpsk-1.0.0-py3.7-linux-x86_64.egg/sslpsk/", line 110, in wrap_socket
  File "/home/mathieu/.pyenv/versions/3.7.1/lib/python3.7/", line 1117, in do_handshake
SystemError: <method 'do_handshake' of '_ssl._SSLSocket' objects> returned a result with an error set

Additional Information    Director configuration:
Director {
  Name = @@DIR_NAME@@-dir
  DIRport = 9101 # where we listen for UA connections
  QueryFile = "/usr/lib/bareos/scripts/query.sql"
  WorkingDirectory = "/var/spool/bareos"
  PidDirectory = "/var/run"
  Password = "@@DIR_PASSWORD@@" # Console password
  Messages = Daemon
  Auditing = yes
  TLS Enable = yes
  TLS Require = yes
  TLS DH File = /etc/ssl/dh1024.pem
  TLS CA Certificate File = /etc/ssl/certs/ca-bundle.crt
  TLS Key = /etc/ssl/private/client.key
  TLS Certificate = /etc/ssl/certs/client.pem
TagsNo tags attached.
bareos-master: impact
bareos-master: action
bareos-19.2: impact
bareos-19.2: action
bareos-18.2: impact
bareos-18.2: action
bareos-17.2: impact
bareos-17.2: action
bareos-16.2: impact
bareos-16.2: action
bareos-15.2: impact
bareos-15.2: action
bareos-14.2: impact
bareos-14.2: action
bareos-13.2: impact
bareos-13.2: action
bareos-12.4: impact
bareos-12.4: action




2020-03-09 20:31

reporter   ~0003892

little up for this issue


2022-05-28 19:31

reporter   ~0004629

Last edited: 2022-05-28 19:48

This error appears when the python script can't connect, possibly the username or password is incorrect.
login and password must match:

#!/usr/bin/env python2
import bareos.bsock
directorconsole=bareos.bsock.DirectorConsole(address='localhost', port=9101, name='admin', password='123')


2022-06-01 21:31

reporter   ~0004632

ok thank you


2022-07-13 11:51

developer   ~0004661

I will close it due to lack of PR presented in our code. Feel free to reopen against current master with python3, if still needed.


2022-07-13 11:54

developer   ~0004662

no PR presented in our github code repository. Feel free to reopen against current master with python3, if still needed.

Issue History

Date Modified Username Field Change
2020-02-29 14:27 bigz New Issue
2020-03-09 20:31 bigz Note Added: 0003892
2022-05-28 19:31 khvalera Note Added: 0004629
2022-05-28 19:48 khvalera Note Edited: 0004629
2022-06-01 21:31 bigz Note Added: 0004632
2022-07-13 11:51 bruno-at-bareos Note Added: 0004661
2022-07-13 11:54 bruno-at-bareos Assigned To => bruno-at-bareos
2022-07-13 11:54 bruno-at-bareos Status new => closed
2022-07-13 11:54 bruno-at-bareos Resolution open => won't fix
2022-07-13 11:54 bruno-at-bareos Note Added: 0004662