Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wazuh-indexer user does not exist in deb packages #101

Closed
Tracked by #110
AlexRuiz7 opened this issue Jan 8, 2024 · 5 comments · Fixed by #118
Closed
Tracked by #110

wazuh-indexer user does not exist in deb packages #101

AlexRuiz7 opened this issue Jan 8, 2024 · 5 comments · Fixed by #118
Assignees
Labels
level/task Task issue type/bug Bug issue

Comments

@AlexRuiz7
Copy link
Member

AlexRuiz7 commented Jan 8, 2024

Description

Related issue: #99

The installation of the deb packages fail, caused by the wazuh-indexer user not being created.

Errors are thrown during installation on Ubuntu 22.04:

/usr/lib/tmpfiles.d/wazuh-indexer.conf:1: Failed to resolve user 'wazuh-indexer': No such process
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Processing triggers for man-db (2.10.2-1) ...
needrestart is being skipped since dpkg has failed

Step 2, section on deploying certificates from the step-by-step installation guide fails 🔴

root@pkg-tests-ubuntu2204:~# mkdir /etc/wazuh-indexer/certs  
tar -xf ./wazuh-certificates.tar -C /etc/wazuh-indexer/certs/ ./$NODE_NAME.pem ./$NODE_NAME-key.pem ./admin.pem ./admin-key.pem ./root-ca.pem
mv -n /etc/wazuh-indexer/certs/$NODE_NAME.pem /etc/wazuh-indexer/certs/indexer.pem
mv -n /etc/wazuh-indexer/certs/$NODE_NAME-key.pem /etc/wazuh-indexer/certs/indexer-key.pem
chmod 500 /etc/wazuh-indexer/certs
chmod 400 /etc/wazuh-indexer/certs/*
chown -R wazuh-indexer:wazuh-indexer /etc/wazuh-indexer/certs
chown: invalid user: ‘wazuh-indexer:wazuh-indexer’

The service cannot be started due to lack of a wazuh-indexer user's credentials:

Jan 08 10:45:41 pkg-tests-ubuntu2204 systemd[34965]: wazuh-indexer.service: Failed to determine user credentials: No such process
Jan 08 10:45:41 pkg-tests-ubuntu2204 systemd[34965]: wazuh-indexer.service: Failed at step USER spawning /usr/share/wazuh-indexer/bin/systemd-entrypoint: No such process

Originally posted by @f-galland in #99 (comment)

@AlexRuiz7 AlexRuiz7 added level/task Task issue type/bug Bug issue labels Jan 8, 2024
@AlexRuiz7 AlexRuiz7 changed the title Wazuh indexer wazuh-indexer user does not exist in deb packages Jan 8, 2024
@wazuhci wazuhci moved this to Backlog in Release 4.9.0 Jan 8, 2024
@AlexRuiz7
Copy link
Member Author

We are missing this folder.

@f-galland f-galland self-assigned this Jan 11, 2024
@wazuhci wazuhci moved this from Backlog to In progress in Release 4.9.0 Jan 11, 2024
@wazuhci wazuhci moved this from In progress to Pending review in Release 4.9.0 Jan 11, 2024
@f-galland
Copy link
Member

After adding the folder, the user is still not getting created:

Setting up wazuh-indexer (4.9.0) ...
/usr/lib/tmpfiles.d/wazuh-indexer.conf:1: Failed to resolve user 'wazuh-indexer': No such process
Scanning processes...                                                                      
Scanning linux images...                                                                   

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.
N: Download is performed unsandboxed as root as file '/root/wazuh-indexer-4.9.0-1_amd64_8f716057590.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
root@pkg-tests-ubuntu2204:~#

@wazuhci wazuhci moved this from Pending review to Backlog in Release 4.9.0 Jan 12, 2024
@f-galland
Copy link
Member

Looks like rpm packages handle this through wazuh-indexer.rpm.spec:

fede@tyner:~/src/wazuh-indexer (101-wazuh-indexer-user-doesnt-exist)$ sed -n '100,105p' distribution/packages/src/rpm/wazuh-indexer.rpm.spec 
# Create user and group if they do not already exist.
getent group %{name} > /dev/null 2>&1 || groupadd -r %{name}
getent passwd %{name} > /dev/null 2>&1 || \
    useradd -r -g %{name} -M -s /sbin/nologin \
        -c "%{name} user/group" %{name}
exit 0

@wazuhci wazuhci moved this from Backlog to In progress in Release 4.9.0 Jan 16, 2024
@f-galland
Copy link
Member

It seems debmake ignores the existing contents of the debian folder:
https://www.debian.org/doc/manuals/debmake-doc/ch04.en.html

@f-galland
Copy link
Member

Package installation throws a warning whenever systemd-sysctl.service cannot be restarted by postinst on certain platforms (tested on Vagrant with a generic/ubuntu2204 box instance).

Image

However this happens with OpenSearch's packages as well:

Image

postinst is checking only whether systemctl exists before it goes ahead and tries to restart the systemd-sysctl service:

fede@tyner:~/src/wazuh-indexer (101-wazuh-indexer-user-doesnt-exist)
$ sed -n '35,42p' distribution/packages/src/deb/debian/postinst 
# Reload other configs
if command -v systemctl > /dev/null; then
    systemctl restart systemd-sysctl.service || true
fi

if command -v systemd-tmpfiles > /dev/null; then
    systemd-tmpfiles --create wazuh-indexer.conf
fi

@wazuhci wazuhci moved this from In progress to Pending review in Release 4.9.0 Jan 17, 2024
@wazuhci wazuhci moved this from Pending review to In review in Release 4.9.0 Jan 18, 2024
@wazuhci wazuhci moved this from In review to In final review in Release 4.9.0 Jan 19, 2024
@wazuhci wazuhci moved this from In final review to Done in Release 4.9.0 Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
level/task Task issue type/bug Bug issue
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants