mightyroot

FreeBSD phpVirtualBox add VNC

Feb 2nd, 2013
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 8.10 KB | None | 0 0
  1. virtualbox-ose-4.2.6
  2. phpvirtualbox-4.2.4
  3.  
  4. ##install from ports
  5. # cd /usr/ports/emulators/virtualbox-ose-additions/
  6. # cd /usr/ports/emulators/virtualbox-ose-kmod/
  7. # cd /usr/ports/emulators/virtualbox-ose/
  8.  
  9. # cd /usr/local/www/phpvirtualbox/
  10. # make install
  11.  
  12. ##configure
  13. # kldload vboxdrv
  14. # echo 'vboxdrv_load="YES"' >> /boot/loader.conf
  15. # echo 'vboxnet_enable="YES"' >> /etc/rc.conf
  16. # echo 'vboxguest_enable="YES"' >> /etc/rc.conf
  17. # echo 'vboxservice_enable="YES"' >> /etc/rc.conf
  18. # echo 'vboxservice_flags="--disable-timesync"' >> /etc/rc.conf
  19. # echo 'vboxheadless_enable="YES"' >> /etc/rc.conf
  20. # echo 'vboxwebsrv_enable="YES"' >> /etc/rc.conf
  21.  
  22. # adduser pvbuser
  23. # pw groupadd vboxusers
  24. # pw groupmod vboxusers -m pvbuser
  25. # mkdir /home/pvbuser
  26. # chown -R pvbuser:vboxusers /home/pvbuser
  27.  
  28. #+++ conf Apache22...
  29.  
  30.  
  31.  
  32. #------------------{Patch phpvirtbox to enable VNC pass configuration}---------------
  33. #VBoxManage modifyvm c326c1d2-6c32-4291-a869-365f89d3cfd6 --vrdemulticon on --vrdeport 9000 --vrdeaddress 10.0.2.55 --vrdeauthtype external --vrdeproperty VNCPassword=1234
  34.  
  35. diff -rwubN phpvirtualbox.bak/phpvirtualbox/lib/vboxconnector.php phpvirtualbox/lib/vboxconnector.php
  36. --- phpvirtualbox.bak/phpvirtualbox/lib/vboxconnector.php   2012-03-16 15:20:17.000000000 -0400
  37. +++ phpvirtualbox/lib/vboxconnector.php 2012-04-04 18:06:23.417216274 -0400
  38. @@ -865,6 +865,7 @@
  39.             if($m->VRDEServer && $this->vbox->systemProperties->defaultVRDEExtPack) {
  40.                 $m->VRDEServer->enabled = intval($args['VRDEServer']['enabled']);
  41.                 $m->VRDEServer->setVRDEProperty('TCP/Ports',$args['VRDEServer']['ports']);
  42. +               $m->VRDEServer->setVRDEProperty('VNCPassword',$args['VRDEServer']['vncPassword'] ? $args['VRDEServer']['vncPassword'] : null);
  43.                 $m->VRDEServer->authType = ($args['VRDEServer']['authType'] ? $args['VRDEServer']['authType'] : null);
  44.                 $m->VRDEServer->authTimeout = intval($args['VRDEServer']['authTimeout']);
  45.             }
  46. @@ -1169,6 +1170,7 @@
  47.                 $m->VRDEServer->setVRDEProperty('TCP/Ports',$args['VRDEServer']['ports']);
  48.                 if(@$this->settings->enableAdvancedConfig)
  49.                     $m->VRDEServer->setVRDEProperty('TCP/Address',$args['VRDEServer']['netAddress']);
  50. +               $m->VRDEServer->setVRDEProperty('VNCPassword',$args['VRDEServer']['vncPassword'] ? $args['VRDEServer']['vncPassword'] : null);
  51.                 $m->VRDEServer->authType = ($args['VRDEServer']['authType'] ? $args['VRDEServer']['authType'] : null);
  52.                 $m->VRDEServer->authTimeout = intval($args['VRDEServer']['authTimeout']);
  53.                 $m->VRDEServer->allowMultiConnection = intval($args['VRDEServer']['allowMultiConnection']);
  54. @@ -3441,6 +3443,7 @@
  55.                 'enabled' => $m->VRDEServer->enabled,
  56.                 'ports' => $m->VRDEServer->getVRDEProperty('TCP/Ports'),
  57.                 'netAddress' => $m->VRDEServer->getVRDEProperty('TCP/Address'),
  58. +               'vncPassword' => $m->VRDEServer->getVRDEProperty('VNCPassword'),
  59.                 'authType' => $m->VRDEServer->authType->__toString(),
  60.                 'authTimeout' => $m->VRDEServer->authTimeout,
  61.                 'allowMultiConnection' => intval($m->VRDEServer->allowMultiConnection),
  62. diff -rwubN phpvirtualbox.bak/phpvirtualbox/panes/settingsDisplay.html phpvirtualbox/panes/settingsDisplay.html
  63. --- phpvirtualbox.bak/phpvirtualbox/panes/settingsDisplay.html  2012-03-16 15:20:17.000000000 -0400
  64. +++ phpvirtualbox/panes/settingsDisplay.html    2012-04-04 18:04:29.358798403 -0400
  65. @@ -91,7 +91,11 @@
  66.         <th><span class='translate'>Net Address:</span></th>
  67.         <td><input type='text' class='vboxText' style='width: 100%' name='vboxSettingsDisplayRDPAddr' /></td>
  68.     </tr>  
  69. -   <tr class='vboxRunningEnabled'>
  70. +   <tr class="vboxVNCEnabled">
  71. +       <th><span class='translate'>VNC Password:</span></th>
  72. +       <td colspan='2'><input type='text' class='vboxText' name='vboxSettingsDisplayVNCPassword' /></td>
  73. +   </tr>
  74. +   <tr class='vboxRunningEnabled vboxRDPEnabled'>
  75.         <th><span class='translate'>Authentication Method:</span></th>
  76.         <td>
  77.               <select name='vboxSettingsDisplayRDPAuth' id='vboxSettingsDisplayRDPAuthID' style='width: 100%'>
  78. @@ -101,11 +105,11 @@
  79.               </select>
  80.            </td>
  81.     </tr>
  82. -   <tr class='vboxRunningEnabled'>
  83. +   <tr class='vboxRunningEnabled vboxRDPEnabled'>
  84.         <th><span class='translate'>Authentication Timeout:</span></th>
  85.         <td><input type='text' class='vboxText' style='width: 100%' name='vboxSettingsDisplayRDPAuthTimeout' /></td>
  86.     </tr>
  87. -   <tr>
  88. +   <tr class='vboxRDPEnabled'>
  89.         <th><span class='translate'>Extended Features:</span></th>
  90.         <td><label><input type='checkbox' class='vboxCheckbox' name='vboxSettingsDisplayRDPMulti' /> <span class='translate vboxEnablerListen'>Allow Multiple Connections</span></label></td>
  91.     </tr>  
  92. @@ -143,22 +147,29 @@
  93.  
  94.    
  95.  } else {
  96. +   if ($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack == "VBoxVRDP") {
  97. +       $('.vboxVNCEnabled').remove();
  98. +       document.forms['frmVboxSettings'].vboxSettingsDisplayRDPAuth.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authType;
  99. +       document.forms['frmVboxSettings'].vboxSettingsDisplayRDPAuthTimeout.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authTimeout;
  100. +
  101. +       if(($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.allowMultiConnection)) {
  102. +           document.forms['frmVboxSettings'].vboxSettingsDisplayRDPMulti.checked = true;
  103. +       }
  104. +   } else {
  105. +       document.forms['frmVboxSettings'].vboxSettingsDisplayVNCPassword.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.vncPassword;
  106. +       $('.vboxRDPEnabled').remove();
  107. +   }
  108.    
  109.     document.forms['frmVboxSettings'].vboxSettingsDisplayRDPPort.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.ports;
  110.     if(!document.forms['frmVboxSettings'].vboxSettingsDisplayRDPPort.value)
  111.         document.forms['frmVboxSettings'].vboxSettingsDisplayRDPPort.value = '3389-4000';
  112. -   document.forms['frmVboxSettings'].vboxSettingsDisplayRDPAuth.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authType;
  113. -   document.forms['frmVboxSettings'].vboxSettingsDisplayRDPAuthTimeout.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authTimeout;
  114. +
  115.     document.forms['frmVboxSettings'].vboxSettingsDisplayRDPAddr.value = $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.netAddress;
  116.    
  117.     if(($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.enabled)) {
  118.         document.forms['frmVboxSettings'].vboxSettingsDisplayRDPEnabled.checked = true;
  119.     }
  120.  
  121. -   if(($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.allowMultiConnection)) {
  122. -       document.forms['frmVboxSettings'].vboxSettingsDisplayRDPMulti.checked = true;
  123. -   }
  124. -  
  125.     if(!$('#vboxIndex').data('vboxConfig').enableAdvancedConfig)
  126.         $('#vboxSettingsDisplayRDPAddrRow').css('display','none');
  127.  }
  128. @@ -191,10 +202,15 @@
  129.     if($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer && $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack) {
  130.         $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.ports = document.forms['frmVboxSettings'].vboxSettingsDisplayRDPPort.value;
  131.         $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.netAddress = document.forms['frmVboxSettings'].vboxSettingsDisplayRDPAddr.value;
  132. +       $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.enabled = (document.forms['frmVboxSettings'].vboxSettingsDisplayRDPEnabled.checked ? 1 : 0);
  133. +
  134. +       if ($('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.VRDEExtPack == "VBoxVRDP") {
  135.         $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authType = document.forms['frmVboxSettings'].vboxSettingsDisplayRDPAuth.value;
  136.         $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.authTimeout = document.forms['frmVboxSettings'].vboxSettingsDisplayRDPAuthTimeout.value;
  137. -       $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.enabled = (document.forms['frmVboxSettings'].vboxSettingsDisplayRDPEnabled.checked ? 1 : 0);
  138.         $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.allowMultiConnection = (document.forms['frmVboxSettings'].vboxSettingsDisplayRDPMulti.checked ? 1 : 0);
  139. +       } else {
  140. +           $('#vboxSettingsDialog').data('vboxMachineData').VRDEServer.vncPassword = document.forms['frmVboxSettings'].vboxSettingsDisplayVNCPassword.value;
  141. +       }
  142.     }
  143.  });
Add Comment
Please, Sign In to add comment