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

Change realpath to readlink command - Unify unattended #1056

Merged
merged 1 commit into from
Dec 9, 2021

Conversation

rauldpm
Copy link
Member

@rauldpm rauldpm commented Dec 9, 2021

Related issue
Related to #1036 (comment)

Description

The realpath command is not a native GNU command and is added in the coreutils-8.22 package, this is a problem since older systems like OL6 have coreutils-8.4, which does not provide this command.

The solution is to use a native GNU command, which is readlink -f

Logs example

Added echo to debug path for readlink command

CentOS 7

[root@centos7 unattended_scripts]# bash unattended_installation.sh -A -l
readlink: /home/vagrant/wazuh-packages/unattended_scripts
12/09/2021 13:40:51 INFO: Configuration file found. Creating certificates...
12/09/2021 13:40:51 INFO: Creating the Elasticsearch certificates...
12/09/2021 13:40:51 INFO: Creating Wazuh server certificates...
12/09/2021 13:40:51 INFO: Creating Kibana certificate...
12/09/2021 13:40:51 INFO: Certificates creation finished. They can be found in /home/vagrant/wazuh-packages/unattended_scripts/certs.
12/09/2021 13:40:51 INFO: Starting the installation...
12/09/2021 13:40:51 INFO: Starting the installation...
12/09/2021 13:40:51 INFO: Starting the installation...
12/09/2021 13:40:51 INFO: Installing all necessary utilities for the installation...
12/09/2021 13:40:52 INFO: Done
12/09/2021 13:40:52 INFO: Adding the Wazuh repository...
12/09/2021 13:40:53 INFO: Done
12/09/2021 13:40:53 INFO: Installing the Wazuh manager...
12/09/2021 13:41:27 INFO: Done
12/09/2021 13:41:44 INFO: Wazuh-manager started
12/09/2021 13:41:44 INFO: Installing Open Distro for Elasticsearch...
12/09/2021 13:42:24 INFO: Done
12/09/2021 13:42:24 INFO: Configuring Elasticsearch...
12/09/2021 13:42:32 INFO: Elasticsearch started
12/09/2021 13:42:32 INFO: Initializing Elasticsearch...

12/09/2021 13:42:41 INFO: Done
12/09/2021 13:42:41 INFO: Installing Filebeat...
12/09/2021 13:42:44 INFO: Filebeat started
12/09/2021 13:42:44 INFO: Done
12/09/2021 13:42:44 INFO: Installing Open Distro for Kibana...
12/09/2021 13:43:47 INFO: Done
12/09/2021 13:43:56 INFO: Kibana started

Oracle Linux 6 (fails due to elasticsearch, not related to readlink)

[root@ip-172-31-17-15 unattended_scripts]# bash unattended_installation.sh -A -l
readlink: /home/ec2-user/wazuh-packages/unattended_scripts
12/09/2021 13:38:28 INFO: Configuration file found. Creating certificates...
12/09/2021 13:38:28 INFO: Creating the Elasticsearch certificates...
12/09/2021 13:38:28 INFO: Creating Wazuh server certificates...
12/09/2021 13:38:29 INFO: Creating Kibana certificate...
12/09/2021 13:38:29 INFO: Certificates creation finished. They can be found in /home/ec2-user/wazuh-packages/unattended_scripts/certs.
12/09/2021 13:38:29 INFO: Starting the installation...
12/09/2021 13:38:29 INFO: Starting the installation...
12/09/2021 13:38:29 INFO: Starting the installation...
12/09/2021 13:38:29 INFO: Installing all necessary utilities for the installation...
12/09/2021 13:38:29 INFO: Done
12/09/2021 13:38:29 INFO: Adding the Wazuh repository...
12/09/2021 13:38:29 INFO: Wazuh repository already exists skipping
12/09/2021 13:38:29 INFO: Done
12/09/2021 13:38:29 INFO: Installing the Wazuh manager...
12/09/2021 13:39:38 INFO: Done
12/09/2021 13:39:59 INFO: Wazuh-manager started
12/09/2021 13:39:59 INFO: Installing Open Distro for Elasticsearch...
Elasticsearch installation failed
12/09/2021 13:40:00 WARNING: Cleaning the installation
12/09/2021 13:40:00 WARNING: Removing the Wazuh manager...
12/09/2021 13:40:32 WARNING: Installation cleaned. Check the /var/log/wazuh-unattended-installation.log file to learn more about the issue.

Tests

  • CentOS7
  • Oracle Linux 6

@rauldpm rauldpm self-assigned this Dec 9, 2021
Copy link
Contributor

@DFolchA DFolchA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@myu1d157h0u54nd myu1d157h0u54nd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alberpilot alberpilot merged commit 3f899a1 into unify-unattended Dec 9, 2021
@alberpilot alberpilot deleted the fix_realpath-unify branch December 9, 2021 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants