init
This commit is contained in:
parent
390667707b
commit
156fcba4cf
|
@ -0,0 +1 @@
|
||||||
|
.vagrant/
|
13
README.md
13
README.md
|
@ -1,3 +1,16 @@
|
||||||
# vagrant-blackarch
|
# vagrant-blackarch
|
||||||
|
|
||||||
This is a vagrant setup for using BlackArch as a portable pentest environment.
|
This is a vagrant setup for using BlackArch as a portable pentest environment.
|
||||||
|
|
||||||
|
## Create VM
|
||||||
|
|
||||||
|
```sh
|
||||||
|
./setup.sh
|
||||||
|
```
|
||||||
|
* An RSA key will be created, Vagrant will start creating the VM. Provisioning the VM is done via Ansible's `playbook.yml`.
|
||||||
|
* Reboot after Ansible has provisioned the VM to get the gui to work.
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
* Putting in dotfiles, dwm and everything else is vanilla right now.
|
||||||
|
* Select applications to install
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
# -*- mode: ruby -*-
|
||||||
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
|
# All Vagrant configuration is done below. The "2" in Vagrant.configure
|
||||||
|
# configures the configuration version (we support older styles for
|
||||||
|
# backwards compatibility). Please don't change it unless you know what # you're doing.
|
||||||
|
Vagrant.configure("2") do |config|
|
||||||
|
config.vm.hostname = "archlinux"
|
||||||
|
config.vm.box = "archlinux/archlinux"
|
||||||
|
id_rsa_pub = File.read("./.vagrant/vagrant.key.pub")
|
||||||
|
config.vm.provision "copy ssh public key", type: "shell",
|
||||||
|
inline: "echo \"#{id_rsa_pub}\" >> /home/vagrant/.ssh/authorized_keys"
|
||||||
|
#config.ssh.username = 'vagrant'
|
||||||
|
#config.ssh.password = 'vagrant'
|
||||||
|
config.ssh.forward_agent = true
|
||||||
|
config.ssh.forward_x11 = true
|
||||||
|
config.vm.network :forwarded_port, guest: 22, host: 47111, auto_correct: true
|
||||||
|
#config.ssh.insert_key = true
|
||||||
|
#config.ssh.forward_agent = true
|
||||||
|
|
||||||
|
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
|
||||||
|
config.vm.network "private_network", type: "dhcp", name: "vboxnet0"
|
||||||
|
config.vm.synced_folder "./", "/vagrant_files"
|
||||||
|
|
||||||
|
config.vm.provider "virtualbox" do |vb|
|
||||||
|
# Display the VirtualBox GUI when booting the machine
|
||||||
|
vb.gui = false
|
||||||
|
|
||||||
|
# Customize the amount of memory on the VM:
|
||||||
|
vb.memory = "8192"
|
||||||
|
vb.customize ["modifyvm", :id, "--vram", "256"]
|
||||||
|
end
|
||||||
|
|
||||||
|
config.vm.provision "ansible" do |ansible|
|
||||||
|
ansible.verbose = "v"
|
||||||
|
ansible.raw_arguments = [
|
||||||
|
"--private-key=./.vagrant/vagrant.key"
|
||||||
|
]
|
||||||
|
ansible.playbook = "playbook.yml"
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,80 @@
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# ~/.xinitrc
|
||||||
|
#
|
||||||
|
# Executed by startx (run your window manager from here)
|
||||||
|
|
||||||
|
if [[ -f ~/.extend.xinitrc ]];then
|
||||||
|
. ~/.extend.xinitrc
|
||||||
|
else
|
||||||
|
DEFAULT_SESSION=xfce4-session
|
||||||
|
fi
|
||||||
|
|
||||||
|
userresources=$HOME/.Xresources
|
||||||
|
usermodmap=$HOME/.Xmodmap
|
||||||
|
sysresources=/etc/X11/xinit/.Xresources
|
||||||
|
sysmodmap=/etc/X11/xinit/.Xmodmap
|
||||||
|
|
||||||
|
# merge in defaults and keymaps
|
||||||
|
|
||||||
|
if [ -f $sysresources ]; then
|
||||||
|
xrdb -merge $sysresources
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f $sysmodmap ]; then
|
||||||
|
xmodmap $sysmodmap
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$userresources" ]; then
|
||||||
|
xrdb -merge "$userresources"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$usermodmap" ]; then
|
||||||
|
xmodmap "$usermodmap"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# start some nice programs
|
||||||
|
|
||||||
|
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
|
||||||
|
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
|
||||||
|
[ -x "$f" ] && . "$f"
|
||||||
|
done
|
||||||
|
unset f
|
||||||
|
fi
|
||||||
|
|
||||||
|
get_session(){
|
||||||
|
local dbus_args=(--sh-syntax --exit-with-session)
|
||||||
|
case $1 in
|
||||||
|
awesome) dbus_args+=(awesome) ;;
|
||||||
|
bspwm) dbus_args+=(bspwm-session) ;;
|
||||||
|
budgie) dbus_args+=(budgie-desktop) ;;
|
||||||
|
cinnamon) dbus_args+=(cinnamon-session) ;;
|
||||||
|
deepin) dbus_args+=(startdde) ;;
|
||||||
|
dwm) dbus_args+=(dwm);;
|
||||||
|
enlightenment) dbus_args+=(enlightenment_start) ;;
|
||||||
|
fluxbox) dbus_args+=(startfluxbox) ;;
|
||||||
|
gnome) dbus_args+=(gnome-session) ;;
|
||||||
|
i3|i3wm) dbus_args+=(i3 --shmlog-size 0) ;;
|
||||||
|
jwm) dbus_args+=(jwm) ;;
|
||||||
|
kde) dbus_args+=(startkde) ;;
|
||||||
|
lxde) dbus_args+=(startlxde) ;;
|
||||||
|
lxqt) dbus_args+=(lxqt-session) ;;
|
||||||
|
mate) dbus_args+=(mate-session) ;;
|
||||||
|
xfce) dbus_args+=(xfce4-session) ;;
|
||||||
|
openbox) dbus_args+=(openbox-session) ;;
|
||||||
|
*) dbus_args+=($DEFAULT_SESSION) ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "dbus-launch ${dbus_args[*]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
#slstatus 2>&1 >/dev/null &
|
||||||
|
|
||||||
|
exec $(get_session)
|
||||||
|
|
||||||
|
|
||||||
|
# twm &
|
||||||
|
# xclock -geometry 50x50-1+1 &
|
||||||
|
# xterm -geometry 80x50+494+51 &
|
||||||
|
# xterm -geometry 80x20+494-0 &
|
||||||
|
#exec xterm -geometry 80x66+0+0 -name login
|
|
@ -0,0 +1,7 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Encoding=UTF-8
|
||||||
|
Name=dwm
|
||||||
|
Comment=Dynamic Window Manager
|
||||||
|
Exec=dwm
|
||||||
|
Icon=dwm
|
||||||
|
Type=XSession
|
|
@ -0,0 +1,174 @@
|
||||||
|
---
|
||||||
|
- name: Provision Arch Box
|
||||||
|
hosts: default
|
||||||
|
remote_user: vagrant
|
||||||
|
become: yes
|
||||||
|
become_user: root
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Make Pacman Great Again
|
||||||
|
ansible.builtin.replace:
|
||||||
|
path: /etc/pacman.conf
|
||||||
|
regexp: '#ParallelDownloads = 5'
|
||||||
|
replace: 'ParallelDownloads = 5\nILoveCandy'
|
||||||
|
- name: Make Pacman Colorful
|
||||||
|
ansible.builtin.replace:
|
||||||
|
path: /etc/pacman.conf
|
||||||
|
regexp: '#Color'
|
||||||
|
replace: 'Color'
|
||||||
|
- name: Activating Multilibs
|
||||||
|
ansible.builtin.replace:
|
||||||
|
path: /etc/pacman.conf
|
||||||
|
regexp: '#[multilib]'
|
||||||
|
replace: '[multilib]\nInclude = /etc/pacman.d/mirrorlist\n'
|
||||||
|
- name: Pacman Keys
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: pacman-key --init && pacman-key --populate
|
||||||
|
- name: Update System
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: pacman -Syyu --noconfirm
|
||||||
|
- name: Download Base packages
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: sudo pacman -S --needed base-devel git stow vim --noconfirm
|
||||||
|
|
||||||
|
- name: Loading Blackarch and Yay
|
||||||
|
hosts: default
|
||||||
|
remote_user: vagrant
|
||||||
|
tasks:
|
||||||
|
- name: Download Blackarch
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
curl -O https://blackarch.org/strap.sh && \
|
||||||
|
echo 5ea40d49ecd14c2e024deecf90605426db97ea0c strap.sh | sha1sum -c && \
|
||||||
|
chmod +x ./strap.sh && sudo ./strap.sh && \
|
||||||
|
sudo pacman -Syu --noconfirm
|
||||||
|
args:
|
||||||
|
executable: /bin/bash
|
||||||
|
- name: Loading Multilibs
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: sudo pacman -Syu --noconfirm
|
||||||
|
- name: Loading Blackman
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: sudo pacman -S blackman --noconfirm
|
||||||
|
- name: Install yay
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: if [ ! -d "yay" ] ; then git clone http://aur.archlinux.org/yay.git && cd yay && makepkg -si --noconfirm ; fi
|
||||||
|
|
||||||
|
|
||||||
|
- name: Prepare window manger (dwm)
|
||||||
|
hosts: default
|
||||||
|
remote_user: vagrant
|
||||||
|
tasks:
|
||||||
|
- name: Installing dependencies
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: sudo pacman -S pass coreutils fontconfig freetype2 glibc libx11 libxft libxinerama clipmenu libdrm libepoxy libevdev libfontenc libglvnd libgudev libice libinput libomxil-bellagio libpciaccess libsm libunwind libwacom libxcursor libxcvt libxdamage libxfixes libxfont2 libxkbfile libxmu libxrandr libxshmfence libxt libxxf86vm llvm-libs lm_sensors mesa mtdev pixman vulkan-icd-loader wayland xf86-input-libinput xkeyboard-config xorg-fonts-encodings xorg-server xorg-server-common xorg-setxkbmap xorg-xkbcomp xorg-xrandr xorg-xsetroot paraxor-dwm --noconfirm
|
||||||
|
- name: Prepare vim
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
[[ ! -d ".vim/pack/default/start/gruvbox/.git" ]] && cd .vim/pack/default/start/gruvbox/ && git submodule update --init || exit 0
|
||||||
|
- name: Getting dotfiles
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
[[ ! -d "dotfiles" ]] && git clone https://git.stefan.works/stefan/dotfiles || exit 0
|
||||||
|
- name: Getting dwm
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
[[ ! -d "dwm" ]] && git clone git://git.suckless.org/dwm && [[ -e "~/dwm/config.h" ]] && mv dwm/config.h dwm/config.bkp || exit 0
|
||||||
|
- name: Getting dmenu
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
[[ ! -d "dmenu" ]] && git clone git://git.suckless.org/dmenu || exit 0
|
||||||
|
- name: Getting slstatus
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
[[ ! -d "slstatus" ]] && git clone git://git.suckless.org/slstatus || exit 0
|
||||||
|
- name: Distributing dotfiles
|
||||||
|
ansible.builtin.shell:
|
||||||
|
#cmd: cd dotfiles && stow vim && stow dwm && stow dmenu && stow slstatus && cd ..
|
||||||
|
cmd: cd dotfiles && stow vim && stow dmenu && stow slstatus
|
||||||
|
- name: Make dwm
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: cd dwm && make && sudo make install && cd ..
|
||||||
|
- name: Make dmenu
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: cd dmenu && make && sudo make install && cd ..
|
||||||
|
- name: Make slstatus
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: cd slstatus && make && sudo make install && cd ..
|
||||||
|
- name: Create xinitrc
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
[[ ! -e "~/.xinitrc" ]] && touch ~/.xinitrc || printf "Did not create .xinitrc"
|
||||||
|
- name: Insert dwm into xinitrc
|
||||||
|
lineinfile:
|
||||||
|
path: ~/.xinitrc
|
||||||
|
line: 'exec dwm'
|
||||||
|
insertbefore: EOF
|
||||||
|
|
||||||
|
- name: make ssh x11 possible
|
||||||
|
hosts: default
|
||||||
|
remote_user: vagrant
|
||||||
|
become: yes
|
||||||
|
become_user: root
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: set x11 forwarding
|
||||||
|
ansible.builtin.replace:
|
||||||
|
path: /etc/ssh/sshd_config
|
||||||
|
regexp: '#x11forwarding no'
|
||||||
|
replace: 'x11forwarding yes'
|
||||||
|
- name: install xauth
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: pacman -S xorg-xauth --noconfirm
|
||||||
|
- name: restart ssh daemon
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: systemctl restart sshd
|
||||||
|
|
||||||
|
|
||||||
|
- name: Install lightm as a session manager for dwm
|
||||||
|
hosts: default
|
||||||
|
remote_user: vagrant
|
||||||
|
become: yes
|
||||||
|
become_user: root
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: install lightdm
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: pacman -S lightdm lightdm-gtk-greeter --noconfirm
|
||||||
|
- name: Set gtk-greeter
|
||||||
|
ansible.builtin.replace:
|
||||||
|
path: /etc/lightdm/lightdm.conf
|
||||||
|
regexp: '#greeter-session=greeter-gtk-gnome'
|
||||||
|
replace: 'greeter-session=lightdm-gtk-greeter'
|
||||||
|
- name: Copy .xinitrc
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: includes/.xinitrc
|
||||||
|
dest: /home/vagrant/.xinitrc
|
||||||
|
owner: vagrant
|
||||||
|
group: vagrant
|
||||||
|
mode: '0755'
|
||||||
|
- name: Create xsessions directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /usr/share/xsessions
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
state: directory
|
||||||
|
mode: '0755'
|
||||||
|
- name: Configure dwm for lightdm
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: includes/dwm.desktop
|
||||||
|
dest: /usr/share/xsessions/dwm.desktop
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: '0644'
|
||||||
|
- name: Enable lightdm Service
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: systemctl enable lightdm
|
||||||
|
|
||||||
|
- name: Install Applications
|
||||||
|
hosts: default
|
||||||
|
remote_user: vagrant
|
||||||
|
become: yes
|
||||||
|
become_user: root
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Alacritty
|
||||||
|
ansible.builtin.shell:
|
||||||
|
cmd: pacman -S alacritty --noconfirm
|
||||||
|
# - name: Fonts
|
||||||
|
# ansible.builtin.shell:
|
||||||
|
# cmd: yay -S ttf-meslo-nerd-font-powerlevel10k nerd-font-sans-mono --noconfirm
|
||||||
|
|
Loading…
Reference in New Issue