Page 1 of 1

[SOLVED] Websocket connect error

Published: February 11, 2020 - 6:38 PM
by mart03
Specify the installed WAPT version (1.8)
* Specify the server OS (Linux) and version (Debian Buster)
* Specify the OS of the machine used for administration/package creation (Debian Buster)

Good morning,

After installing the Linux Agent package and configuring wapt-get.ini, I encounter the following errors:

Code: Select all

CRITICAL Error: [('x509 certificate routines', 'X509_check_private_key', 'key values mismatch')]
WARNING Websocket connect params: [('x509 certificate routines', 'X509_check_private_key', 'key values mismatch')]
WARNING Websocket connect params: [('x509 certificate routines', 'X509_check_private_key', 'key values mismatch')]
.....
What does this correspond to, please? I think it's related to the certificate...

Here is my configuration file:

Code: Select all

[global]
repo_url=https://XXXX.XXXX.dc/wapt
wapt_server=https://XXXX.XXXX.dc/
use_hostpackages=1
use_kerberos=0
check_certificates_validity=0
verify_cert=0
personal_certificate_path=/opt/wapt/ssl/XXX.crt
THANKS.

Re: Websocket Connect Error

Published: February 12, 2020 - 10:42 AM
by sfonteneau

Code: Select all

personal_certificate_path=/opt/wapt/ssl/XXX.crt

personal_certificate_path is only useful if you want to create packages from the Linux client

The indicated path is therefore incorrect

Note that the private key for wapt (the one used to sign packages) must not be in /opt/wapt!

However, the public key must be in /opt/wapt/ssl/

Once that's done, you can run the command

Code: Select all

wapt-get register

Re: Websocket Connect Error

Published: February 12, 2020 - 11:16 AM
by mart03
Thank you for your reply.

I removed the personal_certificate_path line

and I can confirm that the public key is indeed in the opt/wapt/ssl folder.
Does it need specific permissions? Owner/group?

Thank you.

Re: Websocket Connect Error

Published: February 12, 2020 - 12:37 PM
by sfonteneau
What does the register show?

Re: Websocket Connect Error

Published: February 12, 2020 - 1:49 PM
by mart03
Here's the return:

Code: Select all

root@XXXX:~# wapt-get register
Using config file: /opt/wapt/wapt-get.ini
Registering host against server: https://XXX.XXXX.dc/
FATAL ERROR : Error: [('x509 certificate routines', 'X509_check_private_key', 'key values mismatch')]

Re: Websocket Connect Error

Published: February 12, 2020 - 2:43 PM
by sfonteneau
And :

Code: Select all

wapt-get register -ldebug

Re: Websocket Connect Error

Published: February 12, 2020 - 3:02 PM
by mart03
Here is :

Code: Select all

wapt-get register -ldebug
2020-02-12 14:58:47,450 DEBUG Default encoding : ascii
2020-02-12 14:58:47,455 DEBUG Setting encoding for stdout and stderr to UTF-8
2020-02-12 14:58:47,455 DEBUG Python path ['/opt/wapt', '/opt/wapt', '/opt/wapt/lib/python2.7', '/opt/wapt/lib/python2.7/plat-x86_64-linux-gnu', '/opt/wapt/lib/python2.7/lib-tk', '/opt/wapt/lib/python2.7/lib-old', '/opt/wapt/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/opt/wapt/lib/python2.7/site-packages']
2020-02-12 14:58:47,455 INFO Using local waptservice configuration /opt/wapt/wapt-get.ini
2020-02-12 14:58:47,456 DEBUG Config file: /opt/wapt/wapt-get.ini
Using config file: /opt/wapt/wapt-get.ini
2020-02-12 14:58:47,468 DEBUG Thread 140067123935040 is connecting to wapt db
2020-02-12 14:58:47,741 DEBUG Using host certificate /opt/wapt/private/f7097310-8436-bf45-ae76-394dd2f63dcf.pem for repo global auth
2020-02-12 14:58:47,848 DEBUG Thread 140067123935040 is connecting to wapt db
2020-02-12 14:58:47,849 DEBUG DB Start transaction
2020-02-12 14:58:47,850 DEBUG DB commit
2020-02-12 14:58:47,966 DEBUG Using host certificate /opt/wapt/private/f7097310-8436-bf45-ae76-394dd2f63dcf.pem for repo wapt auth
2020-02-12 14:58:48,180 DEBUG Using host certificate /opt/wapt/private/f7097310-8436-bf45-ae76-394dd2f63dcf.pem for repo wapt-host auth
2020-02-12 14:58:48,233 INFO User Groups:[]
2020-02-12 14:58:48,234 DEBUG WAPT base directory : /opt/wapt
2020-02-12 14:58:48,234 DEBUG Package cache dir : /opt/wapt/cache
2020-02-12 14:58:48,234 DEBUG WAPT DB Structure version;: 20190606
Registering host against server: https://XXX.XXX.dc/
2020-02-12 14:58:48,234 DEBUG DB Start transaction
2020-02-12 14:58:48,235 DEBUG DB commit
2020-02-12 14:58:48,265 DEBUG DB Start transaction
2020-02-12 14:58:48,266 DEBUG DB commit
2020-02-12 14:58:48,270 DEBUG DB Start transaction
2020-02-12 14:58:48,271 DEBUG DB commit
2020-02-12 14:58:48,461 DEBUG DB Start transaction
2020-02-12 14:58:48,462 DEBUG DB commit
2020-02-12 14:58:48,473 DEBUG Stores cert chain check in cache
2020-02-12 14:58:49,941 DEBUG Loading ssl context with cert /opt/wapt/private/f7097310-8436-bf45-ae76-394dd2f63dcf.crt and key /opt/wapt/private/f7097310-8436-bf45-ae76-394dd2f63dcf.pem
FATAL ERROR : Error: [('x509 certificate routines', 'X509_check_private_key', 'key values mismatch')]
Traceback (most recent call last):
  File "/opt/wapt//wapt-get.py", line 1429, in <module>
    main()
  File "/opt/wapt//wapt-get.py", line 1211, in main
    description=(" ".join(args[1:])).decode(sys.getfilesystemencoding()),
  File "/opt/wapt/common.py", line 5482, in register_computer
    signer = self.get_host_certificate().cn
  File "/opt/wapt/common.py", line 1852, in post
    with self.get_requests_session(surl,use_ssl_auth=use_ssl_auth) as session:
  File "/opt/wapt/common.py", line 1594, in get_requests_session
    session = get_requests_client_cert_session(url=url,cert=cert,verify=self.verify_cert,proxies=self.proxies)
  File "/opt/wapt/waptutils.py", line 779, in get_requests_client_cert_session
    result.mount(url, SSLAdapter(cert[0],cert[1],cert[2],**kwargs))
  File "/opt/wapt/waptutils.py", line 730, in __init__
    super(SSLAdapter, self).__init__(*args, **kwargs)
  File "/opt/wapt/lib/python2.7/site-packages/requests/adapters.py", line 129, in __init__
    self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block)
  File "/opt/wapt/waptutils.py", line 733, in init_poolmanager
    self._add_ssl_context(kwargs)
  File "/opt/wapt/waptutils.py", line 747, in _add_ssl_context
    password=str(self._password))
  File "/opt/wapt/lib/python2.7/site-packages/urllib3/contrib/pyopenssl.py", line 439, in load_cert_chain
    self._ctx.use_privatekey_file(keyfile or certfile)
  File "/opt/wapt/lib/python2.7/site-packages/OpenSSL/SSL.py", line 990, in use_privatekey_file
    self._raise_passphrase_exception()
  File "/opt/wapt/lib/python2.7/site-packages/OpenSSL/SSL.py", line 967, in _raise_passphrase_exception
    _raise_current_error()
  File "/opt/wapt/lib/python2.7/site-packages/OpenSSL/_util.py", line 54, in exception_from_error_queue
    raise exception_type(errors)
OpenSSL.SSL.Error: [('x509 certificate routines', 'X509_check_private_key', 'key values mismatch')]
THANKS :)

Re: Websocket Connect Error

Published: February 12, 2020 - 6:33 PM
by sfonteneau
Can you try this?

Code: Select all

rm -f /opt/wapt/private/*.crt
rm -f /opt/wapt/private/*.pem
wapt-get register

Re: Websocket Connect Error

Published: February 13, 2020 - 9:00 AM
by mart03
Okay, thank you for your help