Closed c-bordon closed 1 week ago
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ python3 deployability/modules/allocation/main.py --provider vagrant --size small --composite-name macos-sonoma-14.0-amd64 --instance-name cbordon-sonoma-test
[2024-05-02 09:30:04] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-05-02 09:30:04] [DEBUG] ALLOCATOR: Creating instance directory on remote host
[2024-05-02 09:30:17] [INFO] ALLOCATOR: Using the macStadium Intel server to deploy.
[2024-05-02 09:30:21] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-05-02 09:30:21] [DEBUG] ALLOCATOR: Generating new key pair
[2024-05-02 09:30:28] [DEBUG] ALLOCATOR: Vagrantfile created. Creating instance.
[2024-05-02 09:30:33] [INFO] ALLOCATOR: Instance cbordon-sonoma-test created.
[2024-05-02 09:31:17] [INFO] ALLOCATOR: Instance cbordon-sonoma-test started.
[2024-05-02 09:31:31] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/cbordon-sonoma-test/inventory.yml
[2024-05-02 09:31:33] [INFO] ALLOCATOR: SSH connection successful.
[2024-05-02 09:31:46] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/cbordon-sonoma-test/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ cat /tmp/wazuh-qa/cbordon-sonoma-test/inventory.yml
ansible_connection: ssh
ansible_host: 10.10.0.249
ansible_password: vagrant
ansible_port: 43220
ansible_ssh_common_args: -o StrictHostKeyChecking=no
ansible_user: vagrant
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ ssh vagrant@10.10.0.249 -p 5
ssh: connect to host 10.10.0.249 port 5: Connection refused
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ 333^C
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ ssh vagrant@10.10.0.249 -p 43220
The authenticity of host '[10.10.0.249]:43220 ([10.10.0.249]:43220)' can't be established.
ED25519 key fingerprint is SHA256:24SBu+PWrp88mcqhMvxEwZgKTAHBLkDisO8ceLH8bKY.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[10.10.0.249]:43220' (ED25519) to the list of known hosts.
(vagrant@10.10.0.249) Password:
Last login: Mon Apr 29 10:55:19 2024 from 10.10.0.149
vagrant@macos-14 ~ % sw_vers
ProductName: macOS
ProductVersion: 14.4.1
BuildVersion: 23E224
vagrant@macos-14 ~ % exit
Connection to 10.10.0.249 closed.
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ python3 deployability/modules/allocation/main.py --action delete --track-output /tmp/wazuh-qa/cbordon-sonoma-test/track.yml
[2024-05-02 09:43:10] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/cbordon-sonoma-test/track.yml
[2024-05-02 09:43:11] [DEBUG] ALLOCATOR: Destroying instance cbordon-sonoma-test
[2024-05-02 09:43:28] [DEBUG] ALLOCATOR: Deleting remote directory /Users/jenkins/testing/cbordon-sonoma-test
[2024-05-02 09:43:32] [INFO] ALLOCATOR: Instance cbordon-sonoma-test deleted.
sh-3.2# cd testing/cbordon-sonoma-test/
sh-3.2# ls -la
total 8
drwxr-xr-x 4 jenkins staff 128 May 2 05:30 .
drwxr-xr-x 3 jenkins staff 96 May 2 05:30 ..
drwxr-xr-x 5 root staff 160 May 2 05:30 .vagrant
-rw-r--r-- 1 jenkins staff 607 May 2 05:30 Vagrantfile
sh-3.2# pwd
/Users/jenkins/testing/cbordon-sonoma-test
sh-3.2# vagrant status
Current machine states:
default running (parallels)
The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.
sh-3.2# vagrant port
The forwarded ports for the machine are listed below. Please note that
these values may differ from values configured in the Vagrantfile if the
provider supports automatic port collision detection and resolution.
22 (guest) => 43220 (host)
sh-3.2# cd ..
sh-3.2# prlctl list --all
UUID STATUS IP_ADDR NAME
{32b7a04d-77fa-4009-b639-49e39fcf43fd} stopped - cbordon-sonoma-test
{b3d5aae2-5cfa-4e63-adbf-2c1776eaba31} running - macos-mojave-testing
sh-3.2# prlctl list --all
UUID STATUS IP_ADDR NAME
{b3d5aae2-5cfa-4e63-adbf-2c1776eaba31} running - macos-mojave-testing
sh-3.2# ls -la
total 0
drwxr-xr-x 2 jenkins staff 64 May 2 05:43 .
drwxr-x---+ 28 jenkins staff 896 May 2 05:29 ..
sh-3.2# pwd
/Users/jenkins/testing
I encountered an error that caused us to have to change how the vagrant commands were executed on the macStadium hosts. The Intel host has the peculiarity that we are going to use 2 providers, Parallels and VirtualBox. For some reason when we try to execute the vagrant up
command through ssh, vagrant chooses Parallels as its provider, and if we force the use of VirutalBox it tells us that it cannot find the binary:
A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.
This is because when we execute commands through ssh we cannot access the user's PATH, thus defining the path where the executables are located is not possible. We tried various options but we couldn't find the solution. The only solution we could think of that worked was to create an auxiliary script to execute the vagrant commands on these machines, with this, within the script we made all the necessary configurations. With this, we were able to set up the machines with the different providers without problems:
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ python3 deployability/modules/allocation/main.py --provider vagrant --size small --instance-name cbordon-test --composite-name macos-highsierra-10.13.6-amd64
[2024-05-02 13:49:19] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-05-02 13:49:19] [DEBUG] ALLOCATOR: Creating instance directory on remote host
[2024-05-02 13:49:31] [INFO] ALLOCATOR: Using the macStadium Intel server to deploy.
[2024-05-02 13:49:35] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-05-02 13:49:35] [DEBUG] ALLOCATOR: Generating new key pair
[2024-05-02 13:49:42] [DEBUG] ALLOCATOR: Vagrantfile created. Creating instance.
[2024-05-02 13:49:55] [INFO] ALLOCATOR: Instance cbordon-test created.
[2024-05-02 13:51:32] [INFO] ALLOCATOR: Instance cbordon-test started.
[2024-05-02 13:51:43] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/cbordon-test/inventory.yml
[2024-05-02 13:51:44] [INFO] ALLOCATOR: SSH connection successful.
[2024-05-02 13:51:55] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/cbordon-test/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ cat /tmp/wazuh-qa/cbordon-test/inventory.yml
ansible_connection: ssh
ansible_host: 10.10.0.249
ansible_password: vagrant
ansible_port: 43220
ansible_ssh_common_args: -o StrictHostKeyChecking=no
ansible_user: vagrant
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ cat /tmp/wazuh-qa/cbordon-test/track.yml
arch: amd64
host_identifier: macstadium
host_instance_dir: /Users/jenkins/testing/cbordon-test
identifier: cbordon-test
instance_dir: /tmp/wazuh-qa/cbordon-test
key_path: /tmp/wazuh-qa/cbordon-test/instance_key
platform: macos
provider: vagrant
ssh_port: 43220
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ ssh -p 43220 vagrant@10.10.0.249
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:UkRReeZMvu2orXbmj5p6x4i3O2/hqYRxeSlmlUuxVr0.
Please contact your system administrator.
Add correct host key in /home/cbordon/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/cbordon/.ssh/known_hosts:1289
remove with:
ssh-keygen -f "/home/cbordon/.ssh/known_hosts" -R "[10.10.0.249]:43220"
Host key for [10.10.0.249]:43220 has changed and you have requested strict checking.
Host key verification failed.
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ ssh-keygen -f "/home/cbordon/.ssh/known_hosts" -R "[10.10.0.249]:43220"
# Host [10.10.0.249]:43220 found: line 1287
# Host [10.10.0.249]:43220 found: line 1288
# Host [10.10.0.249]:43220 found: line 1289
/home/cbordon/.ssh/known_hosts updated.
Original contents retained as /home/cbordon/.ssh/known_hosts.old
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ ssh -p 43220 vagrant@10.10.0.249
The authenticity of host '[10.10.0.249]:43220 ([10.10.0.249]:43220)' can't be established.
ED25519 key fingerprint is SHA256:UkRReeZMvu2orXbmj5p6x4i3O2/hqYRxeSlmlUuxVr0.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '[10.10.0.249]:43220' (ED25519) to the list of known hosts.
(vagrant@10.10.0.249) Password:
Last login: Mon Oct 28 09:13:54 2019 from 192.168.0.76
vagrants-iMac:~ vagrant$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.13.6
BuildVersion: 17G65
vagrants-iMac:~ vagrant$ exit
logout
Connection to 10.10.0.249 closed.
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ python3 deployability/modules/allocation/main.py --action delete --track-output /tmp/wazuh-qa/cbordon-test/track.yml
[2024-05-02 13:54:29] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/cbordon-test/track.yml
[2024-05-02 13:54:30] [DEBUG] ALLOCATOR: Destroying instance cbordon-test
[2024-05-02 13:54:44] [DEBUG] ALLOCATOR: Deleting remote directory /Users/jenkins/testing/cbordon-test
[2024-05-02 13:54:47] [INFO] ALLOCATOR: Instance cbordon-test deleted.
jenkins@48503 testing % cd cbordon-test
jenkins@48503 cbordon-test % ls -la
total 16
drwxr-xr-x 5 jenkins staff 160 May 2 09:49 .
drwxr-xr-x 3 jenkins staff 96 May 2 09:49 ..
drwxr-xr-x 5 root staff 160 May 2 09:49 .vagrant
-rw-r--r-- 1 jenkins staff 510 May 2 09:49 Vagrantfile
-rwx------ 1 jenkins staff 474 May 2 09:49 vagrant_script.sh
jenkins@48503 cbordon-test % sudo vagrant status
Current machine states:
default running (virtualbox)
The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.
jenkins@48503 cbordon-test % sudo vagrant port
The forwarded ports for the machine are listed below. Please note that
these values may differ from values configured in the Vagrantfile if the
provider supports automatic port collision detection and resolution.
22 (guest) => 2222 (host)
22 (guest) => 43220 (host)
jenkins@48503 cbordon-test % vagrant global-status
id name provider state directory
-------------------------------------------------------------------------------
f3c11b3 default parallels running /Users/jenkins/testing/cbordon-mojave-test
19936e5 default virtualbox running /Users/jenkins/testing/cbordon-test
The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date (use "vagrant global-status --prune" to prune invalid
entries). To interact with any of the machines, you can go to that
directory and run Vagrant, or you can use the ID directly with
Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ python3 deployability/modules/allocation/main.py --provider vagrant --size small --instance-name cbordon-test --composite-name macos-sonoma-14.4.1-amd64
[2024-05-02 14:15:13] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-05-02 14:15:13] [DEBUG] ALLOCATOR: Creating instance directory on remote host
[2024-05-02 14:15:25] [INFO] ALLOCATOR: Using the macStadium Intel server to deploy.
[2024-05-02 14:15:29] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-05-02 14:15:29] [DEBUG] ALLOCATOR: Generating new key pair
[2024-05-02 14:15:36] [DEBUG] ALLOCATOR: Vagrantfile created. Creating instance.
[2024-05-02 14:15:49] [INFO] ALLOCATOR: Instance cbordon-test created.
[2024-05-02 14:16:32] [INFO] ALLOCATOR: Instance cbordon-test started.
[2024-05-02 14:16:45] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/cbordon-test/inventory.yml
[2024-05-02 14:16:47] [INFO] ALLOCATOR: SSH connection successful.
[2024-05-02 14:17:00] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/cbordon-test/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ cat /tmp/wazuh-qa/cbordon-test/inventory.yml
ansible_connection: ssh
ansible_host: 10.10.0.249
ansible_password: vagrant
ansible_port: 43220
ansible_ssh_common_args: -o StrictHostKeyChecking=no
ansible_user: vagrant
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ cat /tmp/wazuh-qa/cbordon-test/track.yml
arch: amd64
host_identifier: macstadium
host_instance_dir: /Users/jenkins/testing/cbordon-test
identifier: cbordon-test
instance_dir: /tmp/wazuh-qa/cbordon-test
key_path: /tmp/wazuh-qa/cbordon-test/instance_key
platform: macos
provider: vagrant
ssh_port: 43220
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ ssh -o StrictHostKeyChecking=no -p 43220 vagrant@10.10.0.249
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ED25519 key sent by the remote host is
SHA256:24SBu+PWrp88mcqhMvxEwZgKTAHBLkDisO8ceLH8bKY.
Please contact your system administrator.
Add correct host key in /home/cbordon/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /home/cbordon/.ssh/known_hosts:1288
remove with:
ssh-keygen -f "/home/cbordon/.ssh/known_hosts" -R "[10.10.0.249]:43220"
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.
UpdateHostkeys is disabled because the host key is not trusted.
vagrant@10.10.0.249: Permission denied (publickey,password,keyboard-interactive).
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ ssh-keygen -f "/home/cbordon/.ssh/known_hosts" -R "[10.10.0.249]:43220"
# Host [10.10.0.249]:43220 found: line 1287
# Host [10.10.0.249]:43220 found: line 1288
/home/cbordon/.ssh/known_hosts updated.
Original contents retained as /home/cbordon/.ssh/known_hosts.old
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ ssh -o StrictHostKeyChecking=no -p 43220 vagrant@10.10.0.249
Warning: Permanently added '[10.10.0.249]:43220' (ED25519) to the list of known hosts.
(vagrant@10.10.0.249) Password:
Last login: Mon Apr 29 10:55:19 2024 from 10.10.0.149
vagrant@macos-14 ~ % sw_vers
ProductName: macOS
ProductVersion: 14.4.1
BuildVersion: 23E224
vagrant@macos-14 ~ % exit
Connection to 10.10.0.249 closed.
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ python3 deployability/modules/allocation/main.py --action delete --track-output /tmp/wazuh-qa/cbordon-test/track.yml
[2024-05-02 14:34:56] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/cbordon-test/track.yml
[2024-05-02 14:34:57] [DEBUG] ALLOCATOR: Destroying instance cbordon-test
[2024-05-02 14:35:13] [DEBUG] ALLOCATOR: Deleting remote directory /Users/jenkins/testing/cbordon-test
[2024-05-02 14:35:17] [INFO] ALLOCATOR: Instance cbordon-test deleted.
jenkins@48503 testing % cd cbordon-test
jenkins@48503 cbordon-test % sudo vagrant status
Current machine states:
default running (parallels)
The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.
jenkins@48503 cbordon-test % sudo vagrant port
The forwarded ports for the machine are listed below. Please note that
these values may differ from values configured in the Vagrantfile if the
provider supports automatic port collision detection and resolution.
22 (guest) => 43220 (host)
jenkins@48503 cbordon-test % sudo prlctl list
UUID STATUS IP_ADDR NAME
{c1d25914-7977-4134-bc5a-0f85eedcd3b0} running - cbordon-test
jenkins@48503 cbordon-test % cd ..
jenkins@48503 testing % ls -la
total 0
drwxr-xr-x 2 jenkins staff 64 May 2 10:35 .
drwxr-x---+ 29 jenkins staff 928 May 2 09:40 ..
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ python3 deployability/modules/allocation/main.py --provider vagrant --size small --instance-name cbordon-test --composite-name macos-sonoma-14.0-arm64
[2024-05-02 14:43:52] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-05-02 14:43:52] [DEBUG] ALLOCATOR: Creating instance directory on remote host
[2024-05-02 14:43:57] [INFO] ALLOCATOR: macStadium ARM server has less than 2 VMs running, deploying in this host.
[2024-05-02 14:44:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-05-02 14:44:01] [DEBUG] ALLOCATOR: Generating new key pair
[2024-05-02 14:44:04] [DEBUG] ALLOCATOR: Vagrantfile created. Creating instance.
[2024-05-02 14:44:17] [INFO] ALLOCATOR: Instance cbordon-test created.
[2024-05-02 14:45:47] [INFO] ALLOCATOR: Instance cbordon-test started.
[2024-05-02 14:46:06] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/cbordon-test/inventory.yml
[2024-05-02 14:46:07] [INFO] ALLOCATOR: SSH connection successful.
[2024-05-02 14:46:18] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/cbordon-test/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ cat /tmp/wazuh-qa/cbordon-test/inventory.yml
ansible_connection: ssh
ansible_host: 10.10.0.250
ansible_password: vagrant
ansible_port: 43220
ansible_ssh_common_args: -o StrictHostKeyChecking=no
ansible_user: vagrant
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ ssh -p 43220 vagrant@10.10.0.250
(vagrant@10.10.0.250) Password:
Last login: Wed Oct 11 06:37:33 2023
vagrant@vagrants-Virtual-Machine ~ % sw_vers
ProductName: macOS
ProductVersion: 14.0
BuildVersion: 23A344
vagrant@vagrants-Virtual-Machine ~ % exit
Connection to 10.10.0.250 closed.
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa$ python3 deployability/modules/allocation/main.py --action delete --track-output /tmp/wazuh-qa/cbordon-test/track.yml
[2024-05-02 14:47:00] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/cbordon-test/track.yml
[2024-05-02 14:47:02] [DEBUG] ALLOCATOR: Destroying instance cbordon-test
[2024-05-02 14:47:18] [DEBUG] ALLOCATOR: Deleting remote directory /Users/jenkins/testing/cbordon-test
[2024-05-02 14:47:22] [DEBUG] ALLOCATOR: Killing remote process on port 43220
[2024-05-02 14:47:30] [INFO] ALLOCATOR: Instance cbordon-test deleted.
jenkins@66460 testing % ls -la cbordon-test
total 16
drwxr-xr-x 5 jenkins staff 160 May 2 10:44 .
drwxr-xr-x 9 jenkins staff 288 May 2 10:44 ..
drwxr-xr-x 5 root staff 160 May 2 10:44 .vagrant
-rw-r--r-- 1 jenkins staff 517 May 2 10:44 Vagrantfile
-rwx------ 1 jenkins staff 474 May 2 10:44 vagrant_script.sh
With the provisioning of a new Intel host on macStadium, it is necessary to update the Allocation module so that it can deploy this type of VM on this host.