Skip to content

Commit

Permalink
Merge pull request #1510 from wazuh/1507-update_ova_requirements-4.3
Browse files Browse the repository at this point in the history
Update ova requirements
  • Loading branch information
alberpilot authored May 4, 2022
2 parents 5cee0d4 + e7faeed commit 1f7b021
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.

## [v4.3.0]

- Update ova requirements [#1510](https://github.com/wazuh/wazuh-packages/pull/1510)
- Hide passwords in log file [#1496] (https://github.com/wazuh/wazuh-packages/pull/1496)
- Fix dashboard ip messages [#1500](https://github.com/wazuh/wazuh-packages/pull/1500)
- Improved APT locked message and retry time [#1499](https://github.com/wazuh/wazuh-packages/pull/1499)
Expand Down
4 changes: 2 additions & 2 deletions ova/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
Vagrant.configure("2") do |config|

config.vm.box = "centos/7"
config.vm.hostname = "wazuh-manager"
config.vm.hostname = "wazuh-server"
config.vm.provider "virtualbox" do |vb|
vb.name = "vm_wazuh"
vb.memory = "4096"
vb.memory = "8192"
vb.cpus = "4"
end

Expand Down
13 changes: 11 additions & 2 deletions ova/assets/custom/automatic_set_ram.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@ ram="$(( ram_mb / 2 ))"
if [ "${ram}" -eq "0" ]; then
ram=1024;
fi
eval "sed -i "s/-Xms1g/-Xms${ram}m/" /etc/wazuh-indexer/jvm.options ${debug}"
eval "sed -i "s/-Xmx1g/-Xmx${ram}m/" /etc/wazuh-indexer/jvm.options ${debug}"

regex="^\-Xmx\K[0-9]+"
file="/etc/wazuh-indexer/jvm.options"
value=$(grep -oP ${regex} ${file})

if [[ "${value}" != "${ram}" ]]; then
eval "sed -i "s/^-Xms.*$/-Xms${ram}m/" ${file} ${debug}"
eval "sed -i "s/^-Xmx.*$/-Xmx${ram}m/" ${file} ${debug}"
fi

systemctl stop updateIndexerHeap.service
8 changes: 8 additions & 0 deletions ova/assets/custom/updateIndexerHeap.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=Update Wazuh Indexer jvm.option memory heap space

[Install]
WantedBy=multi-user.target

[Service]
ExecStart=/bin/bash /etc/automatic_set_ram.sh
10 changes: 5 additions & 5 deletions ova/assets/steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ systemConfig() {
mv ${CUSTOM_PATH}/grub/grub /etc/default/
grub2-mkconfig -o /boot/grub2/grub.cfg > /dev/null 2>&1

# Set dinamic ram of vm
# Update Wazuh indexer jvm heap
mv ${CUSTOM_PATH}/automatic_set_ram.sh /etc/
chmod +x "/etc/automatic_set_ram.sh"
echo "@reboot . /etc/automatic_set_ram.sh" >> cron
crontab cron
rm cron
chmod 755 /etc/automatic_set_ram.sh
mv ${CUSTOM_PATH}/updateIndexerHeap.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable updateIndexerHeap.service

# Change root password (root:wazuh)
sed -i "s/root:.*:/root:\$1\$pNjjEA7K\$USjdNwjfh7A\.vHCf8suK41::0:99999:7:::/g" /etc/shadow
Expand Down

0 comments on commit 1f7b021

Please sign in to comment.