Training the next generation of purple team hackers
(he/him)
https://maikroservice.com/email
Well done friends, in the next post we shall do the same on multiple machines at the same time 💜
Cant wait to talk to you again!
Well done friends, in the next post we shall do the same on multiple machines at the same time 💜
Cant wait to talk to you again!
with that out of the way we can run the command from earlier:
ansible -i hosts.yml infrastructure -a 'ping 192.168.188.1 -c 1'
with that out of the way we can run the command from earlier:
ansible -i hosts.yml infrastructure -a 'ping 192.168.188.1 -c 1'
First all the machines are collected by a self-defined metagroup - “infrastructure”.
now a list of all the hosts inside this group follows, in this example we will only have one for now - debian
First all the machines are collected by a self-defined metagroup - “infrastructure”.
now a list of all the hosts inside this group follows, in this example we will only have one for now - debian
what is inside the hosts.yml and what is a yml in the first place?
a .yml file is a yaml (Yet Another Markup Language) file
what is inside the hosts.yml and what is a yml in the first place?
a .yml file is a yaml (Yet Another Markup Language) file
you use ansible 💜
like so:
ansible -i hosts.yml infrastructure -a 'ping 192.168.188.1 -c 1'
you use ansible 💜
like so:
ansible -i hosts.yml infrastructure -a 'ping 192.168.188.1 -c 1'
aha - ok that looks like the correct key with the correct username at the end 😌
aha - ok that looks like the correct key with the correct username at the end 😌
can we check if the key is really there?
sure!
but um… this does not look like it is there?
can we check if the key is really there?
sure!
but um… this does not look like it is there?
ssh-copy-id -i <location_of_your_ssh_key> username@controlled-machine
press enter and then you need to enter the password for the controlled-machine user
if all goes well you see something similar to the following image:
ssh-copy-id -i <location_of_your_ssh_key> username@controlled-machine
press enter and then you need to enter the password for the controlled-machine user
if all goes well you see something similar to the following image:
1. you copy the public ssh key to the machine via copy/paste
2. you use ssh-copy-id
We shall use 2. today, because it is freaking cool!
1. you copy the public ssh key to the machine via copy/paste
2. you use ssh-copy-id
We shall use 2. today, because it is freaking cool!
ssh-keygen -b 4096
make sure to enter the correct location and add a passkey if you care about security 🙏
ssh-keygen -b 4096
make sure to enter the correct location and add a passkey if you care about security 🙏
sudo apt-get install openssh-server
sudo apt-get install openssh-server
now you need to identify how you can connect to the controlled machine - e.g. via ssh if it is linux
that means ssh needs to run on the controlled machine - check via:
systemctl status ssh
now you need to identify how you can connect to the controlled machine - e.g. via ssh if it is linux
that means ssh needs to run on the controlled machine - check via:
systemctl status ssh
and then wait until the install is finished ⏳ → ⌛️
and then wait until the install is finished ⏳ → ⌛️
sudo apt-get install ansible
(if your host is debian/ubuntu based)
sudo apt-get install ansible
(if your host is debian/ubuntu based)
you do _NOT_ have to install it on the client systems, only on your host / the controlling node!
Ok great, but how do we start ➡️ 🏁
you do _NOT_ have to install it on the client systems, only on your host / the controlling node!
Ok great, but how do we start ➡️ 🏁
ansible is basically your go to shop 🏪 for running commands on existing machines
it logs in for you, runs commands for you and gives you feedback if it all worked out
ansible is basically your go to shop 🏪 for running commands on existing machines
it logs in for you, runs commands for you and gives you feedback if it all worked out
We shall start with ansible - the ez pz 🍋 patch engine
We shall start with ansible - the ez pz 🍋 patch engine
🤖 ansible
🦾 packer
🧞♀️ terraform
🔐 vault
WAYYYY cooler, right?
RIGHT?
🤖 ansible
🦾 packer
🧞♀️ terraform
🔐 vault
WAYYYY cooler, right?
RIGHT?
🔍 search for all the hostnames,
🤝 gather possible login options
🕵️ find username/password combinations
🤪 go mad because it’s taking too long
OR!
🔍 search for all the hostnames,
🤝 gather possible login options
🕵️ find username/password combinations
🤪 go mad because it’s taking too long
OR!
and some virtual machines + the services running on them need to be updated
What do you do?
and some virtual machines + the services running on them need to be updated
What do you do?