WAPT/CentOS Bug Agent?

Share your tips or issues concerning the WAPT Console or WAPT Agent here
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
AGUTI
Messages: 4
Registration: Apr 10, 2020 - 5:00 p.m.

April 10, 2020 - 5:14 PM

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
User avatar
dcardon
WAPT Expert
Messages: 1930
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

April 15, 2020 - 12:49

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
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
AGUTI
Messages: 4
Registration: Apr 10, 2020 - 5:00 p.m.

April 28, 2020 - 5:59 PM

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
AGUTI
Messages: 4
Registration: Apr 10, 2020 - 5:00 p.m.

April 28, 2020 - 6:44 PM

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.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

April 28, 2020 - 7:26 PM

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
Locked