# HG changeset patch # User mb # Date 1391001920 -3600 # Node ID 42238cd74afe13fb7145197142424146c722d493 # Parent 59f1d824a07033b2172e2fdb515141d436431cee# Parent 01839f13cef3f1d41013948b461fbe88663730c6 merge - verify unaccepted changes diff -r 59f1d824a070 -r 42238cd74afe OpenSecurity/bin/create-cert-and-iso.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OpenSecurity/bin/create-cert-and-iso.sh Wed Jan 29 14:25:20 2014 +0100 @@ -0,0 +1,14 @@ +#!/bin/sh + +# create a ssh-key pair in the current folder +# and create a ISO image with it + +VM_NAME=$(basename "$(pwd)") +echo ${VM_NAME} + +mkdir .ssh &> /dev/null +ssh-keygen -q -t rsa -N "" -C "${VM_NAME}" -f dvm_key &> /dev/null +chmod 500 dvm_key +mv dvm_key.pub .ssh/authorized_keys +genisoimage -J -R -o "${VM_NAME}.iso" .ssh + diff -r 59f1d824a070 -r 42238cd74afe OpenSecurity/bin/cygwin.py --- a/OpenSecurity/bin/cygwin.py Wed Jan 29 14:18:17 2014 +0100 +++ b/OpenSecurity/bin/cygwin.py Wed Jan 29 14:25:20 2014 +0100 @@ -67,16 +67,28 @@ return path_valid[0] - def execute(self, command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE): + def execute(self, command, stdin = subprocess.PIPE, stdout = subprocess.PIPE, stderr = subprocess.PIPE, window = False): """execute a cygwin shell command command is list of arguments like ['/bin/ls', '-al', '-h'] a Popen object is returned""" - command_path = Cygwin.root() + os.sep.join(command[0].split('/')) + command_path = os.sep.join([Cygwin.root()] + command[0].split('/')[1:]) command = [command_path] + command[1:] - - return subprocess.Popen(command, shell = False, stdin = stdin, stdout = stdout, stderr = stderr) + + if not window: + # hide any window + shadowrun_path = os.path.join(Cygwin.root(), 'bin', 'shadowrun.exe') + if os.access(shadowrun_path, os.X_OK): + command = [shadowrun_path] + command + else: + print("EPIC FAIL!") + + try: + print('cygwin: ' + ' '.join(command)) + return subprocess.Popen(command, shell = False, stdin = stdin, stdout = stdout, stderr = stderr) + except: + sys.stderr.write('Failed to execute cygwin command.\n\tcommand="' + ' '.join(command) + '"\n') @staticmethod diff -r 59f1d824a070 -r 42238cd74afe OpenSecurity/bin/launch.pyw --- a/OpenSecurity/bin/launch.pyw Wed Jan 29 14:18:17 2014 +0100 +++ b/OpenSecurity/bin/launch.pyw Wed Jan 29 14:25:20 2014 +0100 @@ -238,7 +238,10 @@ # ensure we have our X11 running Cygwin.start_X11() - + + sys.exit(0) + + # call the OpenSecurity Admin to launch our progie =) # TODO: hard coded PORT url = 'http://127.0.0.1:8080/sdvms/' + args.vm + '/application' + args.command diff -r 59f1d824a070 -r 42238cd74afe OpenSecurity/bin/vmmanager.py --- a/OpenSecurity/bin/vmmanager.py Wed Jan 29 14:18:17 2014 +0100 +++ b/OpenSecurity/bin/vmmanager.py Wed Jan 29 14:25:20 2014 +0100 @@ -11,10 +11,15 @@ import re import _winreg from cygwin import Cygwin +from environment import Environment import threading import time import string +import shutil +import stat +import tempfile + DEBUG = True class VMManagerException(Exception): @@ -515,7 +520,7 @@ # run command #--login #cmd = self.cygwin_path+'bash.exe --login -c \"DISPLAY=:0 ssh -v -Y -i \\\"' + machineFolder + '\\' + vm_name + '\\dvm_key\\\" ' + user_name + '@' + address + ' ' + prog + '\"' - 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 + '' + 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 + '' #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 + '\"' if DEBUG: print('trying to launch: ' + cmd) @@ -610,4 +615,4 @@ #cmd = "c:\\cygwin64\\bin\\bash.exe --login -c \"/bin/ls\"" #man.execute(cmd) - \ No newline at end of file + diff -r 59f1d824a070 -r 42238cd74afe OpenSecurity/install/initial_vm.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OpenSecurity/install/initial_vm.bat Wed Jan 29 14:25:20 2014 +0100 @@ -0,0 +1,58 @@ +@echo off + +rem ensure environment is ready + +rem This gets up VirtualBox VBoxSVC.exe COM Server right +rem and thus helps us not to run in any timing problems +rem due to a lazy VBox COM Server ... o.O +VBoxManage list vms > %TEMP%\VMS.txt +del %TEMP%\VMS.txt + +rem Now, VBox should feel good within the Windows OS space +rem switch into the User's VBox setup folders +C: +cd "C:\Users\%USERNAME% +mkdir "VirtualBox VMs" +cd "VirtualBox VMs" + +rem get recent initial VM and create disk image +echo "download initial OpenSecurity VM" +rem wget http://service.x-net.at/opensecurity/OsecVM_initialized.ova + +rem I've already downloaded ... this is for convenience --> delete this line +rem This is just for testing. Enbale the real "wget http://service...." line above +rem to get the real VM image from X-Net +copy C:\Users\dyle\Documents\OpenSecurity\setup\OsecVM_initialized.ova . + +rem import the VM +VBoxManage.exe import OsecVM_initialized.ova --vsys 0 --vmname SecurityDVM --unit 12 --disk SecurityDVM\SecurityDVM.vmdk + +rem launch the SecurityVM the first time to let the user do initial updates +VBoxManage.exe startvm SecurityDVM + +echo # Start VirtualBox and update the machine +echo # +echo # login with +echo # user: root +echo # pass: osecvm +echo # +echo # issue these commands as root +echo # +echo # # apt-get update +echo # # apt-get upgrade +echo # # apt-get dist-upgrade +echo # +echo # then shutdown the machine with +echo # +echo # # shutdown -h now +echo # +echo # press a key when done to proceed +pause + +rem Turn the VM disk image immutable and attach it +echo sealing disk image ... +VBoxManage.exe storageattach SecurityDVM --storagectl SATA --port 0 --medium none +VBoxManage.exe modifyhd SecurityDVM\SecurityDVM.vmdk --type immutable +VBoxManage.exe storageattach SecurityDVM --storagectl SATA --port 0 --device 0 --type hdd --mtype normal --medium SecurityDVM\SecurityDVM.vmdk +echo done. OpenSecurity is ready to serve + diff -r 59f1d824a070 -r 42238cd74afe OpenSecurity/install/shadowrun.exe Binary file OpenSecurity/install/shadowrun.exe has changed