novnc to purevnc

This commit is contained in:
Apoorv Vyavahare 2021-08-12 19:35:07 +00:00
parent 74431ae5a0
commit 262e908db9
10 changed files with 57 additions and 61 deletions

View File

@ -1,6 +1,6 @@
FROM ubuntu:20.04
FROM vital987/supervisor:ubuntu20.04
LABEL AboutImage "Ubuntu20.04_Fluxbox_NoVNC"
LABEL AboutImage "Ubuntu20.04_Fluxbox_PureVNC"
LABEL Maintainer "Apoorv Vyavahare <apoorvvyavahare@pm.me>"
@ -15,16 +15,19 @@ ENV DEBIAN_FRONTEND=noninteractive \
VNC_RESOLUTION="1280x720" \
#Local Display Server Port
DISPLAY=:0 \
#NoVNC Port
NOVNC_PORT=$PORT \
#Locale
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
LC_ALL=C.UTF-8 \
TZ="Asia/Kolkata"
TZ="Asia/Kolkata" \
#Ngrok Specific
NGROK_BINDTLS=1 \
NGROK_METHOD=tcp \
NGROK_PORT=5900
COPY . /app
COPY conf.d/*.conf /config/supervisor/
COPY conf.d/*.py /config/
RUN rm -rf /etc/apt/sources.list && \
#All Official Focal Repos
bash -c 'echo -e "deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse\ndeb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse\ndeb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse\ndeb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse\ndeb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse\ndeb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse\ndeb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse\ndeb http://archive.canonical.com/ubuntu focal partner\ndeb-src http://archive.canonical.com/ubuntu focal partner" >/etc/apt/sources.list' && \
@ -40,13 +43,14 @@ RUN rm -rf /etc/apt/sources.list && \
curl \
vim \
zip \
socat \
sudo \
net-tools \
iputils-ping \
build-essential \
#python3 \
#python3-pip \
#python-is-python3 \
python3 \
python3-pip \
python-is-python3 \
#perl \
#ruby \
#golang \
@ -70,34 +74,21 @@ RUN rm -rf /etc/apt/sources.list && \
libreoffice \
pcmanfm \
terminator \
supervisor \
x11vnc \
xvfb \
gnupg \
dirmngr \
gdebi-core \
nginx \
novnc \
openvpn \
ffmpeg \
pluma \
#Fluxbox
/app/fluxbox-mod.deb && \
#Websockify
npm i websockify && \
#MATE Desktop
#apt install -y \
#ubuntu-mate-core \
#ubuntu-mate-desktop && \
#XFCE Desktop
#apt install -y \
#xubuntu-desktop && \
#PyNgrok
pip3 install pyngrok && \
#TimeZone
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && \
echo $TZ > /etc/timezone && \
#NoVNC
cp /usr/share/novnc/vnc.html /usr/share/novnc/index.html && \
openssl req -new -newkey rsa:4096 -days 36500 -nodes -x509 -subj "/C=IN/ST=Maharastra/L=Private/O=Dis/CN=www.google.com" -keyout /etc/ssl/novnc.key -out /etc/ssl/novnc.cert && \
#VS Code
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg && \
install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/ && \
@ -129,7 +120,3 @@ RUN rm -rf /etc/apt/sources.list && \
apt install -y /tmp/packages-microsoft-prod.deb && \
apt update && \
apt-get install -y powershell
ENTRYPOINT ["supervisord", "-l", "/app/supervisord.log", "-c"]
CMD ["/app/supervisord.conf"]

View File

@ -1,18 +0,0 @@
FROM vital987/vubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive \
#VNC Server Password
VNC_PASS="samplepass" \
#VNC Server Title(w/o spaces)
VNC_TITLE="Vubuntu" \
#VNC Resolution(720p is preferable)
VNC_RESOLUTION="1280x720" \
#NoVNC Port
NOVNC_PORT=5900 \
#PORT
PORT=80 \
#Locale
LANG=en_US.UTF-8 \
LANGUAGE=en_US.UTF-8 \
LC_ALL=C.UTF-8 \
TZ="Asia/Kolkata"

View File

@ -3,4 +3,4 @@ command=bash -c 'Xvfb $DISPLAY -screen 0 $VNC_RESOLUTION"x24" -nolisten unix'
autostart=true
autorestart=true
stderr_logfile=/var/log/Xvfb.stderr.log
priority=999
priority=1

View File

@ -2,5 +2,5 @@
command=fluxbox
autostart=true
autorestart=true
priority=996
stderr_logfile=/var/log/fluxbox.err.log
priority=2
stderr_logfile=/var/log/fluxbox.err.log

View File

@ -3,4 +3,4 @@ command=bash -c 'x11vnc -storepasswd $VNC_PASS /app/.xpass && x11vnc -usepw -rfb
autostart=true
autorestart=false
stderr_logfile=/var/log/x11vnc.stderr.log
priority=998
priority=3

View File

@ -1,6 +0,0 @@
[program:websockify]
command=bash -c 'websockify --cert /etc/ssl/novnc.cert --key /etc/ssl/novnc.key -D --web=/usr/share/novnc/ $PORT localhost:5900'
autostart=true
autorestart=false
stderr_logfile=/var/log/websockify.stderr.log
priority=997

11
conf.d/4-ngrok_tunnel.conf Executable file
View File

@ -0,0 +1,11 @@
[program:NGROK_TUNNEL]
command=python3 /config/ngrok_tunnel.py
autostart=true
autorestart=false
priority=4
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr
stdout_maxbytes=0
stderr_maxbytes=0
stdout_logfile_maxbytes = 0
stderr_logfile_maxbytes = 0

View File

@ -0,0 +1,6 @@
[program:portforward]
command=bash -c 'socat TCP-LISTEN:$PORT,fork TCP:127.0.0.1:4040'
stderr_logfile=/var/log/socat.err.log
priority=1
autostart=true
autorestart=false

21
conf.d/ngrok_tunnel.py Normal file
View File

@ -0,0 +1,21 @@
#!/usr/bin/python3
import os
try:
from pyngrok import ngrok, conf
except:
os.system('pip3 install pyngrok')
from pyngrok import ngrok, conf
try:
AUTH_TOKEN=os.environ['NGROK_AUTH_TOKEN']
except:
print('[!] Ngrok token not found, assign the token to NGROK_AUTH_TOKEN environment variable & try again.\n[-] Terminating...')
exit()
ngrok.set_auth_token(AUTH_TOKEN)
conf.get_default().region = "in"
try:
primary_tunnel = ngrok.connect(os.environ['NGROK_PORT'], os.environ['NGROK_METHOD'], bind_tls=bool(int(os.getenv('NGROK_BINDTLS', 1))))
except:
print('[!] NGROK_PORT or NGROK_METHOD environment variables has not been set properly, NGROK_METHOD should be http or tcp')
url=primary_tunnel.public_url
print(f'[>NGROK]: {url}')
input()

View File

@ -1,5 +0,0 @@
[supervisord]
nodaemon=true
[include]
files = /app/conf.d/*.conf