-
Notifications
You must be signed in to change notification settings - Fork 99
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
Fix filebeat local install unify unattended #1046
Conversation
@@ -3,7 +3,7 @@ repobaseurl="https://packages.wazuh.com/4.x" | |||
|
|||
getConfig() { | |||
if [ -n "${local}" ]; then | |||
cp ./$config_path/$1 $2 | |||
cp "$(pwd)/$config_path/$1" $2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it will be better to use realpath $0
to obtain the path to the script and remove the script name with sed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used a variable to store the base path of the main script, this allow to run the unattended from different paths
Done in cb80bbe
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested changes.
@@ -79,6 +79,7 @@ configureElasticsearchAIO() { | |||
|
|||
eval "cd /usr/share/elasticsearch/plugins/opendistro_security/tools/ ${debug}" | |||
eval "./securityadmin.sh -cd ../securityconfig/ -icl -nhnv -cacert /etc/elasticsearch/certs/root-ca.pem -cert /etc/elasticsearch/certs/admin.pem -key /etc/elasticsearch/certs/admin-key.pem ${debug}" | |||
eval "cd - ${debug}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in cb80bbe
@@ -79,6 +79,7 @@ configureElasticsearchAIO() { | |||
|
|||
eval "cd /usr/share/elasticsearch/plugins/opendistro_security/tools/ ${debug}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in cb80bbe
@@ -79,6 +79,7 @@ configureElasticsearchAIO() { | |||
|
|||
eval "cd /usr/share/elasticsearch/plugins/opendistro_security/tools/ ${debug}" | |||
eval "./securityadmin.sh -cd ../securityconfig/ -icl -nhnv -cacert /etc/elasticsearch/certs/root-ca.pem -cert /etc/elasticsearch/certs/admin.pem -key /etc/elasticsearch/certs/admin-key.pem ${debug}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use absolute path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in cb80bbe
The changes made allow the AIO to be installed from any path, in addition, now all the files will be created in the same folder where the main script is. Before the changes, the instances.yml file and the certs folder were created in the directory from where it was run Unattended script location: Unattended runned from Pytests
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
This PR fixes the unattended installation using local files. The current installation does not fail if there is a file that is not found, so as there is no debug mode it is not detected.
The problem is in the directory from where we want to copy files, in the last phase of Elasticsearch configuration, it enter in (
/usr/share/elasticsearch/plugins/opendistro_security/tools/
) directory but it does not restore the previous path when finishedThis PR changes the copy command to use an absolute path $(pwd) instead of relative one (./), so that if there is ever a problem in a path it is detectable if debug mode is used. To correct the path a
cd -
has been incorporated in the last phase of Elasticsarch configurationLogs example
centos.log