diff --git a/Makefile b/Makefile index 84021dcc21329fcfb001e5ff5ca3774dad416b79..00aba1fd0954c4b3f544039cc3226d83c0f2843c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -ENVIRONMENT ?= vagrant-full-setup +ENVIRONMENT ?= full-setup DEPLOY_DIR = $(PWD) ENV_DIR = $(DEPLOY_DIR)/environments/$(ENVIRONMENT) ANSIBLE_DIR = $(DEPLOY_DIR)/ansible diff --git a/README.md b/README.md index 6e15ac1107df495b37b20eab728581170e84595f..b57867d5767991203b78a9db0cb6970185579afa 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ $ git clone https://github.com/wazuh/wazuh-ansible.git $ git checkout tags/v4.1.5 ``` +Then select your `ENVIRONMENT` in `Makefile`. Set it to `full-setup` or `no-collector`. + 1. Provision Wazuh server and Wazuh agents: ``` @@ -49,6 +51,10 @@ $ docker logs -ft evidence-collector ## Potential issues +### ClamAV (re)start failed/timed out + +Try re-running `make provision` one more time. If this doesn't help, comment out the last task in `/ansible/clamav/tasks/install-clamav.yml` & try restarting ClamAV manually. + ### Vagrant issue: ``` @@ -94,10 +100,8 @@ Host key verification failed. Solution: ``` -ssh-keygen -f "/home/ales/.ssh/known_hosts" -R "192.168.33.10" -ssh-keygen -f "/home/ales/.ssh/known_hosts" -R "192.168.33.11" -ssh-keygen -f "/home/ales/.ssh/known_hosts" -R "192.168.33.12" -ssh-keyscan -H 192.168.33.10 >> /home/ales/.ssh/known_hosts -ssh-keyscan -H 192.168.33.11 >> /home/ales/.ssh/known_hosts -ssh-keyscan -H 192.168.33.12 >> /home/ales/.ssh/known_hosts +ssh-keygen -f ".ssh/known_hosts" -R "192.168.33.10" +ssh-keygen -f ".ssh/known_hosts" -R "192.168.33.11" +ssh-keygen -f ".ssh/known_hosts" -R "192.168.33.12" +ssh-keygen -f ".ssh/known_hosts" -R "192.168.33.13" ``` \ No newline at end of file diff --git a/environments/vagrant-full-setup/Vagrantfile b/environments/full-setup/Vagrantfile similarity index 50% rename from environments/vagrant-full-setup/Vagrantfile rename to environments/full-setup/Vagrantfile index 73ff79b11f0a95e3f19c05f12f3ebfc5342ed15b..2d669df4964899974cb62e83f69b2fffa44b60dd 100644 --- a/environments/vagrant-full-setup/Vagrantfile +++ b/environments/full-setup/Vagrantfile @@ -6,7 +6,7 @@ servers=[ :hostname => "manager", :ip => "192.168.33.10", :box => "centos/8", - :ram => 4096, + :ram => 2048, :cpu => 2 }, { @@ -27,7 +27,7 @@ servers=[ :hostname => "evidence-collector", :ip => "192.168.33.13", :box => "centos/8", - :ram => 2048, + :ram => 1024, :cpu => 2 } ] @@ -35,18 +35,6 @@ servers=[ Vagrant.configure(2) do |config| servers.each do |machine| config.vm.define machine[:hostname] do |node| - # Can cause error: - # "You are trying to forward a host IP that does not exist. Please set `host_ip` - # to the address of an existing IPv4 network interface, or remove the option - # from your port forward configuration." - #if machine[:hostname] == "manager" - # node.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "192.168.33.10" - # node.vm.network "forwarded_port", guest: 443, host: 8443 , host_ip: "192.168.33.10" - # node.vm.network "forwarded_port", guest: 55000, host: 55000 , host_ip: "192.168.33.10" - # node.vm.network "forwarded_port", guest: 1514, host: 1514 , host_ip: "192.168.33.10" - # node.vm.network "forwarded_port", guest: 1515, host: 1515 , host_ip: "192.168.33.10" - # node.vm.network "forwarded_port", guest: 1516, host: 1516 , host_ip: "192.168.33.10" - #end node.vm.box = machine[:box] node.vm.hostname = machine[:hostname] node.vm.network "private_network", ip: machine[:ip] diff --git a/environments/vagrant-full-setup/vagrant-full-setup.mk b/environments/full-setup/full-setup.mk similarity index 100% rename from environments/vagrant-full-setup/vagrant-full-setup.mk rename to environments/full-setup/full-setup.mk diff --git a/environments/vagrant-full-setup/inventory.txt b/environments/full-setup/inventory.txt similarity index 73% rename from environments/vagrant-full-setup/inventory.txt rename to environments/full-setup/inventory.txt index 05e28e470ec609705bd594df91f2153b60d8b782..cea1c6b98ce6f4712d9641a31cfc2ecd3e68ddcc 100644 --- a/environments/vagrant-full-setup/inventory.txt +++ b/environments/full-setup/inventory.txt @@ -1,18 +1,18 @@ [wazuh_managers] -192.168.33.10 public_ip=192.168.33.10 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant ansible_ssh_private_key_file=environments/vagrant-full-setup/.vagrant/machines/manager/virtualbox/private_key +192.168.33.10 public_ip=192.168.33.10 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant ansible_ssh_private_key_file=environments/full-setup/.vagrant/machines/manager/virtualbox/private_key [wazuh_managers:vars] ansible_ssh_common_args='-o StrictHostKeyChecking=no' [wazuh_agents] -192.168.33.11 public_ip=192.168.33.11 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant ansible_ssh_private_key_file=environments/vagrant-full-setup/.vagrant/machines/agent1/virtualbox/private_key -192.168.33.12 public_ip=192.168.33.12 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant ansible_ssh_private_key_file=environments/vagrant-full-setup/.vagrant/machines/agent2/virtualbox/private_key +192.168.33.11 public_ip=192.168.33.11 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant ansible_ssh_private_key_file=environments/full-setup/.vagrant/machines/agent1/virtualbox/private_key +192.168.33.12 public_ip=192.168.33.12 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant ansible_ssh_private_key_file=environments/full-setup/.vagrant/machines/agent2/virtualbox/private_key [wazuh_agents:vars] ansible_ssh_common_args='-o StrictHostKeyChecking=no' [evidence_collector] -192.168.33.13 public_ip=192.168.33.13 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant ansible_ssh_private_key_file=environments/vagrant-full-setup/.vagrant/machines/evidence-collector/virtualbox/private_key +192.168.33.13 public_ip=192.168.33.13 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant ansible_ssh_private_key_file=environments/full-setup/.vagrant/machines/evidence-collector/virtualbox/private_key [evidence_collector:vars] ansible_ssh_common_args='-o StrictHostKeyChecking=no' \ No newline at end of file diff --git a/environments/no-collector/Vagrantfile b/environments/no-collector/Vagrantfile new file mode 100644 index 0000000000000000000000000000000000000000..504035aabfe1c57acbeec320767cb44ba0dbed03 --- /dev/null +++ b/environments/no-collector/Vagrantfile @@ -0,0 +1,39 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +servers=[ + { + :hostname => "manager", + :ip => "192.168.33.10", + :box => "centos/8", + :ram => 2048, + :cpu => 2 + }, + { + :hostname => "agent1", + :ip => "192.168.33.11", + :box => "centos/8", + :ram => 512, + :cpu => 1 + }, + { + :hostname => "agent2", + :ip => "192.168.33.12", + :box => "centos/8", + :ram => 512, + :cpu => 1 + } +] + +Vagrant.configure(2) do |config| + servers.each do |machine| + config.vm.define machine[:hostname] do |node| + node.vm.box = machine[:box] + node.vm.hostname = machine[:hostname] + node.vm.network "private_network", ip: machine[:ip] + node.vm.provider "virtualbox" do |vb| + vb.customize ["modifyvm", :id, "--memory", machine[:ram]] + end + end + end +end \ No newline at end of file diff --git a/environments/no-collector/inventory.txt b/environments/no-collector/inventory.txt new file mode 100644 index 0000000000000000000000000000000000000000..30cfc80f8dfec844020bda2a89810f36c8a81a9a --- /dev/null +++ b/environments/no-collector/inventory.txt @@ -0,0 +1,12 @@ +[wazuh_managers] +192.168.33.10 public_ip=192.168.33.10 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant ansible_ssh_private_key_file=environments/no-collector/.vagrant/machines/manager/virtualbox/private_key + +[wazuh_managers:vars] +ansible_ssh_common_args='-o StrictHostKeyChecking=no' + +[wazuh_agents] +192.168.33.11 public_ip=192.168.33.11 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant ansible_ssh_private_key_file=environments/no-collector/.vagrant/machines/agent1/virtualbox/private_key +192.168.33.12 public_ip=192.168.33.12 ansible_ssh_pass=vagrant ansible_ssh_user=vagrant ansible_ssh_private_key_file=environments/no-collector/.vagrant/machines/agent2/virtualbox/private_key + +[wazuh_agents:vars] +ansible_ssh_common_args='-o StrictHostKeyChecking=no' \ No newline at end of file diff --git a/environments/no-collector/no-collector.mk b/environments/no-collector/no-collector.mk new file mode 100644 index 0000000000000000000000000000000000000000..244fcdd42c366fc7c7140b7ada8a50620a77096f --- /dev/null +++ b/environments/no-collector/no-collector.mk @@ -0,0 +1,18 @@ +VAGRANT_RUN = cd $(ENV_DIR) && vagrant +SSH_PRIVATE_KEY = $(HOME)/.vagrant.d/insecure_private_key +SSH_USER = vagrant + +create: + @$(VAGRANT_RUN) up + +delete: + @$(VAGRANT_RUN) destroy -f + +ssh-manager: + @$(VAGRANT_RUN) ssh manager + +ssh-agent1: + @$(VAGRANT_RUN) ssh agent1 + +ssh-agent2: + @$(VAGRANT_RUN) ssh agent2 \ No newline at end of file