Using VMs for Routing VPNs and Tor: Using Remote Host Machines

Discussion in 'privacy technology' started by mirimir, Jan 16, 2012.

Thread Status:
Not open for further replies.
  1. mirimir

    mirimir Registered Member

    Joined:
    Oct 1, 2011
    Posts:
    6,030
    Please note that these instructions apply to remote physical servers, and not to shared servers or VPS, because you'll be running VMs on them.

    Install Oracle VM VirtualBox

    in your remote server via ssh

    Code:
    wget http://download.virtualbox.org/virtualbox/4.1.8/Oracle_VM_VirtualBox_Extension_Pack-4.1.8-75467.vbox-extpack
    sudo apt-get install virtualbox-4.1 [from Ubuntu repository]
    sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.1.8-75467.vbox-extpack
    Create pfSense VM

    in your remote server via ssh

    Code:
    wget http://files.chi.pfsense.org/mirror/downloads/pfSense-2.0.1-RELEASE-i386.iso
    VBoxManage createvm --name "pfS201x86" --ostype FreeBSD --register
    VBoxManage modifyvm "pfS201x86" --memory 128 --acpi off --boot1 dvd --nic1 nat --nic2 intnet
    VBoxManage storagectl "pfS201x86" --name "IDE Controller" --add ide --controller PIIX4
    VBoxManage storageattach "pfS201x86" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium "pfS201x86.vdi"
    VBoxManage storageattach "pfS201x86" --storagectl "IDE Controller" --port 0 --device 1 --type dvddrive --medium /home/your-host-machine-username/pfSense-2.0.1-RELEASE-i386.iso
    VBoxManage setproperty vrdeauthlibrary "VBoxAuthSimple"
    VBoxManage modifyvm "pfS201x86" --vrdeauthtype external
    VBoxManage internalcommands passwordhash "your-host-machine-password"
    VBoxManage setextradata "pfS201x86" "VBoxAuthSimple/users/your-host-machine-username" hash-of-your-host-machine-password-from-VBoxManage
    VBoxHeadless --startvm "pfS201x86" --vrdeproperty TCP/Ports=3399 &
    in local terminal

    Code:
    rdesktop -a 16 -N -u your-host-machine-username -p your-host-machine-password W.X.Y.Z:3399 &
    in rdesktop window to pfSense VM

    Code:
    install pfSense, setting LAN as em0 and WAN as em1
    boot into pfSense
    halt pfSense
    in your remote server via ssh

    Code:
    VBoxManage storageattach "pfS201x86" --storagectl "IDE Controller" --port 0 --device 1 --type dvddrive --medium emptydrive
    VBoxHeadless --startvm "pfS201x86" --vrdeproperty TCP/Ports=3399 &
    in local terminal

    Code:
    rdesktop -a 16 -N -u your-host-machine-username -p your-host-machine-password W.X.Y.Z:3399 &
    in rdesktop window to pfSense VM

    Code:
    verify that pfSense boots normally
    Create Ubuntu VM for managing pfSense

    in your remote server via ssh

    Code:
    VBoxManage createvm --name "U10043Sx86" --ostype Ubuntu --register
    VBoxManage modifyvm "U10043Sx86" --memory 128 --vram 32 --acpi off --boot1 dvd --nic1 nat
    VBoxManage storagectl "U10043Sx86" --name "IDE Controller" --add ide --controller PIIX4
    VBoxManage storageattach "U10043Sx86" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium "U10043Sx86.vdi"
    VBoxManage storageattach "U10043Sx86" --storagectl "IDE Controller" --port 0 --device 1 --type dvddrive --medium /home/your-host-machine-username/ubuntu-10.04.3-server-i386.iso
    [VBoxManage setproperty vrdeauthlibrary "VBoxAuthSimple"] (already did creating pfSense VM)
    VBoxManage modifyvm "U10043Sx86" --vrdeauthtype external
    [VBoxManage internalcommands passwordhash "your-host-machine-password"] (already did creating pfSense VM)
    VBoxManage setextradata "U10043Sx86" "VBoxAuthSimple/users/your-host-machine-username" hash-of-your-host-machine-password-from-VBoxManage
    VBoxHeadless --startvm "U10043Sx86" --vrdeproperty TCP/Ports=3389 &
    in local terminal

    Code:
    rdesktop -a 16 -N -u your-host-machine-username -p your-host-machine-password W.X.Y.Z:3389 &
    in rdesktop window to Ubuntu VM

    Code:
    install Ubuntu
    boot into Ubuntu
    sudo shutdown -P now
    in your remote server via ssh

    Code:
    VBoxManage storageattach "U10043Sx86" --storagectl "IDE Controller" --port 0 --device 1 --type dvddrive --medium emptydrive
    VBoxHeadless --startvm "U10043Sx86" --vrdeproperty TCP/Ports=3389 &
    in local terminal

    Code:
    rdesktop -a 16 -N -u your-host-machine-username -p your-host-machine-password W.X.Y.Z:3389 &
    in rdesktop window to Ubuntu VM

    Code:
    verify that Ubuntu boots normally
    sudo shutdown -P now
    in your remote server via ssh

    Code:
    wget http://download.virtualbox.org/virtualbox/4.1.8/VBoxGuestAdditions_4.1.8.iso
    VBoxManage storageattach "U10043Sx86" --storagectl "IDE Controller" --port 0 --device 1 --type dvddrive --medium /home/your-host-machine-username/VBoxGuestAdditions_4.1.8.iso
    VBoxHeadless --startvm "U10043Sx86" --vrdeproperty TCP/Ports=3389 &
    in local terminal

    Code:
    rdesktop -a 16 -N -u your-host-machine-username -p your-host-machine-password W.X.Y.Z:3389 &
    in rdesktop window to Ubuntu VM

    Code:
    sudo mkdir /media/dvdrive
    sudo mount /dev/dvd /media/dvdrive
    sudo sh ./VBoxLinuxAdditions.run
    sudo shutdown -P now
    in your remote server via ssh

    Code:
    VBoxManage storageattach "U10043Sx86" --storagectl "IDE Controller" --port 0 --device 1 --type dvddrive --medium emptydrive
    VBoxManage modifyvm "U10043Sx86" --nic1 intnet
    VBoxHeadless --startvm "pfS201x86" --vrdeproperty TCP/Ports=3399 & [unless it's still running]
    VBoxHeadless --startvm "U10043Sx86" --vrdeproperty TCP/Ports=3389 &
    in local terminal

    Code:
    rdesktop -a 16 -N -u your-host-machine-username -p your-host-machine-password W.X.Y.Z:3399 &
    rdesktop -a 16 -N -u your-host-machine-username -p your-host-machine-password W.X.Y.Z:3389 &
    in rdesktop window to Ubuntu VM

    Code:
    sudo apt-get install xorg fluxbox fluxconf firefox
    sudo shutdown -r now
    
    startx
    start Firefox
    configure pfSense and OpenVPN client as previously described via webconfigurator
     
    Last edited: Jan 19, 2012
Loading...
Thread Status:
Not open for further replies.