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

Valid node name validation #1483

Merged
merged 2 commits into from
Apr 25, 2022
Merged

Conversation

c-bordon
Copy link
Member

Related issue
#1481

An additional validation is added to prevent the user from adding 2 arguments together and omitting the node name:

Example:

[root@centos7-1 ~]# ./wazuh-install.sh -wi -v
22/04/2022 15:15:16 INFO: Starting Wazuh installation assistant. Wazuh version: 4.3.0
22/04/2022 15:15:16 INFO: Verbose logging redirected to /var/log/wazuh-install.log
grep: invalid option -- '.'
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.
22/04/2022 15:15:17 ERROR: There is no certificate for the indexer node -v in /root/wazuh-install-files.tar.

After the Fix:

[root@centos7-1 unattended_installer]# ./wazuh-install.sh -wi -v
22/04/2022 18:42:05 ERROR: Error on argument -wi. Check the given <node-name>, the parameter -v cannot start with "-" or is incorrect
[root@centos7-1 unattended_installer]# ./wazuh-install.sh -wd -v
22/04/2022 18:42:08 ERROR: Error on argument -wd. Check the given <node-name>, the parameter -v cannot start with "-" or is incorrect
[root@centos7-1 unattended_installer]# ./wazuh-install.sh -ws -v
22/04/2022 18:42:10 ERROR: Error on argument -ws. Check the given <node-name>, the parameter -v cannot start with "-" or is incorrect
[root@centos7-1 unattended_installer]# ./wazuh-install.sh --wazuh-indexer -v
22/04/2022 18:42:16 ERROR: Error on argument --wazuh-indexer. Check the given <node-name>, the parameter -v cannot start with "-" or is incorrect
[root@centos7-1 unattended_installer]# ./wazuh-install.sh --wazuh-dashboard -v
22/04/2022 18:42:20 ERROR: Error on argument --wazuh-dashboard. Check the given <node-name>, the parameter -v cannot start with "-" or is incorrect
[root@centos7-1 unattended_installer]# ./wazuh-install.sh --wazuh-server -v
22/04/2022 18:42:25 ERROR: Error on argument --wazuh-server. Check the given <node-name>, the parameter -v cannot start with "-" or is incorrect
[root@centos7-1 unattended_installer]# ./wazuh-install.sh --wazuh-server server -v
22/04/2022 18:42:53 INFO: Starting Wazuh installation assistant. Wazuh version: 4.3.0
22/04/2022 18:42:53 INFO: Verbose logging redirected to /var/log/wazuh-install.log
22/04/2022 18:42:58 DEBUG: Adding the Wazuh repository.
[wazuh]
gpgcheck=1
gpgkey=https://packages-dev.wazuh.com/key/GPG-KEY-WAZUH
enabled=1
name=EL-${releasever} - Wazuh
baseurl=https://packages-dev.wazuh.com/pre-release/yum/
protect=1

Tests:

Centos: https://devel.ci.wazuh.info/view/Tests/job/Test_unattended/529/console
Ubuntu: https://devel.ci.wazuh.info/view/Tests/job/Test_unattended/530/console
Distributed: https://devel.ci.wazuh.info/view/Tests/job/Test_unattended_distributed/446/console

@c-bordon c-bordon self-assigned this Apr 22, 2022
Copy link
Contributor

@okynos okynos 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

@alberpilot alberpilot 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 c433a74 into 4.3 Apr 25, 2022
@alberpilot alberpilot deleted the 1481-FixUnattendedArguments-to4.3 branch April 25, 2022 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants