Problem with TLS and python bareos client

52 views
Skip to first unread message

Math Bigz

unread,
Dec 12, 2019, 2:47:32 PM12/12/19
to bareos-users
Hello

I have problem to use python-bareos  module with my TLS configuration director

When I run bconsole.py script with TLS PSK activated I have this result :

-> % python bconsole.py -d --name bareos-dir --port 9101 --address bareos-dir -p $PASS --tls-psk-require
DEBUG bconsole
.<module>: options: {'name': 'bareos-dir', 'password': 'xxxxxxxx', '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
Traceback (most recent call last):
 
File "bconsole.py", line 28, in <module>
    director
= bareos.bsock.DirectorConsole(**bareos_args)
 
File "/home/user/Downloads/bareos/python-bareos/bareos/bsock/directorconsole.py", line 99, in __init__
   
self.connect(address, port, dirname, ConnectionType.DIRECTOR, name, password)
 
File "/home/user/Downloads/bareos/python-bareos/bareos/bsock/lowlevel.py", line 104, in connect
   
return self.__connect()
 
File "/home/user/Downloads/bareos/python-bareos/bareos/bsock/lowlevel.py", line 119, in __connect
   
self.__connect_tls_psk()
 
File "/home/user/Downloads/bareos/python-bareos/bareos/bsock/lowlevel.py", line 191, in __connect_tls_psk
    server_side
=False)
 
File "/home/user/.virtualenvs/bareos/lib/python3.7/site-packages/sslpsk/sslpsk.py", line 106, in wrap_socket
    _ssl_set_psk_client_callback
(sock, cb)
 
File "/home/user/.virtualenvs/bareos/lib/python3.7/site-packages/sslpsk/sslpsk.py", line 73, in _ssl_set_psk_client_callback
    ssl_id
= _sslpsk.sslpsk_set_psk_client_callback(_sslobj(sock))
 
File "/home/user/.virtualenvs/bareos/lib/python3.7/site-packages/sslpsk/sslpsk.py", line 55, in _sslobj
   
return sock._sslobj._sslobj
AttributeError: '_ssl._SSLSocket' object has no attribute '_sslobj'


When I run bconsole.py script without TLS I have this result:

-> % python bconsole.py -d --name bareos-dir --port 9101 --address bareos-dir -p $PASS 
/home/user/Downloads/bareos/python-bareos/bareos/bsock/lowlevel.py:38: UserWarning: Connection encryption via TLS-PSK is not available, as the module sslpsk is not installed.
  warnings.warn(u'Connection encryption via TLS-PSK is not available, as the module sslpsk is not installed.')
DEBUG bconsole.<module>: options: {'name': 'bareos-dir', 'password': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', 'port': '9101', 'address': 'bareos-dir', 'protocolversion': 2, 'tls_psk_require': False}
DEBUG lowlevel.__init__: init
DEBUG lowlevel.__connect_plain: connected to bareos-dir:9101
DEBUG lowlevel.__connect: Encryption: None
DEBUG lowlevel.send: bytearray(b'Hello bareos-dir calling version 18.2.5')
DEBUG lowlevel.recv_bytes: expecting 4 bytes.
DEBUG lowlevel.recv: header: -4
WARNING lowlevel._handleSocketError: socket error: Conversation terminated (-4)
Received unexcepted signal: Conversation terminated (-4)



I am sur my TLS configuration is working because when I user binary bconsole client, it works perfectly

Do you have the save problem ? 
I was looking into python-bareos source code and I see the bug.
Thanks for help

Bigz





Math Bigz

unread,
Dec 12, 2019, 2:54:44 PM12/12/19
to bareos-users
I forgot to give technical information

Director OS : Centos 7 inside a docker container
Version : 18.2.5-144.1.el7.x86_64

Python client : Ubutu 19.04
Version : python-bareos   18.2.5 with git clone github repo

Kirill Iliashenko

unread,
Jun 6, 2020, 9:26:10 AM6/6/20
to bareos-users
Hello, 
Did you managed to solve the problem? Because i have the same one.

Jörg Steffens

unread,
Jun 9, 2020, 12:11:04 PM6/9/20
to bareos...@googlegroups.com
On 06.06.20 at 15:26 wrote Kirill Iliashenko:
> Hello,
> Did you managed to solve the problem? Because i have the same one.

It seams, there is still a problem with the underlying sslpsk and Python 3.

Using Python 2.7 it works without problems. I hope, there will be a fix
for sslpsk soon.

Regards,
Jörg

--
Jörg Steffens joerg.s...@bareos.com
Bareos GmbH & Co. KG Phone: +49 221 630693-91
http://www.bareos.com Fax: +49 221 630693-10

Sitz der Gesellschaft: Köln | Amtsgericht Köln: HRA 29646
Komplementär: Bareos Verwaltungs-GmbH
Geschäftsführer:
S. Dühr, M. Außendorf, Jörg Steffens, P. Storz

Reply all
Reply to author
Forward
0 new messages