dev4vater / vater

11 stars 5 forks source link

Generic Packer Template for Kali Linux #128

Open rylagek opened 2 years ago

rylagek commented 2 years ago
rylagek commented 2 years ago

Kali Linux has a fully supported packer template for vagrant here We can use builder chaining (#130) to update it to run on vSphere

rylagek commented 2 years ago

Using smaller resource req'mt and installing Metasploit and Empire on Ubuntu server 20.04

rylagek commented 2 years ago

Metasploit installs easily with

curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && chmod 755 msfinstall && echo no | ./msfinstall && (echo yes; echo no) | ./msfconsole && db_status

Empire installs successfully as long as nim is not used (there is a version mismatch)

git clone --recursive https://github.com/BC-SECURITY/Empire.git && cd Empire && yes "n" | sudo ./setup/install.sh
rylagek commented 2 years ago

Note about subiquity installs: there is currently no supported way to turn off automated unattended upgrades so each build takes about 25 minutes, even before packer provisioning.

In the future, chained builds will be a necessity to avoid a development bottleneck

rylagek commented 2 years ago

Setting static ip is easy with ip a but removing the DHCP setting is not trivial because of netplan in combination with cloud-init Looks like the path of least resistance is to set the static ip in the initial cloud-init

rylagek commented 2 years ago

cloud-init in itself requires a separate configuration source to provide custom networking - for minimum product only adding the needed static ip address

rylagek commented 2 years ago

https://cloudinit.readthedocs.io/en/latest/topics/network-config.html

rylagek commented 2 years ago

cloud-init resets networking on reboot so adding static ip we want at the end of the build process does not have the lasting effect we need

rylagek commented 2 years ago

Band-Aid solution: cron job to run on reboot adding needed static ip crontab -e add line @reboot /path/to/script

rylagek commented 2 years ago

The above solution is interactive. Adding a file to /etc/cron.d/ is a non-interactive solution but must be written as root: sudo su && echo "@reboot ip a add x.x.x.x/xx dev ensXXX" >/etc/cron.d/static

rylagek commented 2 years ago

That solution was overkill and an issue w/ root vs user TTYs prevented it from being scripted. Active solution is to write a user cron job: echo "@reboot sudo ip a add x.x.x.x/xx dev ensXXX" | crontab -

rylagek commented 2 years ago

Final generic product is an ubuntu 20.04 effects platform with a static ip, Empire, and Metasploit

rylagek commented 2 years ago

Effects platform needs route added and folder for scripts

rylagek commented 2 years ago

Also need to turn off dhcp init search to improve reboot time