Skip to content

Commit

Permalink
Changed everything called elastic to elasticsearch
Browse files Browse the repository at this point in the history
Signed-off-by: verdx <[email protected]>
  • Loading branch information
verdx committed Dec 14, 2021
1 parent b3c44f2 commit 113f895
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 41 deletions.
18 changes: 9 additions & 9 deletions unattended_scripts/install_functions/opendistro/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,18 @@ checkInstalled() {
fi

if [ "${sys_type}" == "yum" ]; then
elasticinstalled=$(yum list installed 2>/dev/null | grep opendistroforelasticsearch)
elasticsearchinstalled=$(yum list installed 2>/dev/null | grep opendistroforelasticsearch)
elif [ "${sys_type}" == "zypper" ]; then
elasticinstalled=$(zypper packages --installed | grep opendistroforelasticsearch | grep i+ | grep noarch)
elasticsearchinstalled=$(zypper packages --installed | grep opendistroforelasticsearch | grep i+ | grep noarch)
elif [ "${sys_type}" == "apt-get" ]; then
elasticinstalled=$(apt list --installed 2>/dev/null | grep opendistroforelasticsearch)
elasticsearchinstalled=$(apt list --installed 2>/dev/null | grep opendistroforelasticsearch)
fi

if [ -n "${elasticinstalled}" ]; then
if [ -n "${elasticsearchinstalled}" ]; then
if [ ${sys_type} == "zypper" ]; then
odversion=$(echo ${elasticinstalled} | awk '{print $11}')
odversion=$(echo ${elasticsearchinstalled} | awk '{print $11}')
else
odversion=$(echo ${elasticinstalled} | awk '{print $2}')
odversion=$(echo ${elasticsearchinstalled} | awk '{print $2}')
fi
fi

Expand Down Expand Up @@ -168,12 +168,12 @@ checkInstalled() {
fi
fi

if [ -z "${wazuhinstalled}" ] || [ -z "${elasticinstalled}" ] || [ -z "${filebeatinstalled}" ] || [ -z "${kibanainstalled}" ] && [ -n "${uninstall}" ]; then
if [ -z "${wazuhinstalled}" ] || [ -z "${elasticsearchinstalled}" ] || [ -z "${filebeatinstalled}" ] || [ -z "${kibanainstalled}" ] && [ -n "${uninstall}" ]; then
logger -e " No Wazuh components were found on the system."
exit 1;
fi

if [ -n "${wazuhinstalled}" ] || [ -n "${elasticinstalled}" ] || [ -n "${filebeatinstalled}" ] || [ -n "${kibanainstalled}" ]; then
if [ -n "${wazuhinstalled}" ] || [ -n "${elasticsearchinstalled}" ] || [ -n "${filebeatinstalled}" ] || [ -n "${kibanainstalled}" ]; then
if [ -n "${ow}" ]; then
overwrite

Expand Down Expand Up @@ -350,7 +350,7 @@ rollBack() {
eval "rm -rf /var/ossec/ ${debug}"
fi

if [ -n "${elasticinstalled}" ]; then
if [ -n "${elasticsearchinstalled}" ]; then
logger -w "Removing Elasticsearch..."
if [ "${sys_type}" == "yum" ]; then
eval "yum remove opendistroforelasticsearch -y ${debug}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ installElasticsearch() {
rollBack
exit 1;
else
elasticinstalled="1"
elasticsearchinstalled="1"
logger "Done"
fi

Expand Down Expand Up @@ -182,11 +182,11 @@ configureElasticsearch() {
eval "rm /etc/elasticsearch/certs/client-certificates.readme /etc/elasticsearch/certs/elasticsearch_elasticsearch_config_snippet.yml -f ${debug}"
eval "/usr/share/elasticsearch/bin/elasticsearch-plugin remove opendistro-performance-analyzer ${debug}"

initializeElastic
initializeElasticsearch
logger "Done"
}

initializeElastic() {
initializeElasticsearch() {

logger "Elasticsearch installed."

Expand Down
4 changes: 2 additions & 2 deletions unattended_scripts/install_functions/opendistro/filebeat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ installFilebeat() {
logger "Installing Filebeat..."

if [ ${sys_type} == "zypper" ]; then
eval "zypper -n install filebeat-${elastic_oss_version} ${debug}"
eval "zypper -n install filebeat-${elasticsearch_oss_version} ${debug}"
else
eval "${sys_type} install filebeat${sep}${elastic_oss_version} -y -q ${debug}"
eval "${sys_type} install filebeat${sep}${elasticsearch_oss_version} -y -q ${debug}"
fi
if [ "$?" != 0 ]
then
Expand Down
4 changes: 2 additions & 2 deletions unattended_scripts/install_functions/opendistro/kibana.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ configureKibanaAIO() {
eval "mkdir /usr/share/kibana/data ${debug}"
eval "chown -R kibana:kibana /usr/share/kibana/ ${debug}"
eval "cd /usr/share/kibana ${debug}"
eval "sudo -u kibana /usr/share/kibana/bin/kibana-plugin install '${repobaseurl}'/ui/kibana/wazuh_kibana-${wazuh_version}_${elastic_oss_version}-${wazuh_kibana_plugin_revision}.zip ${debug}"
eval "sudo -u kibana /usr/share/kibana/bin/kibana-plugin install '${repobaseurl}'/ui/kibana/wazuh_kibana-${wazuh_version}_${elasticsearch_oss_version}-${wazuh_kibana_plugin_revision}.zip ${debug}"
eval "cd ${base_path} ${debug}"
if [ "$?" != 0 ]; then
logger -e "Wazuh Kibana plugin could not be installed."
Expand All @@ -53,7 +53,7 @@ configureKibana() {
eval "mkdir /usr/share/kibana/data ${debug}"
eval "chown -R kibana:kibana /usr/share/kibana/ ${debug}"
eval "cd /usr/share/kibana ${debug}"
eval "sudo -u kibana /usr/share/kibana/bin/kibana-plugin install '${repobaseurl}'/ui/kibana/wazuh_kibana-${wazuh_version}_${elastic_oss_version}-${wazuh_kibana_plugin_revision}.zip ${debug}"
eval "sudo -u kibana /usr/share/kibana/bin/kibana-plugin install '${repobaseurl}'/ui/kibana/wazuh_kibana-${wazuh_version}_${elasticsearch_oss_version}-${wazuh_kibana_plugin_revision}.zip ${debug}"
if [ "$?" != 0 ]; then
logger -e "Wazuh Kibana plugin could not be installed."
exit 1;
Expand Down
28 changes: 14 additions & 14 deletions unattended_scripts/install_functions/opendistro/wazuh-cert-tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
# Foundation.

debug='> /dev/null 2>&1'
elasticinstances="elasticsearch-nodes:"
elasticsearchinstances="elasticsearch-nodes:"
filebeatinstances="wazuh-servers:"
kibanainstances="kibana:"
elastichead='# Elasticsearch nodes'
elasticsearchhead='# Elasticsearch nodes'
filebeathead='# Wazuh server nodes'
kibanahead='# Kibana node'

Expand Down Expand Up @@ -84,11 +84,11 @@ readFile() {

IFS=$'\r\n' GLOBIGNORE='*' command eval 'instances=($(cat ${base_path}/instances.yml))'
for i in "${!instances[@]}"; do
if [[ "${instances[$i]}" == "${elasticinstances}" ]]; then
elasticlimitt=${i}
if [[ "${instances[$i]}" == "${elasticsearchinstances}" ]]; then
elasticsearchlimitt=${i}
fi
if [[ "${instances[$i]}" == "${filebeatinstances}" ]]; then
elasticlimib=${i}
elasticsearchlimib=${i}
fi

if [[ "${instances[$i]}" == "${filebeatinstances}" ]]; then
Expand All @@ -101,12 +101,12 @@ readFile() {
done

## Read Elasticsearch nodes
counter=${elasticlimitt}
counter=${elasticsearchlimitt}
i=0
while [ "${counter}" -le "${elasticlimib}" ]
while [ "${counter}" -le "${elasticsearchlimib}" ]
do
if [ "${instances[counter]}" != "${elasticinstances}" ] && [ "${instances[counter]}" != "${filebeatinstances}" ] && [ "${instances[counter]}" != "${filebeathead}" ] && [ "${instances[counter]}" != " ip:" ] && [ -n "${instances[counter]}" ]; then
elasticnodes[i]+="$(echo "${instances[counter]}" | tr -d '\011\012\013\014\015\040')"
if [ "${instances[counter]}" != "${elasticsearchinstances}" ] && [ "${instances[counter]}" != "${filebeatinstances}" ] && [ "${instances[counter]}" != "${filebeathead}" ] && [ "${instances[counter]}" != " ip:" ] && [ -n "${instances[counter]}" ]; then
elasticsearchnodes[i]+="$(echo "${instances[counter]}" | tr -d '\011\012\013\014\015\040')"
((i++))
fi

Expand Down Expand Up @@ -210,9 +210,9 @@ generateElasticsearchcertificates() {
logger "Creating the Elasticsearch certificates..."

i=0
while [ ${i} -lt ${#elasticnodes[@]} ]; do
cname=${elasticnodes[i]}
cip=${elasticnodes[i+1]}
while [ ${i} -lt ${#elasticsearchnodes[@]} ]; do
cname=${elasticsearchnodes[i]}
cip=${elasticsearchnodes[i+1]}
rname="-name:"
cname="${cname//$rname}"
rip="-"
Expand Down Expand Up @@ -305,7 +305,7 @@ main() {
shift 1
;;
"-e"|"--elasticsearch-certificates")
celastic=1
celasticsearch=1
shift 1
;;
"-w"|"--wazuh-certificates")
Expand Down Expand Up @@ -342,7 +342,7 @@ main() {
logger "Authority certificates created."
fi

if [[ -n "${celastic}" ]]; then
if [[ -n "${celasticsearch}" ]]; then
generateElasticsearchcertificates
logger "Elasticsearch certificates created."
fi
Expand Down
8 changes: 4 additions & 4 deletions unattended_scripts/tools/wazuh-passwords-tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ getNetworkHost() {
checkInstalled() {

if [ "${SYS_TYPE}" == "yum" ]; then
elasticinstalled=$(yum list installed 2>/dev/null | grep opendistroforelasticsearch)
elasticsearchinstalled=$(yum list installed 2>/dev/null | grep opendistroforelasticsearch)
elif [ "${SYS_TYPE}" == "zypper" ]; then
elasticinstalled=$(zypper packages --installed | grep opendistroforelasticsearch | grep i+ | grep noarch)
elasticsearchinstalled=$(zypper packages --installed | grep opendistroforelasticsearch | grep i+ | grep noarch)
elif [ "${SYS_TYPE}" == "apt-get" ]; then
elasticinstalled=$(apt list --installed 2>/dev/null | grep 'opendistroforelasticsearch*')
elasticsearchinstalled=$(apt list --installed 2>/dev/null | grep 'opendistroforelasticsearch*')
fi

if [ -z "${elasticinstalled}" ]; then
if [ -z "${elasticsearchinstalled}" ]; then
logger -e "Open Distro is not installed on the system."
exit 1;
else
Expand Down
14 changes: 7 additions & 7 deletions unattended_scripts/wazuh_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
wazuh_major="4.3"
wazuh_version="4.3.0"
wazuh_revision="1"
elastic_oss_version="7.10.2"
elastic_basic_version="7.12.1"
elasticsearch_oss_version="7.10.2"
elasticsearch_basic_version="7.12.1"
opendistro_version="1.13.2"
opendistro_revision="1"
wazuh_kibana_plugin_revision="1"
Expand Down Expand Up @@ -52,8 +52,8 @@ getHelp() {
echo -e " -c, --create-certificates"
echo -e " Create certificates from instances.yml file."
echo -e ""
echo -e " -en, --elastic-node-name"
echo -e " Name of the elastic node, used for distributed installations."
echo -e " -en, --elasticsearch-node-name"
echo -e " Name of the elasticsearch node, used for distributed installations."
echo -e ""
echo -e " -wn, --wazuh-node-name"
echo -e " Name of the wazuh node, used for distributed installations."
Expand Down Expand Up @@ -108,14 +108,14 @@ main() {
shift 1
;;
"-e"|"--elasticsearch")
elastic=1
elasticsearch=1
shift 1
;;
"-k"|"--kibana")
kibana=1
shift 1
;;
"-en"|"--elastic-node-name")
"-en"|"--elasticsearch-node-name")
einame=$2
shift 2
;;
Expand Down Expand Up @@ -168,7 +168,7 @@ main() {
createCertificates
fi

if [ -n "${elastic}" ]; then
if [ -n "${elasticsearch}" ]; then

importFunction "elasticsearch.sh"

Expand Down

0 comments on commit 113f895

Please sign in to comment.