wazuh / wazuh-qa

Wazuh - Quality Assurance
GNU General Public License v2.0
61 stars 30 forks source link

DTT1 - Iteration 3 - Allocation module - Decript Windows RDP password #4933

Closed c-bordon closed 1 month ago

c-bordon commented 3 months ago

It is necessary that the module be able to decrypt the password of the Administrator user of the Windows machines and this password must be in the inventory.yml as output.

UserData tests:

c-bordon commented 2 months ago

Update report

Currently we are using all AMIs created by the cicd/qa team and maintained by Wazuh, these AMIs have the particularity of not using the Administrator user, but rather using the Jenkins user with a particular key. This means that it is not necessary to decrypt the keys in AWS since it is a key configured by the owner of the AMI.

For this reason, what we have to do is use Windows AMIs provided by the Wazuh QA team. In the event that we want to use AWS AMIs, we will have to develop the functions to decrypt the AWS keys.

The following tests were carried out:

Windows desktop 10

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-desktop-10-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00"
[2024-02-26 16:23:50] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-02-26 16:23:50] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-02-26 16:23:50] [DEBUG] ALLOCATOR: Using provided key pair
[2024-02-26 16:23:51] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/wazuh-qa/AWS-001A75B5-833B-42D5-A7B4-67C1D9D6BB63
[2024-02-26 16:24:08] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-001A75B5-833B-42D5-A7B4-67C1D9D6BB63 directory to /tmp/wazuh-qa/i-0fe06fddb8b4ad70a
[2024-02-26 16:24:08] [INFO] ALLOCATOR: Instance i-0fe06fddb8b4ad70a created.
[2024-02-26 16:24:10] [INFO] ALLOCATOR: Instance i-0fe06fddb8b4ad70a started.
[2024-02-26 16:24:10] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/inventory.yml
[2024-02-26 16:24:10] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/inventory.yml
ansible_host: ec2-54-173-172-12.compute-1.amazonaws.com
ansible_password: -J3nk1ns-
ansible_port: 3389
ansible_ssh_private_key_file: None
ansible_user: Jenkins
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/track.yml
host_identifier: None
identifier: i-0fe06fddb8b4ad70a
instance_dir: /tmp/wazuh-qa/i-0fe06fddb8b4ad70a
key_path: /home/cbordon/.ssh/allocation_test
provider: aws
ssh_port: 3389
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --provider aws --action delete --track-output /tmp/wazuh-qa/track.yml[2024-02-26 16:26:30] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/track.yml
[2024-02-26 16:31:23] [INFO] ALLOCATOR: Instance i-0fe06fddb8b4ad70a deleted.

Screenshot_20240226_162624

Windows desktop 11

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-desktop-11-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00"
[2024-02-26 16:31:45] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-02-26 16:31:46] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-02-26 16:31:46] [DEBUG] ALLOCATOR: Using provided key pair
[2024-02-26 16:31:46] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/wazuh-qa/AWS-5A64111C-8EB2-4D46-9045-4FB6E5C00F16
[2024-02-26 16:32:04] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-5A64111C-8EB2-4D46-9045-4FB6E5C00F16 directory to /tmp/wazuh-qa/i-06c12bcae25e9f00a
[2024-02-26 16:32:04] [INFO] ALLOCATOR: Instance i-06c12bcae25e9f00a created.
[2024-02-26 16:32:06] [INFO] ALLOCATOR: Instance i-06c12bcae25e9f00a started.
[2024-02-26 16:32:06] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/inventory.yml
[2024-02-26 16:32:06] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/inventory.yml
ansible_host: ec2-3-236-168-184.compute-1.amazonaws.com
ansible_password: -J3nk1ns-
ansible_port: 3389
ansible_ssh_private_key_file: None
ansible_user: Jenkins
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --provider aws --action delete --track-output /tmp/wazuh-qa/track.yml[2024-02-26 16:37:07] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/track.yml
[2024-02-26 16:42:16] [INFO] ALLOCATOR: Instance i-06c12bcae25e9f00a deleted.

Screenshot_20240226_163701

Windows server 2012 R2

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-server-2012r2-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00"
[2024-02-26 16:42:32] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-02-26 16:42:32] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-02-26 16:42:32] [DEBUG] ALLOCATOR: Using provided key pair
[2024-02-26 16:42:32] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/wazuh-qa/AWS-9E06249E-C596-417D-80A8-03598F8B0BA3
[2024-02-26 16:42:50] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-9E06249E-C596-417D-80A8-03598F8B0BA3 directory to /tmp/wazuh-qa/i-03442249415a49927
[2024-02-26 16:42:50] [INFO] ALLOCATOR: Instance i-03442249415a49927 created.
[2024-02-26 16:42:52] [INFO] ALLOCATOR: Instance i-03442249415a49927 started.
[2024-02-26 16:42:52] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/inventory.yml
[2024-02-26 16:42:52] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/inventory.yml
ansible_host: ec2-44-200-225-37.compute-1.amazonaws.com
ansible_password: -J3nk1ns-
ansible_port: 3389
ansible_ssh_private_key_file: None
ansible_user: Jenkins
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --provider aws --action delete --track-output /tmp/wazuh-qa/track.yml[2024-02-26 16:45:31] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/track.yml
[2024-02-26 16:46:04] [INFO] ALLOCATOR: Instance i-03442249415a49927 deleted.

Screenshot_20240226_164525

Windows server 2016

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-server-2016-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00"
[2024-02-26 16:46:13] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-02-26 16:46:13] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-02-26 16:46:13] [DEBUG] ALLOCATOR: Using provided key pair
[2024-02-26 16:46:14] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/wazuh-qa/AWS-D3F8B72D-1763-4E08-AB38-F47FDDB06A3C
[2024-02-26 16:46:31] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-D3F8B72D-1763-4E08-AB38-F47FDDB06A3C directory to /tmp/wazuh-qa/i-0c85e7be7109e4871
[2024-02-26 16:46:31] [INFO] ALLOCATOR: Instance i-0c85e7be7109e4871 created.
[2024-02-26 16:46:33] [INFO] ALLOCATOR: Instance i-0c85e7be7109e4871 started.
[2024-02-26 16:46:33] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/inventory.yml
[2024-02-26 16:46:33] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/inventory.yml
ansible_host: ec2-3-237-92-4.compute-1.amazonaws.com
ansible_password: -J3nk1ns-
ansible_port: 3389
ansible_ssh_private_key_file: None
ansible_user: Jenkins
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --provider aws --action delete --track-output /tmp/wazuh-qa/track.yml[2024-02-26 16:47:57] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/track.yml
[2024-02-26 16:49:01] [INFO] ALLOCATOR: Instance i-0c85e7be7109e4871 deleted.

Screenshot_20240226_164751

Windows server 2019

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-server-2019-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00"
[2024-02-26 16:49:10] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-02-26 16:49:10] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-02-26 16:49:10] [DEBUG] ALLOCATOR: Using provided key pair
[2024-02-26 16:49:11] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/wazuh-qa/AWS-CD3A9222-4D48-4B94-8F35-B459FBB7BFF1
[2024-02-26 16:49:29] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-CD3A9222-4D48-4B94-8F35-B459FBB7BFF1 directory to /tmp/wazuh-qa/i-0329463afbffef3f4
[2024-02-26 16:49:29] [INFO] ALLOCATOR: Instance i-0329463afbffef3f4 created.
[2024-02-26 16:49:30] [INFO] ALLOCATOR: Instance i-0329463afbffef3f4 started.
[2024-02-26 16:49:31] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/inventory.yml
[2024-02-26 16:49:31] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/inventory.yml
ansible_host: ec2-3-220-164-115.compute-1.amazonaws.com
ansible_password: -J3nk1ns-
ansible_port: 3389
ansible_ssh_private_key_file: None
ansible_user: Jenkins
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --provider aws --action delete --track-output /tmp/wazuh-qa/track.yml[2024-02-26 16:51:37] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/track.yml
[2024-02-26 16:52:10] [INFO] ALLOCATOR: Instance i-0329463afbffef3f4 deleted.

Screenshot_20240226_165131

Windows server 2022

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-server-2022-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00"
[2024-02-26 16:52:19] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-02-26 16:52:19] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-02-26 16:52:19] [DEBUG] ALLOCATOR: Using provided key pair
[2024-02-26 16:52:20] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/wazuh-qa/AWS-2D745B27-729F-4B6A-B846-0FA30BD3D11A
[2024-02-26 16:52:38] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-2D745B27-729F-4B6A-B846-0FA30BD3D11A directory to /tmp/wazuh-qa/i-044ae774e784ae6e2
[2024-02-26 16:52:38] [INFO] ALLOCATOR: Instance i-044ae774e784ae6e2 created.
[2024-02-26 16:52:39] [INFO] ALLOCATOR: Instance i-044ae774e784ae6e2 started.
[2024-02-26 16:52:39] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/inventory.yml
[2024-02-26 16:52:39] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/inventory.yml
ansible_host: ec2-44-214-140-242.compute-1.amazonaws.com
ansible_password: -J3nk1ns-
ansible_port: 3389
ansible_ssh_private_key_file: None
ansible_user: Jenkins
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --provider aws --action delete --track-output /tmp/wazuh-qa/track.yml[2024-02-26 16:55:31] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/track.yml
[2024-02-26 16:56:50] [INFO] ALLOCATOR: Instance i-044ae774e784ae6e2 deleted.

Screenshot_20240226_165526

It remains to update the inventory so that it has the necessary output data for the Windows rdp connection

c-bordon commented 2 months ago

Vagrant

The necessary changes were made for the Windows deployment in vagrant. It was used to improve the creation of the inventory file where we left out all the parameters that have None as a value, in this way, the inventory has all the necessary data to be able to connect to the created machine, without additional parameters.

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-server-2022-amd64 --provider vagrant --size micro
[2024-02-27 10:03:55] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-02-27 10:03:55] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-02-27 10:03:55] [DEBUG] ALLOCATOR: Generating new key pair
[2024-02-27 10:03:59] [DEBUG] ALLOCATOR: Vagrantfile created. Creating instance.
[2024-02-27 10:03:59] [INFO] ALLOCATOR: Instance VAGRANT-90C0F592-1C35-494F-9FA6-9AA7E91438E8 created.
[2024-02-27 10:07:24] [INFO] ALLOCATOR: Instance VAGRANT-90C0F592-1C35-494F-9FA6-9AA7E91438E8 started.
[2024-02-27 10:07:27] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/inventory.yml
[2024-02-27 10:07:31] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/inventory.yml
ansible_connection: winrm
ansible_host: 192.168.57.2
ansible_port: 22
ansible_user: vagrant
ansible_winrm_server_cert_validation: ignore
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/track.yml
host_identifier: None
identifier: VAGRANT-90C0F592-1C35-494F-9FA6-9AA7E91438E8
instance_dir: /tmp/wazuh-qa/VAGRANT-90C0F592-1C35-494F-9FA6-9AA7E91438E8
key_path: /tmp/wazuh-qa/VAGRANT-90C0F592-1C35-494F-9FA6-9AA7E91438E8/instance_key
provider: vagrant
ssh_port: 22
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --provider aws --action delete --track-output /tmp/wazuh-qa/track.yml
[2024-02-27 10:09:22] [INFO] ALLOCATOR: Deleting instance from trackfile /tmp/wazuh-qa/track.yml
[2024-02-27 10:09:22] [DEBUG] ALLOCATOR: Destroying instance VAGRANT-90C0F592-1C35-494F-9FA6-9AA7E91438E8
[2024-02-27 10:09:28] [INFO] ALLOCATOR: Instance VAGRANT-90C0F592-1C35-494F-9FA6-9AA7E91438E8 deleted.

Screenshot_20240227_100914

c-bordon commented 2 months ago

Inventory file

macOS

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name macos-sonoma-14.0-arm64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00"
[2024-02-27 09:02:20] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-02-27 09:02:25] [INFO] ALLOCATOR: macStadium server has less than 2 VMs running, using Vagrant provider.
[2024-02-27 09:02:25] [DEBUG] ALLOCATOR: Creating instance directory on remote host
[2024-02-27 09:02:29] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-02-27 09:02:29] [DEBUG] ALLOCATOR: Using provided key pair
[2024-02-27 09:02:33] [DEBUG] ALLOCATOR: Vagrantfile created. Creating instance.
[2024-02-27 09:02:38] [INFO] ALLOCATOR: Instance VAGRANT-8C1D47C1-2EDF-487F-9F75-AB4F65DD7FE1 created.
[2024-02-27 09:04:08] [INFO] ALLOCATOR: Instance VAGRANT-8C1D47C1-2EDF-487F-9F75-AB4F65DD7FE1 started.
[2024-02-27 09:04:31] [INFO] ALLOCATOR: SSH connection string: ssh vagrant@10.10.0.250 -p 43220
[2024-02-27 09:04:31] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/inventory.yml
[2024-02-27 09:04:44] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/inventory.yml
ansible_connection: ssh
ansible_host: 10.10.0.250
ansible_password: vagrant
ansible_port: 43220
ansible_user: vagrant
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/track.yml
host_identifier: /Users/jenkins/testing/VAGRANT-8C1D47C1-2EDF-487F-9F75-AB4F65DD7FE1
identifier: VAGRANT-8C1D47C1-2EDF-487F-9F75-AB4F65DD7FE1
instance_dir: /tmp/wazuh-qa/VAGRANT-8C1D47C1-2EDF-487F-9F75-AB4F65DD7FE1
key_path: /home/cbordon/.ssh/allocation_test
provider: vagrant
ssh_port: 43220

Linux

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name linux-ubuntu-20.04-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00"
[2024-02-27 09:05:45] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-02-27 09:05:45] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-02-27 09:05:45] [DEBUG] ALLOCATOR: Using provided key pair
[2024-02-27 09:05:46] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/wazuh-qa/AWS-F1739C98-88DA-41EF-94E6-45AF610AB3DF
[2024-02-27 09:06:04] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-F1739C98-88DA-41EF-94E6-45AF610AB3DF directory to /tmp/wazuh-qa/i-0fe3cd7c5d07d1a6c
[2024-02-27 09:06:04] [INFO] ALLOCATOR: Instance i-0fe3cd7c5d07d1a6c created.
[2024-02-27 09:06:06] [INFO] ALLOCATOR: Instance i-0fe3cd7c5d07d1a6c started.
[2024-02-27 09:06:06] [INFO] ALLOCATOR: SSH connection string: ssh ubuntu@ec2-3-237-241-58.compute-1.amazonaws.com -p 22 -i /home/cbordon/.ssh/allocation_test
[2024-02-27 09:06:06] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/inventory.yml
[2024-02-27 09:06:06] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/inventory.yml
ansible_connection: ssh
ansible_host: ec2-3-237-241-58.compute-1.amazonaws.com
ansible_port: 22
ansible_ssh_private_key_file: /home/cbordon/.ssh/allocation_test
ansible_user: ubuntu
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/track.yml
host_identifier: None
identifier: i-0fe3cd7c5d07d1a6c
instance_dir: /tmp/wazuh-qa/i-0fe3cd7c5d07d1a6c
key_path: /home/cbordon/.ssh/allocation_test
provider: aws
ssh_port: 22

Windows

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-server-2022-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00"
[2024-02-27 09:07:58] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-02-27 09:07:58] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-02-27 09:07:58] [DEBUG] ALLOCATOR: Using provided key pair
[2024-02-27 09:07:59] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/wazuh-qa/AWS-15DA4125-E922-44D7-BE91-367DB0971E2E
[2024-02-27 09:08:16] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-15DA4125-E922-44D7-BE91-367DB0971E2E directory to /tmp/wazuh-qa/i-09c43b5c62574f009
[2024-02-27 09:08:16] [INFO] ALLOCATOR: Instance i-09c43b5c62574f009 created.
[2024-02-27 09:08:18] [INFO] ALLOCATOR: Instance i-09c43b5c62574f009 started.
[2024-02-27 09:08:18] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/inventory.yml
[2024-02-27 09:08:18] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/inventory.yml
ansible_connection: winrm
ansible_host: ec2-18-207-184-113.compute-1.amazonaws.com
ansible_password: -J3nk1ns-
ansible_port: 3389
ansible_user: Jenkins
ansible_winrm_server_cert_validation: ignore
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/track.yml
host_identifier: None
identifier: i-09c43b5c62574f009
instance_dir: /tmp/wazuh-qa/i-09c43b5c62574f009
key_path: /home/cbordon/.ssh/allocation_test
provider: aws
ssh_port: 3389
c-bordon commented 2 months ago

Update report

Some changes were requested in the Windows deploy, a userData script was added for Windows enabling winrm and at the same time the idea is to have a dynamic password for the instances, I am working for now without success on this user data script

c-bordon commented 2 months ago

Update report

After investigating, I found that the error in the userData was since these AMIs do not have the AWS tool for Windows installed, so I started to update these AMIs with this tool create new AMIs with this installation, and test that the userData works correctly. I was able to update practically all the AMIs except for Windows 11. I encountered problems executing the shutdown with Sysprep. I found an error in the logs that I cannot resolve, I will continue investigating.

c-bordon commented 2 months ago

Update report

I still have problems with Windows 11, I found that the problem with enabling AWS tools was that I had pending updates, after applying all the updates and enabling AWS tools, I created new AMIs again, but without success, it does not work as expected. userData configuration for password change.

At the moment I am moving forward with the code, I have to generate a new function that is responsible for creating a key, I am thinking of including it in the credentials class, it seems like the right place, although I have to make several modifications since this class was designed to use ssh keys and not for passwords.

c-bordon commented 2 months ago

AWS

Windows 10

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-desktop-10-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00"
[2024-03-01 10:15:55] [INFO] ALLOCATOR: Creating instance at /tmp/wazuh-qa
[2024-03-01 10:15:55] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-03-01 10:15:55] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/wazuh-qa/AWS-E3BB9C3D-0437-4472-A95E-7B75C2503F0D
[2024-03-01 10:16:13] [DEBUG] ALLOCATOR: Renaming temp /tmp/wazuh-qa/AWS-E3BB9C3D-0437-4472-A95E-7B75C2503F0D directory to /tmp/wazuh-qa/i-095d3d1b6b06b72e2
[2024-03-01 10:16:13] [INFO] ALLOCATOR: Instance i-095d3d1b6b06b72e2 created.
[2024-03-01 10:16:15] [INFO] ALLOCATOR: Instance i-095d3d1b6b06b72e2 started.
[2024-03-01 10:16:15] [INFO] ALLOCATOR: Inventory file generated at /tmp/wazuh-qa/inventory.yml
[2024-03-01 10:16:15] [INFO] ALLOCATOR: Track file generated at /tmp/wazuh-qa/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/inventory.yml
ansible_connection: winrm
ansible_host: ec2-44-223-107-214.compute-1.amazonaws.com
ansible_password: K-a!m<w7MdOY
ansible_port: 3389
ansible_user: Administrator
ansible_winrm_server_cert_validation: ignore
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/wazuh-qa/track.yml
host_identifier: None
identifier: i-095d3d1b6b06b72e2
instance_dir: /tmp/wazuh-qa/i-095d3d1b6b06b72e2
key_path: /home/cbordon/.ssh/allocation_test
provider: aws
ssh_port: 3389

Screenshot_20240301_103800

c-bordon commented 2 months ago

Windows server 2022

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-server-2022-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00" --working-dir /tmp/windows-server-2022 --inventory-output /tmp/windows-server-2022/inventory.yml --track-output /tmp/windows-server-2022/track.yml
[2024-03-01 11:43:01] [INFO] ALLOCATOR: Creating instance at /tmp/windows-server-2022
[2024-03-01 11:43:01] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-03-01 11:43:01] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/windows-server-2022/AWS-1621BE2D-9616-4655-8F5C-EA79CF97D374
[2024-03-01 11:43:19] [DEBUG] ALLOCATOR: Renaming temp /tmp/windows-server-2022/AWS-1621BE2D-9616-4655-8F5C-EA79CF97D374 directory to /tmp/windows-server-2022/i-0fab4e53b2c0d1865
[2024-03-01 11:43:19] [INFO] ALLOCATOR: Instance i-0fab4e53b2c0d1865 created.
[2024-03-01 11:43:21] [INFO] ALLOCATOR: Instance i-0fab4e53b2c0d1865 started.
[2024-03-01 11:43:21] [INFO] ALLOCATOR: Inventory file generated at /tmp/windows-server-2022/inventory.yml
[2024-03-01 11:43:21] [INFO] ALLOCATOR: Track file generated at /tmp/windows-server-2022/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/windows-server-2022/inventory.yml
ansible_connection: winrm
ansible_host: ec2-44-212-220-170.compute-1.amazonaws.com
ansible_password: PubD4sWA3qS
ansible_port: 3389
ansible_user: Administrator
ansible_winrm_server_cert_validation: ignore
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/windows-server-2022/track.yml
host_identifier: None
identifier: i-0fab4e53b2c0d1865
instance_dir: /tmp/windows-server-2022/i-0fab4e53b2c0d1865
key_path: /home/cbordon/.ssh/allocation_test
provider: aws
ssh_port: 3389

Screenshot_20240301_114820

c-bordon commented 2 months ago

Windows server 2019

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-server-2019-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00" --working-dir /tmp/windows-server-2019 --inventory-output /tmp/windows-server-2019/inventory.yml --track-output /tmp/windows-server-2019/track.yml
[2024-03-01 11:34:13] [INFO] ALLOCATOR: Creating instance at /tmp/windows-server-2019
[2024-03-01 11:34:13] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-03-01 11:34:13] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/windows-server-2019/AWS-04762EB9-685B-4612-9638-0A28C99D1D6C
[2024-03-01 11:34:31] [DEBUG] ALLOCATOR: Renaming temp /tmp/windows-server-2019/AWS-04762EB9-685B-4612-9638-0A28C99D1D6C directory to /tmp/windows-server-2019/i-055e053002c5c135d
[2024-03-01 11:34:31] [INFO] ALLOCATOR: Instance i-055e053002c5c135d created.
[2024-03-01 11:34:32] [INFO] ALLOCATOR: Instance i-055e053002c5c135d started.
[2024-03-01 11:34:32] [INFO] ALLOCATOR: Inventory file generated at /tmp/windows-server-2019/inventory.yml
[2024-03-01 11:34:32] [INFO] ALLOCATOR: Track file generated at /tmp/windows-server-2019/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/windows-server-2019/inventory.yml
ansible_connection: winrm
ansible_host: ec2-44-203-103-26.compute-1.amazonaws.com
ansible_password: 6Qtptwizi39
ansible_port: 3389
ansible_user: Administrator
ansible_winrm_server_cert_validation: ignore
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/windows-server-2019/track.yml
host_identifier: None
identifier: i-055e053002c5c135d
instance_dir: /tmp/windows-server-2019/i-055e053002c5c135d
key_path: /home/cbordon/.ssh/allocation_test
provider: aws
ssh_port: 3389

Screenshot_20240301_113951

c-bordon commented 2 months ago

Windows server 2012 R2

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-server-2012r2-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00" --working-dir /tmp/windows-server-2012 --inventory-output /tmp/windows-server-2012/inventory.yml --track-output /tmp/windows-server-2012/track.yml
[2024-03-01 11:14:23] [INFO] ALLOCATOR: Creating instance at /tmp/windows-server-2012
[2024-03-01 11:14:23] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-03-01 11:14:23] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/windows-server-2012/AWS-ECAD323C-E557-4E5D-841D-AE9AA86A3851
[2024-03-01 11:14:41] [DEBUG] ALLOCATOR: Renaming temp /tmp/windows-server-2012/AWS-ECAD323C-E557-4E5D-841D-AE9AA86A3851 directory to /tmp/windows-server-2012/i-0688eec28c5aaf893
[2024-03-01 11:14:41] [INFO] ALLOCATOR: Instance i-0688eec28c5aaf893 created.
[2024-03-01 11:14:42] [INFO] ALLOCATOR: Instance i-0688eec28c5aaf893 started.
[2024-03-01 11:14:42] [INFO] ALLOCATOR: Inventory file generated at /tmp/windows-server-2012/inventory.yml
[2024-03-01 11:14:42] [INFO] ALLOCATOR: Track file generated at /tmp/windows-server-2012/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/windows-server-2012/inventory.yml
ansible_connection: winrm
ansible_host: ec2-3-238-142-208.compute-1.amazonaws.com
ansible_password: 2llxxbS3q5s
ansible_port: 3389
ansible_user: Administrator
ansible_winrm_server_cert_validation: ignore
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/windows-server-2012/track.yml
host_identifier: None
identifier: i-0688eec28c5aaf893
instance_dir: /tmp/windows-server-2012/i-0688eec28c5aaf893
key_path: /home/cbordon/.ssh/allocation_test
provider: aws
ssh_port: 3389

Screenshot_20240301_112849

c-bordon commented 2 months ago

Windows server 2016

cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ python3 launchers/allocation.py --composite-name windows-server-2016-amd64 --provider aws --size micro --ssh-key ~/.ssh/allocation_test --label-issue https://github.com/wazuh/wazuh-qa/issues/4988 --label-team devops --label-termination-date "2024-02-26 15:00:00" --working-dir /tmp/windows-server-2016 --inventory-output /tmp/windows-server-2016/inventory.yml --track-output /tmp/windows-server-2016/track.yml
[2024-03-01 11:42:13] [INFO] ALLOCATOR: Creating instance at /tmp/windows-server-2016
[2024-03-01 11:42:13] [DEBUG] ALLOCATOR: No config provided. Generating from payload
[2024-03-01 11:42:13] [DEBUG] ALLOCATOR: Creating temp directory: /tmp/windows-server-2016/AWS-B297D912-21EB-425A-BB37-45CBB7C9DA0A
[2024-03-01 11:42:31] [DEBUG] ALLOCATOR: Renaming temp /tmp/windows-server-2016/AWS-B297D912-21EB-425A-BB37-45CBB7C9DA0A directory to /tmp/windows-server-2016/i-04e187ee0d1d6d412
[2024-03-01 11:42:31] [INFO] ALLOCATOR: Instance i-04e187ee0d1d6d412 created.
[2024-03-01 11:42:32] [INFO] ALLOCATOR: Instance i-04e187ee0d1d6d412 started.
[2024-03-01 11:42:32] [INFO] ALLOCATOR: Inventory file generated at /tmp/windows-server-2016/inventory.yml
[2024-03-01 11:42:32] [INFO] ALLOCATOR: Track file generated at /tmp/windows-server-2016/track.yml
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/windows-server-2016/inventory.yml
ansible_connection: winrm
ansible_host: ec2-3-215-73-111.compute-1.amazonaws.com
ansible_password: 4QB8etrs188
ansible_port: 3389
ansible_user: Administrator
ansible_winrm_server_cert_validation: ignore
cbordon@cbordon-MS-7C88:~/Documents/wazuh/repositorios/wazuh-qa/deployability$ cat /tmp/windows-server-2016/track.yml
host_identifier: None
identifier: i-04e187ee0d1d6d412
instance_dir: /tmp/windows-server-2016/i-04e187ee0d1d6d412
key_path: /home/cbordon/.ssh/allocation_test
provider: aws
ssh_port: 3389

Screenshot_20240301_114656

c-bordon commented 2 months ago

Windows 11

For Windows 11 it is necessary to create a new AMI with AWS tools installed. https://github.com/wazuh/wazuh-automation/issues/1582

QU3B1M commented 1 month ago

LGTM!

fcaffieri commented 1 month ago

LGTM