1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/OpenSecurity/bin/create-cert-and-iso.sh Wed Jan 29 14:25:20 2014 +0100
1.3 @@ -0,0 +1,14 @@
1.4 +#!/bin/sh
1.5 +
1.6 +# create a ssh-key pair in the current folder
1.7 +# and create a ISO image with it
1.8 +
1.9 +VM_NAME=$(basename "$(pwd)")
1.10 +echo ${VM_NAME}
1.11 +
1.12 +mkdir .ssh &> /dev/null
1.13 +ssh-keygen -q -t rsa -N "" -C "${VM_NAME}" -f dvm_key &> /dev/null
1.14 +chmod 500 dvm_key
1.15 +mv dvm_key.pub .ssh/authorized_keys
1.16 +genisoimage -J -R -o "${VM_NAME}.iso" .ssh
1.17 +
2.1 --- a/OpenSecurity/bin/cygwin.py Wed Jan 29 14:18:17 2014 +0100
2.2 +++ b/OpenSecurity/bin/cygwin.py Wed Jan 29 14:25:20 2014 +0100
2.3 @@ -67,16 +67,28 @@
2.4 return path_valid[0]
2.5
2.6
2.7 - def execute(self, command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE):
2.8 + def execute(self, command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, window = False):
2.9 """execute a cygwin shell command
2.10
2.11 command is list of arguments like ['/bin/ls', '-al', '-h']
2.12
2.13 a Popen object is returned"""
2.14 - command_path = Cygwin.root() + os.sep.join(command[0].split('/'))
2.15 + command_path = os.sep.join([Cygwin.root()] + command[0].split('/')[1:])
2.16 command = [command_path] + command[1:]
2.17 -
2.18 - return subprocess.Popen(command, shell = False, stdin = stdin, stdout = stdout, stderr = stderr)
2.19 +
2.20 + if not window:
2.21 + # hide any window
2.22 + shadowrun_path = os.path.join(Cygwin.root(), 'bin', 'shadowrun.exe')
2.23 + if os.access(shadowrun_path, os.X_OK):
2.24 + command = [shadowrun_path] + command
2.25 + else:
2.26 + print("EPIC FAIL!")
2.27 +
2.28 + try:
2.29 + print('cygwin: ' + ' '.join(command))
2.30 + return subprocess.Popen(command, shell = False, stdin = stdin, stdout = stdout, stderr = stderr)
2.31 + except:
2.32 + sys.stderr.write('Failed to execute cygwin command.\n\tcommand="' + ' '.join(command) + '"\n')
2.33
2.34
2.35 @staticmethod
3.1 --- a/OpenSecurity/bin/launch.pyw Wed Jan 29 14:18:17 2014 +0100
3.2 +++ b/OpenSecurity/bin/launch.pyw Wed Jan 29 14:25:20 2014 +0100
3.3 @@ -238,7 +238,10 @@
3.4
3.5 # ensure we have our X11 running
3.6 Cygwin.start_X11()
3.7 -
3.8 +
3.9 + sys.exit(0)
3.10 +
3.11 +
3.12 # call the OpenSecurity Admin to launch our progie =)
3.13 # TODO: hard coded PORT
3.14 url = 'http://127.0.0.1:8080/sdvms/' + args.vm + '/application' + args.command
4.1 --- a/OpenSecurity/bin/vmmanager.py Wed Jan 29 14:18:17 2014 +0100
4.2 +++ b/OpenSecurity/bin/vmmanager.py Wed Jan 29 14:25:20 2014 +0100
4.3 @@ -11,10 +11,15 @@
4.4 import re
4.5 import _winreg
4.6 from cygwin import Cygwin
4.7 +from environment import Environment
4.8 import threading
4.9 import time
4.10 import string
4.11
4.12 +import shutil
4.13 +import stat
4.14 +import tempfile
4.15 +
4.16
4.17 DEBUG = True
4.18 class VMManagerException(Exception):
4.19 @@ -515,7 +520,7 @@
4.20 # run command
4.21 #--login
4.22 #cmd = self.cygwin_path+'bash.exe --login -c \"DISPLAY=:0 ssh -v -Y -i \\\"' + machineFolder + '\\' + vm_name + '\\dvm_key\\\" ' + user_name + '@' + address + ' ' + prog + '\"'
4.23 - cmd = self.cygwin_path+'mintty.exe -e /bin/env DISPLAY=:0 /usr/bin/ssh -v -Y -i \"' + machineFolder + '\\' + vm_name + '\\dvm_key\" ' + user_name + '@' + address + ' ' + prog + ''
4.24 + cmd = self.cygwin_path+'mintty.exe -e /bin/env DISPLAY=:0 /usr/bin/ssh -o StrictHostKeyChecking=no -v -Y -i \"' + machineFolder + '\\' + vm_name + '\\dvm_key\" ' + user_name + '@' + address + ' ' + prog + ''
4.25 #cmd = self.cygwin_path+'mintty.exe -e /bin/bash --login -c \"DISPLAY=:0 /usr/bin/ssh -v -Y -i \\\"' + machineFolder + '\\' + vm_name + '\\dvm_key\\\" ' + user_name + '@' + address + ' ' + prog + '\"'
4.26 if DEBUG:
4.27 print('trying to launch: ' + cmd)
4.28 @@ -610,4 +615,4 @@
4.29
4.30 #cmd = "c:\\cygwin64\\bin\\bash.exe --login -c \"/bin/ls\""
4.31 #man.execute(cmd)
4.32 -
4.33 \ No newline at end of file
4.34 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/OpenSecurity/install/initial_vm.bat Wed Jan 29 14:25:20 2014 +0100
5.3 @@ -0,0 +1,58 @@
5.4 +@echo off
5.5 +
5.6 +rem ensure environment is ready
5.7 +
5.8 +rem This gets up VirtualBox VBoxSVC.exe COM Server right
5.9 +rem and thus helps us not to run in any timing problems
5.10 +rem due to a lazy VBox COM Server ... o.O
5.11 +VBoxManage list vms > %TEMP%\VMS.txt
5.12 +del %TEMP%\VMS.txt
5.13 +
5.14 +rem Now, VBox should feel good within the Windows OS space
5.15 +rem switch into the User's VBox setup folders
5.16 +C:
5.17 +cd "C:\Users\%USERNAME%
5.18 +mkdir "VirtualBox VMs"
5.19 +cd "VirtualBox VMs"
5.20 +
5.21 +rem get recent initial VM and create disk image
5.22 +echo "download initial OpenSecurity VM"
5.23 +rem wget http://service.x-net.at/opensecurity/OsecVM_initialized.ova
5.24 +
5.25 +rem I've already downloaded ... this is for convenience --> delete this line
5.26 +rem This is just for testing. Enbale the real "wget http://service...." line above
5.27 +rem to get the real VM image from X-Net
5.28 +copy C:\Users\dyle\Documents\OpenSecurity\setup\OsecVM_initialized.ova .
5.29 +
5.30 +rem import the VM
5.31 +VBoxManage.exe import OsecVM_initialized.ova --vsys 0 --vmname SecurityDVM --unit 12 --disk SecurityDVM\SecurityDVM.vmdk
5.32 +
5.33 +rem launch the SecurityVM the first time to let the user do initial updates
5.34 +VBoxManage.exe startvm SecurityDVM
5.35 +
5.36 +echo # Start VirtualBox and update the machine
5.37 +echo #
5.38 +echo # login with
5.39 +echo # user: root
5.40 +echo # pass: osecvm
5.41 +echo #
5.42 +echo # issue these commands as root
5.43 +echo #
5.44 +echo # # apt-get update
5.45 +echo # # apt-get upgrade
5.46 +echo # # apt-get dist-upgrade
5.47 +echo #
5.48 +echo # then shutdown the machine with
5.49 +echo #
5.50 +echo # # shutdown -h now
5.51 +echo #
5.52 +echo # press a key when done to proceed
5.53 +pause
5.54 +
5.55 +rem Turn the VM disk image immutable and attach it
5.56 +echo sealing disk image ...
5.57 +VBoxManage.exe storageattach SecurityDVM --storagectl SATA --port 0 --medium none
5.58 +VBoxManage.exe modifyhd SecurityDVM\SecurityDVM.vmdk --type immutable
5.59 +VBoxManage.exe storageattach SecurityDVM --storagectl SATA --port 0 --device 0 --type hdd --mtype normal --medium SecurityDVM\SecurityDVM.vmdk
5.60 +echo done. OpenSecurity is ready to serve
5.61 +
6.1 Binary file OpenSecurity/install/shadowrun.exe has changed