finalize rdp merge, bump guacd, tweak errors/docs

Adds an error message in case that the VirtualBox Extension Pack isn't
installed as well as slightly updating the Guacamole installation docs
to also include a mention about the Extension Pack (this can certainly
be improved quite a bit!)
This commit is contained in:
Jurriaan Bremer
2018-04-21 11:04:37 +02:00
parent aa701e0030
commit 98466d47fc
7 changed files with 49 additions and 36 deletions
+2 -2
View File
@@ -23,8 +23,8 @@ before_install:
sudo apt-get install libfreerdp-dev libjpeg-turbo8-dev
# Install guacd.
wget https://www.apache.org/dist/guacamole/0.9.13-incubating/source/guacamole-server-0.9.13-incubating.tar.gz
tar xvf guacamole-server-0.9.13-incubating.tar.gz && cd guacamole-server-0.9.13-incubating
wget https://www.apache.org/dist/guacamole/0.9.14/source/guacamole-server-0.9.14.tar.gz
tar xvf guacamole-server-0.9.14.tar.gz && cd guacamole-server-0.9.14
./configure --with-init-dir=/etc/init.d && make && sudo make install && sudo ldconfig && cd ../
sudo mysql -e "CREATE USER cuckoo@localhost IDENTIFIED BY 'cuckoo'"
+7 -4
View File
@@ -434,7 +434,12 @@ class VirtualBox(Machinery):
def get_remote_control_params(self, label):
port = int(self.vminfo(label, "vrdeport"))
log.info("RDP interface running on port %d" % port)
if port < 0:
log.error(
"The VirtualBox Extension Pack hasn't been installed or "
"VirtualBox hasn't been restarted since installation. "
"Without the Extension Pack, Remote Control is disabled!"
)
# TODO The Cuckoo Web Interface may be running at a different host
# than the actual Cuckoo daemon (and as such, the VMs).
@@ -445,7 +450,7 @@ class VirtualBox(Machinery):
}
def _set_vrde_ports(self, label, ports):
if not re.compile('^[0-9\-]+$').match(ports):
if not re.match("^[0-9\\-]+$", ports):
log.error("Refusing to set illegal port range for VRDE")
return False
@@ -461,7 +466,6 @@ class VirtualBox(Machinery):
"Successfully set remote control ports for virtual machine "
"with label %s: %s" % (label, ports)
)
return proc
# TODO Optimize this method away simply by invoking "vboxmanage modifyvm"
@@ -476,5 +480,4 @@ class VirtualBox(Machinery):
close_fds=True
)
_, _ = proc.communicate()
return proc
@@ -5,7 +5,6 @@
import base64
import logging
import threading
import os
import socket
import uuid
@@ -19,8 +18,12 @@ from cuckoo.reporting.mongodb import MongoDB
from cuckoo.misc import cwd
from cuckoo.web.utils import csrf_exempt, json_error_response, api_post
# TODO Yes, this is far from optimal. In the future we should find a better
# way to get results from the Cuckoo Web Interface to the analysis report (or
# simply disable this functionality altogether).
mdb = MongoDB()
mdb.init_once()
db = Database()
log = logging.getLogger(__name__)
@@ -106,13 +109,10 @@ class ControlApi(object):
except ValueError:
return json_error_response("invalid format")
scr_dir = os.path.join(
cwd(), "storage", "analyses",
"%d" % int(task_id), "shots",
shot_path = cwd(
"shots", "remotecontrol_%d.png" % int(sid),
analysis=int(task_id)
)
shot_file = "remotecontrol_%d.png" % int(sid)
shot_path = os.path.join(scr_dir, shot_file)
open(shot_path, "wb").write(f)
shot_blob = {}
@@ -10,18 +10,21 @@ from cuckoo.web.utils import render_template
db = Database()
class AnalysisControlRoutes:
class AnalysisControlRoutes(object):
@staticmethod
def player(request, task_id):
task = db.view_task(task_id)
if not task:
raise Http404("task not found")
raise Http404("Task not found!")
if not config("cuckoo:remotecontrol:enabled"):
raise Http404("remote control is not enabled")
raise Http404(
"Remote control is not enabled in the configuration! "
"Please check our documentation on configuring Guacamole."
)
if task.options.get("remotecontrol") != "yes":
raise Http404("remote control was not enabled for this task")
raise Http404("Remote control was not enabled for this task.")
if task.status == "reported":
return HttpResponseRedirect("/analysis/%d/summary" % int(task_id))
@@ -29,8 +32,5 @@ class AnalysisControlRoutes:
if task.status not in ("running", "completed"):
raise Http404("task is not running")
data = {
"task": task
}
request.extra_scripts = ['guac.js']
return render_template(request, "rdp/index.html", **data)
request.extra_scripts = ["guac.js"]
return render_template(request, "rdp/index.html", task=task)
@@ -17,7 +17,7 @@
<button data-hotkey="Q" name="close"><i class="fa fa-power-off"></i></button> -->
</nav>
<div class="rdp-credits">
<a href="https://guacamole.incubator.apache.org/" target="_blank" title="Cuckoo Ripple is powered by the Guacamole project.">
<a href="https://guacamole.apache.org/" target="_blank" title="Cuckoo Control is powered by the Guacamole project.">
<img src="{% static 'graphic/guacamole.png' %}" alt="Guacamole" />
</a>
</div>
+7 -2
View File
@@ -1,4 +1,4 @@
# Copyright (C) 2016-2017 Cuckoo Foundation.
# Copyright (C) 2016-2018 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
@@ -13,10 +13,14 @@ from cuckoo.core.feedback import CuckooFeedback
log = logging.getLogger(__name__)
def handler404(request):
message = getattr(
request, "exception",
"Sorry, but the page you are looking for was not found."
)
response = render_to_response(
"errors/error.html", {
"code": 404,
"error": "Sorry, but the page you are looking for was not found."
"error": message,
}, context_instance=RequestContext(request)
)
response.status_code = 404
@@ -34,6 +38,7 @@ def handler500(request):
class ExceptionMiddleware(object):
def process_exception(self, request, exception):
request.exception = exception
try:
feedback = CuckooFeedback()
feedback.send_exception(exception, request)
+16 -11
View File
@@ -189,7 +189,7 @@ Installing guacd
================
``guacd`` is an optional service that provides the translation layer for RDP,
VNC and SSH for the remote control functionality in the Cuckoo web interface.
VNC, and SSH for the remote control functionality in the Cuckoo web interface.
Without it, remote control won't work. Versions 0.9.9 and up will work, but we
recommend installing the latest version. On an Ubuntu 17.04 machine the
@@ -201,18 +201,23 @@ If you only want RDP support you can skip the installation of the
``libguac-client-vnc0`` and ``libguac-client-ssh0`` packages.
If you are using an older distribution or you just want to use the latest
version, the following will build the latest version (``0.9.13-incubator``)
from source::
version (our recommendation), the following will build the latest version
(``0.9.14``) from source::
$ sudo apt -y install libcairo2-dev libjpeg-turbo8-dev libpng12-dev libossp-uuid-dev libfreerdp-dev
$ mkdir /tmp/guac-build; cd /tmp/guac-build
$ wget https://www.apache.org/dist/guacamole/0.9.13-incubating/source/guacamole-server-0.9.13-incubating.tar.gz
$ tar xvf guacamole-server-0.9.13-incubating.tar.gz && cd guacamole-server-0.9.13-incubating
$ mkdir /tmp/guac-build && cd /tmp/guac-build
$ wget https://www.apache.org/dist/guacamole/0.9.14/source/guacamole-server-0.9.14.tar.gz
$ tar xvf guacamole-server-0.9.14.tar.gz && cd guacamole-server-0.9.14
$ ./configure --with-init-dir=/etc/init.d
$ make && sudo make install
$ make && sudo make install && cd ..
$ sudo ldconfig
$ sudo systemctl enable guacd
$ sudo /etc/init.d/guacd start
When installing from source, make sure you don't have another version of any of
the ``libguac-`` libraries installed from your package manager or you might
experience issues due to incompatibilities which can crash guacd.
When installing from source, make sure you don't have another version of any
of the ``libguac-`` libraries installed from your package manager or you might
experience issues due to incompatibilities which can crash guacd.
Note that the `VirtualBox Extension Pack`_ must also be installed to take
advantage of the Cuckoo Control functionality exposed by Guacamole.
.. _VirtualBox Extension Pack: https://www.virtualbox.org/wiki/Downloads