Bug #17250
closedWebapp does not regerate policies when webdav password is changed, breaking inventories after 5.0 -> 6.0 upgrade
Description
Hello,
I have upgraded my rudder server from 5.0.16 to 6.0.5, works fine.
After that, I have enabled the "HTTPS and Syslog" report in settings, and started to upgrade my agent.
But, after upgrading agent from 5.0.16 to 6.0.5, it appears something is broken in the inventory system.
rudder agent run works, and repair any non-compliant rules, but the inventory reporting failed:
# rudder agent inventory
Rudder agent 6.0.5-debian9
Node uuid: c91fc62e-339a-4746-b233-6b47349d4d86
Start execution with config [20200426-111351-77443358]
error: Finished command related to promiser '/var/rudder/inventories/xmpp-c91fc62e-339a-4746-b233-6b47349d4d86.ocs\..*' -- an error occurred, returned 22
error: Transformer '/var/rudder/inventories/xmpp-c91fc62e-339a-4746-b233-6b47349d4d86.ocs.sign' => '/opt/rudder/bin/curl --tlsv1.2 --location --insecure --fail --silent --proxy '' --user rudder:rudder --upload-file /var/rudder/inventories/xmpp-c91fc62e-339a-4746-b233-6b47349d4d86.ocs.sign https://RUDDER_SERVER/inventory-updates/' returned error
error: Finished command related to promiser '/var/rudder/inventories/xmpp-c91fc62e-339a-4746-b233-6b47349d4d86.ocs\..*' -- an error occurred, returned 22
error: Transformer '/var/rudder/inventories/xmpp-c91fc62e-339a-4746-b233-6b47349d4d86.ocs.gz' => '/opt/rudder/bin/curl --tlsv1.2 --location --insecure --fail --silent --proxy '' --user rudder:rudder --upload-file /var/rudder/inventories/xmpp-c91fc62e-339a-4746-b233-6b47349d4d86.ocs.gz https://RUDDER_SERVER/inventory-updates/' returned error
M| State Technique Component Key Message
E| error Inventory inventory Could not send the inventory
error: Method 'sendInventory' failed in some repairs
error: Method 'doInventory_always' failed in some repairs
info Rudder agent was run on a subset of policies - not all policies were checked
If I run the curl manually, without the --silent, it reports a 401:
# /opt/rudder/bin/curl --tlsv1.2 --location --insecure --fail --proxy '' --user rudder:rudder --upload-file /var/rudder/inventories/xmpp-c91fc62e-339a-4746-b233-6b47349d4d86.ocs.gz https://RUDDER_SERVER/inventory-updates/
curl: (22) The requested URL returned error: 401
And indeed, if I connect manually to https://RUDDER_SERVER/inventory-updates using rudder/rudder as credentials, I get a 401.
I found nowhere how to configure this credential nor on server webui or agent configuration files, but I found (by looking in apache vhost) that the htpasswd file is here:
/opt/rudder/etc/htpasswd-webdav
And indeed, the password stored inside is not rudder:
# htpasswd -v /opt/rudder/etc/htpasswd-webdav rudder
Enter password: rudder
password verification failed
If I backup the file, and change it to match rudder/rudder, the inventory works fine again:
## On rudder server
# htpasswd /opt/rudder/etc/htpasswd-webdav rudder
New password:
Re-type new password:
Updating password for user rudder
## On rudder agent
# rudder agent inventory
Rudder agent 6.0.5-debian9
Node uuid: c91fc62e-339a-4746-b233-6b47349d4d86
Start execution with config [20200426-111351-77443358]
M| State Technique Component Key Message
E| compliant Inventory inventory The inventory has been successfully sent
But I am not sure that changing this password will not break somethin else, and by the way after some minutes, the password in "/opt/rudder/etc/htpasswd-webdav" is updated automatically (possibly by rudder itself?) and the inventory fails again.
At the moment, I do not know how to change this password, either on the server or on the agent, as it seems this user is outside the common "user" system: https://docs.rudder.io/reference/6.0/administration/users.html
In addition to that, as the password is hashed in htpasswd file, I do not know how to get it on the server to configure agent accordingly :-/
Do you know if there is something to do to configure the newly upgraded agent with the correct credential, and where to find these credentials on the server?
Do not hesitate to tell if you need any other test or details :)
Thanks a lot!