initial installment of vm bin working
authordyle@opensecurity.d03.arc.local
Thu, 23 Jan 2014 16:31:33 +0000
changeset 501f4ba6a6ecf5
parent 49 45903be121b4
child 51 9e8fffdb8f47
initial installment of vm bin working
OpenSecurity/bin/cygwin.py
OpenSecurity/install/initial_vm
OpenSecurity/install/initial_vm.txt
     1.1 --- a/OpenSecurity/bin/cygwin.py	Thu Jan 23 11:18:32 2014 +0000
     1.2 +++ b/OpenSecurity/bin/cygwin.py	Thu Jan 23 16:31:33 2014 +0000
     1.3 @@ -76,7 +76,10 @@
     1.4          command_path = Cygwin.root() + os.sep.join(command[0].split('/'))
     1.5          command = [command_path] + command[1:]
     1.6          
     1.7 -        return subprocess.Popen(command, shell = False, stdin = stdin, stdout = stdout, stderr = stderr)
     1.8 +        try:
     1.9 +            return subprocess.Popen(command, shell = False, stdin = stdin, stdout = stdout, stderr = stderr)
    1.10 +        except:
    1.11 +            sys.stderr.writeln('Failed to execute cygwin command.\n\tcommand="' + command + '"')
    1.12          
    1.13          
    1.14      @staticmethod
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/OpenSecurity/install/initial_vm	Thu Jan 23 16:31:33 2014 +0000
     2.3 @@ -0,0 +1,49 @@
     2.4 +#!/bin/sh
     2.5 +
     2.6 +# ensure environment is ready
     2.7 +echo 'checking environment'
     2.8 +cd '/cygdrive/c/Documents and Settings/'
     2.9 +cd "${USER}"
    2.10 +mkdir 'VirtualBox VMs' &> /dev/null
    2.11 +cd 'VirtualBox VMs'
    2.12 +if [ "$?" != "0" ]; then
    2.13 +    echo "failed to setup user's \"VirtualBox VMs\" folder"
    2.14 +    echo "sorry."
    2.15 +    exit 1
    2.16 +fi
    2.17 +
    2.18 +# get recent initial VM and create disk image
    2.19 +echo 'download initial OpenSecurity VM'
    2.20 +cd "/cygdrive/c/Documents\ and\ Settings/${USER}/VirtualBox\ VMs/"
    2.21 +#wget http://service.x-net.at/opensecurity/OsecVM_initialized.ova
    2.22 +VBoxManage.exe import OsecVM_initialized.ova --vsys 0 --vmname SecurityDVM --unit 12 --disk SecurityDVM.vmdk
    2.23 +
    2.24 +# launch the SecurityVM the first time to let the user do initial updates
    2.25 +VBoxManage.exe startvm SecurityDVM
    2.26 +
    2.27 +cat << EOF
    2.28 +# Start VirtualBox and update the machine
    2.29 +#
    2.30 +# login with
    2.31 +#   user: root
    2.32 +#   pass: osecvm
    2.33 +#
    2.34 +# issue these commands as root
    2.35 +#
    2.36 +#       # apt-get update
    2.37 +#       # apt-get upgrade
    2.38 +#       # apt-get dist-upgrade
    2.39 +#
    2.40 +# then shutdown the machine with
    2.41 +#
    2.42 +#       # shutdown -h now
    2.43 +#
    2.44 +# press a key when done to proceed
    2.45 +EOF
    2.46 +read -n 1 -s
    2.47 +
    2.48 +# Turn the VM disk image immutable and attach it
    2.49 +VBoxManage.exe storageattach SecurityDVM --storagectl SATA --port 0 --medium none
    2.50 +VBoxManage.exe modifyhd SecurityDVM.vmdk settype immutable
    2.51 +VBoxManage.exe storageattach SecurityDVM --storagectl SATA --port 0 --device 0 --type hdd --mtype normal --medium SecurityDVM.vmdk
    2.52 +
     3.1 --- a/OpenSecurity/install/initial_vm.txt	Thu Jan 23 11:18:32 2014 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,30 +0,0 @@
     3.4 -#!/bin/sh
     3.5 -
     3.6 -# this is the target installation folder
     3.7 -#OPENSECURITY_DIR="/cygdrive/c/Program Files/OpenSecurity"
     3.8 -OPENSECURITY_DIR="OpenSecurity"
     3.9 -
    3.10 -# get recent initial VM and create disk image
    3.11 -cd "${OPENSECURITY_DIR}"
    3.12 -wget http://service.x-net.at/opensecurity/OsecVM_initialized.ova
    3.13 -mkdir -p ${OPENSECURITY_DIR}/vm
    3.14 -VBoxManage.exe import OsecVM_initialized.ova --vsys 0 --vmname SecurityDVM --unit 12 --disk vm/SecurityDVM.vmdk
    3.15 -
    3.16 -# Start VirtualBox and update the machine
    3.17 -#
    3.18 -# login with
    3.19 -#   user: root
    3.20 -#   pass: osecvm
    3.21 -#
    3.22 -# issue these commands as root
    3.23 -#
    3.24 -#       # apt-get update
    3.25 -#       # apt-get upgrade
    3.26 -#       # apt-get dist-upgrade
    3.27 -#
    3.28 -
    3.29 -# Turn the VM disk image immutable and attach it
    3.30 -VBoxManage.exe storageattach SecurityDVM --storagectl SATA --port 0 --medium none
    3.31 -VBoxManage.exe modifyhd vm/SecurityDVM.vmdk settype immutable
    3.32 -VBoxManage.exe storageattach SecurityDVM --storagectl SATA --port 0 --device 0 --type hdd --mtype normal --medium vm/SecurityDVM.vmdk
    3.33 -