From 896bd96ffd3a29d6c934e980ad819d7db7857026 Mon Sep 17 00:00:00 2001 From: Akilan Selvacoumar Date: Fri, 30 Jul 2021 14:45:09 +0400 Subject: [PATCH] added p2prc script --- Dockerfile | 78 +++++++++++++++++++++++++++++++++++++-------- README.md | 2 +- core/barrier-kvm.go | 4 +-- p2prc.sh | 41 ++++++++++++++++++++++++ run.sh | 16 ---------- 5 files changed, 108 insertions(+), 33 deletions(-) create mode 100644 p2prc.sh delete mode 100644 run.sh diff --git a/Dockerfile b/Dockerfile index b1afc78..4153f8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,65 @@ -FROM golang:latest as builder -LABEL maintainer="Adam Jordan " -WORKDIR /build -COPY go.mod go.sum ./ -RUN go mod download -COPY . . -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o laplace . +# ----------------------------------------------------------------------------- +# This is base image of Ubuntu LTS with SSHD service. +# +# Authors: Art567 +# Updated: Sep 20th, 2015 +# Require: Docker (http://www.docker.io/) +# ----------------------------------------------------------------------------- -FROM alpine:latest -RUN apk --no-cache add ca-certificates -WORKDIR /root/ -COPY --from=builder /build/laplace . -COPY files files -EXPOSE 443 -CMD ["./laplace"] + +# Base system is the latest LTS version of Ubuntu. +# from consol/ubuntu-xfce-vnc + +# due to dependency issues vnc is still work in progress +from ubuntu:20.04 + +# Switch to root user to install additional software +USER 0 + + +# Make sure we don't get notifications we can't answer during building. +env DEBIAN_FRONTEND noninteractive + + +# Prepare scripts and configs +add ./scripts/start /start + + +# Download and install everything from the repos. +run apt-get -q -y update; apt-get -q -y upgrade && \ + apt-get -q -y install sudo openssh-server && \ + mkdir /var/run/sshd + +# Installing golang and git +run apt install golang && \ + apt install git + + +# Set root password +run echo 'root:password' >> /root/passwdfile + + +# Create user and it's password +run useradd -m -G sudo master && \ + echo 'master:password' >> /root/passwdfile + + +# Apply root password +run chpasswd -c SHA512 < /root/passwdfile && \ + rm /root/passwdfile + + +# Port 22 is used for ssh +expose 22 + + +# Assign /data as static volume. +volume ["/data"] + + +# Fix all permissions +run chmod +x /start + + +# Starting sshd +cmd ["/start"] diff --git a/README.md b/README.md index 7fa4cd6..b47ba59 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,6 @@ https://github.com/Akilan1999/laplace/tree/keyboard_mouse ## Installation instruction ``` - +docker run -p 6080:80 -v /dev/shm:/dev/shm dorowu/ubuntu-desktop-lxde-vnc ``` diff --git a/core/barrier-kvm.go b/core/barrier-kvm.go index 4eba50b..231acf8 100644 --- a/core/barrier-kvm.go +++ b/core/barrier-kvm.go @@ -31,7 +31,7 @@ func (b *Barrier)CreateBarrierSession() error { return err } - cmd := exec.Command("sudo","-u",configResp.SystemUsername,"barrier.barrierc","-f","--debug", "DEBUG" ,"--log", "/tmp/barrier.log",b.IPAddress) + cmd := exec.Command("sudo","-u",configResp.SystemUsername,"barrierc","-f","--debug", "DEBUG" ,"--log", "/tmp/barrier.log",b.IPAddress) // USE THE FOLLOWING TO DEBUG //cmdReader, err := cmd.StdoutPipe() @@ -81,7 +81,7 @@ func (b *Barrier)DeleteBarrierSession() error { // DetectBarrier This function ensures that the server has barrier client installed func DetectBarrier() error { - _, err := exec.LookPath("barrier.barrierc") + _, err := exec.LookPath("barrierc") if err != nil { return err } diff --git a/p2prc.sh b/p2prc.sh new file mode 100644 index 0000000..44363d3 --- /dev/null +++ b/p2prc.sh @@ -0,0 +1,41 @@ +# Note: This script is only be executed inside the docker container +# Assumes to be running on ubuntu 20.04 +# Ports required to be allocated internally: +# - 8888 (laplace server) +# - 24800 (barrier server) + +export REMOTEGAMEPLAY=$PWD + +# Updating and installing go compiler +apt update +apt install golang + +# Installing barrier +apt install barrier + +# Installing chromium +wget https://github.com/RobRich999/Chromium_Clang/releases/download/v94.0.4585.0-r904940-linux64-deb-avx/chromium-browser-unstable_94.0.4585.0-1_amd64.deb +apt install ./v94.0.4585.0-r904940-linux64-deb-avx/chromium-browser-unstable_94.0.4585.0-1_amd64.deb + +# clone remotegameplay distribution +git clone https://github.com/Akilan1999/remotegameplay +# enter cloned directory +cd remotegameplay + +# Build laplace binary file +go build . + +./laplace -setconfig +./laplace -tls -addr 0.0.0.0:8888 & +./laplace -headless & + +sleep 2 + +./laplace -headless -roomInfo >> /tmp/output.txt + +# Installation game script here and start remote gameplay + + + + + diff --git a/run.sh b/run.sh deleted file mode 100644 index 64fae77..0000000 --- a/run.sh +++ /dev/null @@ -1,16 +0,0 @@ -export REMOTEGAMEPLAY=$PWD - -go build . - -./laplace -setconfig -./laplace -tls -addr 0.0.0.0:8888 & -./laplace -headless & - -sleep 2 - -./laplace -headless -roomInfo - - - - -