Page 1 of 1

WAPT/CentOS Bug Agent?

Published: April 10, 2020 - 5:14 PM
by AGUTI
I wanted to install a WAPT agent on a CentOS 7 server to use as a repository.
I'm using WAPT Community 1.8.1 on the server.
I downloaded the "tis-waptagent" package via YUM on the CentOS machine and followed the installation procedure on the wapt.fr website.
However, I can't get the service to start: the command
`systemctl start waptservice.service`
returned an error related to "locale.getdefaultlocale()[0].split('_')[0]".
=> After repeating the procedure several times, I observed that:
o In line 785 of "/opt/wapt/setuphelpers.py" there is the following instruction:
return locale.getdefaultlocale()[0].split('_')[0]
o This instruction calls the "getlocale" command to obtain a list of values ​​corresponding to the locale language and keyboard settings, and retrieves the first element of this list (item "0"). This element is then split according to the separator character "_".
o However, the getlocale command returns nothing, and it is therefore impossible to perform a "split" on a variable that does not have the required type.
=
> I then tried the following corrective action: I commented out this instruction in the "setuphelpers" file and added an instruction just below it that forces the locale parameter to the value "en_US":
#return locale.getdefaultlocale()[0].split('_')[0]
return 'en_US.UFT8'
=> result: the service starts correctly.
However, now "systemctl status waptservice.service" returns a certificate error (even though I have correctly uploaded the server's certificate locally):
"WARNING Websocket connect params: [('x509 certificate routines', 'X509_check_private_key', 'key values ​​mismatch')]"

=> Is this a configuration problem on my end, or is the "waptagent" package buggy? Is the language handling issue a bug?
Thank you

Re: WAPT/CentOS Bug Agent?

Published: April 15, 2020 - 12:49 PM
by dcardon
Do you have an environment variable that defines the locale? Probably not, we'll see about setting en_US.utf8 by default if getlocale() returns nothing.

Regarding the certificate issue, is it a self-signed certificate or one issued by a CA?

Could you try restarting the agent in debug mode to see if you get more information? (To stop it, you need to kill the Python process; Ctrl-C isn't being caught correctly.)

Code: Select all

/opt/wapt/runwaptagent.sh  -l debug
Sincerely,
Denis

Re: WAPT/CentOS Bug Agent?

Published: April 28, 2020 - 5:59 PM
by AGUTI
Hello and thank you for your reply.

Regarding the regional settings issue:
- indeed, the system had no locale defined
- I configured "localectl set-locale LANG=en_US.utf8"
- I restored the original version of the "setuphelpers.py" file, replacing the modified one
- when I try to restart the "waptservice", it starts (it only displays certificate-related errors, but that's another issue)
- HOWEVER, if I use the "wapt-get" command, I get an error concerning the line "locale.getdefaultlocale()[0].split('_')[0]" in the "setuphelpers.py" file
- I replaced the original "setuphelpers" file with the modified one (the one where I forced "return locale=en_US.utf8") and then everything seems to work
- I don't understand this behavior...

Regarding the certificate issue, everything is working for the moment with WAPT self-signed certificates.
- I placed the server certificate on the CentOS machine in "/opt/wapt/ssl" and in "opt/wapt/ssl/server" but I still get the same "mismatch" message
- I started in debug mode and it seems that the agent on CentOS wants to initiate communication with the server using its own certificate (and not the server's):
Loading ssl context with cert /opt/wapt/private/c9662cf4-b2be-4943-8a2a-a529e3d97175.crt and key /opt/wapt/private/c9662cf4-b2be-4943-8a2a-a529e3d97175.pem
- does the server need to know the Linux agent's certificate? And in that case, where should it be placed in Windows?

Thanks again

Re: WAPT/CentOS Bug Agent?

Published: April 28, 2020 - 6:44 PM
by AGUTI
One more detail: when I try to register with the server using "wapt-get register", I get the following message:
Using config file: /opt/wapt/wapt-get.ini
Registering host against server: https://my-server.my-domain
FATAL ERROR: NameError: global name 'logger' is not defined.

Could this be related to the certificate problem?

Thank you.

Re: WAPT/CentOS Bug Agent?

Published: April 28, 2020 - 7:26 PM
by sfonteneau
By chance, I figured out the error (I encountered it yesterday).

I tried installing WAPT in the WSL layer yesterday and ran into the problem.

Basically, it's dmidecode that isn't working.

It's throwing in an `except` statement, but it's not valid.

Try typing the command: `dmidecode` to see if it works (note that it only works as root).

You can also replace the line with "pass":
https://github.com/tranquilit/WAPT/blob ... ix.py#L245