Contents
Why?
While these containers were initially designed to support the Burp Suite container, they do not depend on the Burp container. In other words, the VNC containers can be used generically to provide an auxiliary VNC service to any other container.
Here are some advantages provided by their design:
- No need to install a VNC client on your local machine.
- Password-protected connection, with one password for full remote control, and another for viewing only.
- Default TLS with self-signed certificates.
- Custom certificates can be configured through Docker volumes and/or the SSH container.
- No
root
access required. - Configurable viewing resolution.
- A single
novnc_client
container can be used to connect to multiplenovnc_server
containers.
While connections to novnc_server
are password-protected, connections to novnc_client
are not. Without additional security measures, anyone can use the novnc_client
instance to connect to other, unrelated VNC servers.
noVNC client
dockerfile
The following is based on this dockerfile version.
httpd
container:
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
- Copy
entrypoint.sh
and noVNC’s files to the container. - Expose port 443 and set
entrypoint.sh
to execute when the container runs.
entrypoint.sh
The following is based on this entrypoint.sh version.
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
|
Custom certificates can be pre-loaded through a Docker volume mounted on /root/share
, or through an active SSH container before running this container.
$HOME
is /root
in this case, the container still runs as an unprivileged user, daemon
, and so we can still restrict privileges, then point Apache to the certificates:
|
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
|
|
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
Building and running
You can find interactive build and execution scripts for the Burp Suite and its auxiliary containers at github.com/elespike/burp_containers!
To build the container, simply:
- Ensure the current directory is where the
dockerfile
resides - Execute
sudo docker build -t novnc_client:latest .
Note the trailing .
, which just represents the current directory.
-t novnc_client:latest
tags the build so we can reference it when running the container, as outlined below.
sudo docker run -d -it --rm |
Runs the container as a daemon (background process), with an interactive TTY, and remove it from disk when stopped. |
--mount src=novnc_share,dst=/root/share,ro=false |
Mounts the novnc_share volume to /root/share in the novnc_client container. |
-p 0.0.0.0:4433:443/tcp |
Listens on all of the host’s interfaces (0.0.0.0 ), on port 4433, and forwards all TCP traffic to port 443 on the container. |
novnc_client:latest |
Runs the build tagged novnc_client:latest . |
The --mount
options should match the Docker volumes and directories you’ll be using with your own containers, if not the Burp and noVNC ones discussed in this article.
A complete example, with definitions for all containers discussed in this series as well as interactive build and run scripts, is present at github.com/elespike/burp_containers.
noVNC server
dockerfile
The following is based on this dockerfile version.
debian:buster-slim
:
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
|
oracle
:
|
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
|
Note line 19: for convenience, it will cause the current directory to be ~/share
upon login.
|
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
- Copy
entrypoint.sh
to the container. - Expose port 5900 and set
entrypoint.sh
to execute when the container runs.
entrypoint.sh
The following is based on this entrypoint.sh version.
share
directory and generating a certificate, if one doesn’t already exist:
1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
|
Custom certificates can be pre-loaded through a Docker volume mounted on /home/oracle/share
, or through an active SSH container before running this container.
oracle
:
|
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
|
|
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
|
One item of note is _shell="& exec /bin/bash -i"
. This sets up the --shell
argument. When present, it will cause the container to execute x11vnc
as a background process and, by means of exec
, replace the current process with /bin/bash
, dropping the container into an interactive shell.
websockify
and x11vnc
as the unprivileged user, oracle
:
|
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
Let’s explore how that last command causes the container to…
Run as a normal user
exec |
Replaces the current process with what’s invoked next. |
chroot --userspec=oracle:oracle |
Runs a command as the oracle user/group rather than running everything as root . |
/ |
The newroot argument to chroot . In this case, we’re not using chroot to change the root directory; just to change the user. |
env HOME=${_home} |
Runs a command with the specified environment; i.e., setting /home/oracle as the oracle user’s home directory. |
/bin/bash -c "x11vnc ... ${_shell}" |
Spawns a bash process to execute x11vnc and _shell . |
Here’s what that looks like without the --shell
argument:
exec
|__chroot
|__env (now running as 'oracle:oracle')
|__bash
|__x11vnc (becomes parent process)
And with the --shell
argument:
exec
|__chroot
|__env (now running as 'oracle:oracle')
|__bash
|__x11vnc (in background)
|__exec
|__bash (becomes parent process)
Building and running
You can find interactive build and execution scripts for the Burp Suite and its auxiliary containers at github.com/elespike/burp_containers!
To build the container, simply:
- Ensure the current directory is where the
dockerfile
resides - Execute
sudo docker build -t novnc_server:latest .
Note the trailing .
, which just represents the current directory.
-t novnc_server:latest
tags the build so we can reference it when running the container, as outlined below.
sudo docker run -d -it --rm |
Runs the container as a daemon (background process), with an interactive TTY, and remove it from disk when stopped. |
--mount src=novnc_share,dst=/home/oracle/share,ro=false |
Mounts the novnc_share volume to /home/oracle/share in the novnc_server container. |
--mount src=x11_socket,dst=/tmp/.X11-unix,ro=false |
Mounts the x11_socket volume to the directory /tmp/.X11-unix in the novnc_server container. See volumes for GUI display for more information. |
-p 0.0.0.0:6080:6080/tcp |
Listens on all of the host’s interfaces (0.0.0.0 ), on port 6080, and forwards all TCP traffic to port 6080 on the container. |
novnc_server:latest |
Runs the build tagged novnc_server:latest . |
--1600x900 |
Resolution argument to entrypoint.sh , which sets the viewing resolution to the specified value. |
--shell |
Shell argument to entrypoint.sh . |
The --mount
options should match the Docker volumes and directories you’ll be using with your own containers, if not the Burp and noVNC ones discussed in this article.
A complete example, with definitions for all containers discussed in this series as well as interactive build and run scripts, is present at github.com/elespike/burp_containers.