Skip to content

Commit d466c89

Browse files
committed
first commit
0 parents  commit d466c89

File tree

6 files changed

+101
-0
lines changed

6 files changed

+101
-0
lines changed

Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This file creates a container that runs X11 and SSH services
2+
# The ssh is used to forward X11 and provide you encrypted data
3+
# communication between the docker container and your local
4+
# machine.
5+
#
6+
# Xpra allows to display the programs running inside of the
7+
# container such as Firefox, LibreOffice, xterm, etc.
8+
# with disconnection and reconnection capabilities
9+
#
10+
# The applications are rootless, therefore the client machine
11+
# manages the windows displayed.
12+
#
13+
# ROX-Filer creates a very minimalist way to manage
14+
# files and icons on the desktop.
15+
#
16+
# Author: Paul Czarkowski
17+
# Date: 07/12/2013
18+
# Based on :- https://github.com/rogaha/docker-desktop
19+
20+
21+
FROM ubuntu:12.10
22+
MAINTAINER Paul Czarkowski "[email protected]"
23+
24+
RUN apt-get update
25+
26+
# Set the env variable DEBIAN_FRONTEND to noninteractive
27+
ENV DEBIAN_FRONTEND noninteractive
28+
29+
# Upstart and DBus have issues inside docker. We work around in order to install firefox.
30+
RUN dpkg-divert --local --rename --add /sbin/initctl && ln -s /bin/true /sbin/initctl
31+
32+
# Installing the environment required: xserver, xdm, flux box and ssh
33+
RUN apt-get install -y xpra ssh pwgen firefox
34+
35+
# Set locale (fix the locale warnings)
36+
RUN localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 || :
37+
38+
# Copy the files into the container
39+
ADD . /home/docker
40+
41+
ADD https://www.torproject.org/dist/torbrowser/linux/tor-browser-gnu-linux-x86_64-2.3.25-10-dev-en-US.tar.gz /home/docker/tor.tar.gz
42+
43+
EXPOSE 22
44+
# Start xdm and ssh services.
45+
CMD ["/bin/bash", "/home/docker/config.sh"]
46+

README.me

Whitespace-only changes.

config.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# Create the directory needed to run the sshd daemon
4+
mkdir /var/run/sshd
5+
6+
# Add docker user and generate a random password with 12 characters that includes at least one capital letter and number.
7+
DOCKER_PASSWORD=`pwgen -c -n -1 12`
8+
echo User: docker Password: $DOCKER_PASSWORD
9+
DOCKER_ENCRYPYTED_PASSWORD=`perl -e 'print crypt('"$DOCKER_PASSWORD"', "aa"),"\n"'`
10+
useradd -m -d /home/docker -p $DOCKER_ENCRYPYTED_PASSWORD docker
11+
sed -Ei 's/adm:x:4:/docker:x:4:docker/' /etc/group
12+
adduser docker sudo
13+
14+
# Set the default shell as bash for docker user.
15+
chsh -s /bin/bash docker
16+
17+
18+
cd /home/docker
19+
tar xzf /home/docker/tor.tar.gz
20+
21+
#Set all the files and subdirectories from /home/docker with docker permissions.
22+
chown -R docker:docker /home/docker*
23+
24+
# Start the ssh service
25+
/usr/sbin/sshd -D

start

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
ID=$(docker run -d 354a5efeec39)
4+
PORT=$(docker port $ID 22)
5+
6+
echo $ID > ~/.tor-browser.pid
7+
8+
echo "Run the following to get your SSH Password: "
9+
echo "docker logs $ID 2> /dev/null | head -1"
10+
echo "Then run the following to launch tor-browser: "
11+
echo ssh -oStrictHostKeyChecking=no -oCheckHostIP=no -YC -c blowfish docker@localhost -p $PORT ./tor-browser
12+

stop

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
ID=$(cat ~/.tor-browser.pid)
4+
5+
docker kill $ID
6+
docker rm $ID

tor-browser

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# Start the xpra session, if it's not running and attach to it.
4+
PROCESS_NUM=$(ps -ef | grep "xpra" | grep -v "grep" | wc -l)
5+
if [ $PROCESS_NUM -eq 0 ]; then
6+
# Start xpra session
7+
xpra start :0 & sleep 5 ; DISPLAY=:0 /home/docker/tor-browser_en-US/start-tor-browser &
8+
#xpra start :0 & sleep 5 ; DISPLAY=:0 /home/docker/tor-browser_en-US/App/Firefox/firefox -no-remote -profile /tmp/tor-browser_en-US/Data/profile &
9+
fi
10+
11+
# Attach the xpra session 0
12+
xpra attach :0

0 commit comments

Comments
 (0)