1
This commit is contained in:
commit
a9c30d1061
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
gohttpserver
|
||||||
|
build-dir/linux
|
||||||
|
rustdeskinstall
|
37
Dockerfile
Normal file
37
Dockerfile
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
FROM alpine:latest
|
||||||
|
|
||||||
|
ARG TARGETOS
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
ENV ENCRYPTED_ONLY 0
|
||||||
|
|
||||||
|
RUN apk update && apk add --no-cache supervisor && mkdir -p /opt/rustdesk && mkdir /public && mkdir /data
|
||||||
|
|
||||||
|
ADD build-dir/${TARGETOS}/${TARGETARCH}/gohttpserver /opt/rustdesk/gohttpserver
|
||||||
|
ADD build-dir/${TARGETOS}/${TARGETARCH}/hbbr /opt/rustdesk/hbbr
|
||||||
|
ADD build-dir/${TARGETOS}/${TARGETARCH}/hbbs /opt/rustdesk/hbbs
|
||||||
|
ADD build-dir/${TARGETOS}/${TARGETARCH}/rustdesk-utils /opt/rustdesk/rustdesk-utils
|
||||||
|
|
||||||
|
ADD supervisord.conf /etc/supervisord.conf
|
||||||
|
|
||||||
|
ADD start-gohttpserver.sh /start-gohttpserver.sh
|
||||||
|
ADD get-key-daemon.sh /get-key-daemon.sh
|
||||||
|
ADD start-hbbr.sh /start-hbbr.sh
|
||||||
|
ADD start-hbbs.sh /start-hbbs.sh
|
||||||
|
|
||||||
|
ADD start.sh /start.sh
|
||||||
|
|
||||||
|
ADD windowsclientID.ps1 /public/windowsclientID.ps1
|
||||||
|
ADD clientinstall.ps1 /public/clientinstall.ps1
|
||||||
|
|
||||||
|
ADD WindowsAgentAIOInstall.ps1 /data/WindowsAgentAIOInstall.ps1
|
||||||
|
ADD linuxclientinstall.sh /data/linuxclientinstall.sh
|
||||||
|
|
||||||
|
VOLUME ["/public"]
|
||||||
|
VOLUME ["/kes"]
|
||||||
|
|
||||||
|
EXPOSE 21115 21116 21116/udp 21117 21118 21119 8080
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
CMD ["/bin/sh", "/start.sh"]
|
7
Dockerfile-gohttp
Normal file
7
Dockerfile-gohttp
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
FROM golang:alpine
|
||||||
|
|
||||||
|
RUN apk update && apk add upx
|
||||||
|
|
||||||
|
WORKDIR /build
|
||||||
|
|
||||||
|
CMD ["/bin/sh", "/build/build-gohttp.sh"]
|
15
Makefile
Normal file
15
Makefile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
all: init-buildx build publish
|
||||||
|
|
||||||
|
build:
|
||||||
|
bash build.sh
|
||||||
|
publish:
|
||||||
|
bash publish.sh
|
||||||
|
|
||||||
|
init-buildx: clean-buildx
|
||||||
|
docker buildx create --name mybuilder
|
||||||
|
docker buildx use mybuilder
|
||||||
|
docker buildx inspect --bootstrap
|
||||||
|
docker buildx ls
|
||||||
|
clean-buildx:
|
||||||
|
docker buildx rm mybuilder;true
|
||||||
|
|
129
WindowsAgentAIOInstall.ps1
Normal file
129
WindowsAgentAIOInstall.ps1
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
$ErrorActionPreference= 'silentlycontinue'
|
||||||
|
#Run as administrator and stays in the current directory
|
||||||
|
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||||
|
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
|
||||||
|
Start-Process PowerShell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"cd '$pwd'; & '$PSCommandPath';`"";
|
||||||
|
Exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Replace wanipreg and keyreg with the relevant info for your install. IE wanipreg becomes your rustdesk server IP or DNS and keyreg becomes your public key.
|
||||||
|
|
||||||
|
$rustdesk_url = 'https://github.com/rustdesk/rustdesk/releases/latest'
|
||||||
|
$request = [System.Net.WebRequest]::Create($rustdesk_url)
|
||||||
|
$response = $request.GetResponse()
|
||||||
|
$realTagUrl = $response.ResponseUri.OriginalString
|
||||||
|
$rustdesk_version = $realTagUrl.split('/')[-1].Trim('v')
|
||||||
|
Write-Output("Installing Rustdesk version $rustdesk_version")
|
||||||
|
|
||||||
|
function OutputIDandPW([String]$rustdesk_id, [String]$rustdesk_pw) {
|
||||||
|
Write-Output("######################################################")
|
||||||
|
Write-Output("# #")
|
||||||
|
Write-Output("# CONNECTION PARAMETERS: #")
|
||||||
|
Write-Output("# #")
|
||||||
|
Write-Output("######################################################")
|
||||||
|
Write-Output("")
|
||||||
|
Write-Output(" RustDesk-ID: $rustdesk_id")
|
||||||
|
Write-Output(" RustDesk-Password: $rustdesk_pw")
|
||||||
|
Write-Output("")
|
||||||
|
}
|
||||||
|
|
||||||
|
If (!(Test-Path $env:Temp)) {
|
||||||
|
New-Item -ItemType Directory -Force -Path $env:Temp > null
|
||||||
|
}
|
||||||
|
|
||||||
|
If (!(Test-Path "$env:ProgramFiles\Rustdesk\RustDesk.exe")) {
|
||||||
|
|
||||||
|
cd $env:Temp
|
||||||
|
|
||||||
|
If ([Environment]::Is64BitOperatingSystem) {
|
||||||
|
$os_arch = "x64"
|
||||||
|
} Else {
|
||||||
|
$os_arch = "x32"
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-WebRequest https://github.com/rustdesk/rustdesk/releases/download/$rustdesk_version/rustdesk-$rustdesk_version-windows_$os_arch.zip -Outfile rustdesk.zip
|
||||||
|
|
||||||
|
Expand-Archive rustdesk.zip
|
||||||
|
cd rustdesk
|
||||||
|
Start-Process "rustdesk-$rustdesk_version-putes.exe" -argumentlist "--silent-install" -wait
|
||||||
|
|
||||||
|
# Set URL Handler
|
||||||
|
New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk" > null
|
||||||
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\RustDesk" -Name "(Default)" -Value "URL:RustDesk Protocol" > null
|
||||||
|
New-ItemProperty -Path "HKLM:\SOFTWARE\Classes\RustDesk" -Name "URL Protocol" -Type STRING > null
|
||||||
|
|
||||||
|
New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk\DefaultIcon" > null
|
||||||
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\RustDesk\DefaultIcon" -Name "(Default)" -Value "RustDesk.exe,0" > null
|
||||||
|
|
||||||
|
New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell" > null
|
||||||
|
New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell\open" > null
|
||||||
|
New-Item -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell\open\command" > null
|
||||||
|
$rustdesklauncher = '"' + $env:ProgramFiles + '\RustDesk\RustDeskURLLauncher.exe" %1"'
|
||||||
|
Set-ItemProperty -Path "HKLM:\SOFTWARE\Classes\RustDesk\shell\open\command" -Name "(Default)" -Value $rustdesklauncher > null
|
||||||
|
|
||||||
|
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force > null
|
||||||
|
Install-Module ps2exe -Force > null
|
||||||
|
|
||||||
|
$urlhandler_ps1 = @"
|
||||||
|
`$url_handler = `$args[0]
|
||||||
|
`$rustdesk_id = `$url_handler -creplace '(?s)^.*\:',''
|
||||||
|
Start-Process -FilePath '$env:ProgramFiles\RustDesk\rustdesk.exe' -ArgumentList "--connect `$rustdesk_id"
|
||||||
|
"@
|
||||||
|
|
||||||
|
New-Item "$env:ProgramFiles\RustDesk\urlhandler.ps1" > null
|
||||||
|
Set-Content "$env:ProgramFiles\RustDesk\urlhandler.ps1" $urlhandler_ps1 > null
|
||||||
|
Invoke-Ps2Exe "$env:ProgramFiles\RustDesk\urlhandler.ps1" "$env:ProgramFiles\RustDesk\RustDeskURLLauncher.exe" > null
|
||||||
|
|
||||||
|
# Cleanup Tempfiles
|
||||||
|
Remove-Item "$env:ProgramFiles\RustDesk\urlhandler.ps1" > null
|
||||||
|
cd $env:Temp
|
||||||
|
Remove-Item $env:Temp\rustdesk -Recurse > null
|
||||||
|
Remove-Item $env:Temp\rustdesk.zip > null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Write config
|
||||||
|
$RustDesk2_toml = @"
|
||||||
|
rendezvous_server = 'wanipreg'
|
||||||
|
nat_type = 1
|
||||||
|
serial = 0
|
||||||
|
|
||||||
|
[options]
|
||||||
|
custom-rendezvous-server = 'wanipreg'
|
||||||
|
key = 'keyreg'
|
||||||
|
relay-server = 'wanipreg'
|
||||||
|
api-server = 'https://wanipreg'
|
||||||
|
enable-audio = 'N'
|
||||||
|
"@
|
||||||
|
|
||||||
|
If (!(Test-Path $env:AppData\RustDesk\config\RustDesk2.toml)) {
|
||||||
|
New-Item $env:AppData\RustDesk\config\RustDesk2.toml > null
|
||||||
|
}
|
||||||
|
Set-Content $env:AppData\RustDesk\config\RustDesk2.toml $RustDesk2_toml > null
|
||||||
|
|
||||||
|
If (!(Test-Path $env:WinDir\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk2.toml)) {
|
||||||
|
New-Item $env:WinDir\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk2.toml > null
|
||||||
|
}
|
||||||
|
Set-Content $env:WinDir\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk2.toml $RustDesk2_toml > null
|
||||||
|
|
||||||
|
$random_pass = (-join ((65..90) + (97..122) | Get-Random -Count 8 | % {[char]$_}))
|
||||||
|
Start-Process "$env:ProgramFiles\RustDesk\RustDesk.exe" -argumentlist "--password $random_pass" -wait
|
||||||
|
|
||||||
|
# Get RustDesk ID
|
||||||
|
If (!("$env:WinDir\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml")) {
|
||||||
|
$rustdesk_id = (Get-Content $env:AppData\RustDesk\config\RustDesk.toml | Where-Object { $_.Contains("id") })
|
||||||
|
$rustdesk_id = $rustdesk_id.Split("'")[1]
|
||||||
|
$rustdesk_pw = (Get-Content $env:AppData\RustDesk\config\RustDesk.toml | Where-Object { $_.Contains("password") })
|
||||||
|
$rustdesk_pw = $rustdesk_pw.Split("'")[1]
|
||||||
|
Write-Output("Config file found in user folder")
|
||||||
|
OutputIDandPW $rustdesk_id $rustdesk_pw
|
||||||
|
} Else {
|
||||||
|
$rustdesk_id = (Get-Content $env:WinDir\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml | Where-Object { $_.Contains("id") })
|
||||||
|
$rustdesk_id = $rustdesk_id.Split("'")[1]
|
||||||
|
$rustdesk_pw = (Get-Content $env:WinDir\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml | Where-Object { $_.Contains("password") })
|
||||||
|
$rustdesk_pw = $rustdesk_pw.Split("'")[1]
|
||||||
|
Write-Output "Config file found in windows service folder"
|
||||||
|
OutputIDandPW $rustdesk_id $rustdesk_pw
|
||||||
|
}
|
||||||
|
|
||||||
|
Stop-Process -Name RustDesk -Force > null
|
||||||
|
Start-Service -Name RustDesk > null
|
24
add-rustdesk-server-container.rsc
Normal file
24
add-rustdesk-server-container.rsc
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/interface/bridge/add name=dockers
|
||||||
|
/ip/address/add address=172.20.0.254/24 interface=dockers
|
||||||
|
|
||||||
|
/interface/veth/add name=veth91 address=172.20.0.91/24 gateway=172.20.0.254
|
||||||
|
/interface/bridge/port add bridge=dockers interface=veth91
|
||||||
|
|
||||||
|
/container/config/set registry-url=https://registry-1.docker.io tmpdir=disk1/pull
|
||||||
|
|
||||||
|
/container/envs/add name=rustdesk_envs key=TZ value="Asia/Jerusalem"
|
||||||
|
|
||||||
|
/container/envs/add name=rustdesk_envs key=IP value="172.20.0.91"
|
||||||
|
/container/envs/add name=rustdesk_envs key=DOMAIN value="172.20.0.91"
|
||||||
|
/container/envs/add name=rustdesk_envs key=RELAY value="172.20.0.91"
|
||||||
|
|
||||||
|
/container/envs/add name=rustdesk_envs key=HTTP_ADMIN_USER value="admin"
|
||||||
|
/container/envs/add name=rustdesk_envs key=HTTP_ADMIN_PASS value="73245937-be70-4921-955d-6cba7e872b18"
|
||||||
|
/container/envs/add name=rustdesk_envs key=HTTP_PORT value="80"
|
||||||
|
/container/envs/add name=rustdesk_envs key=ENCRYPTED_ONLY value="0"
|
||||||
|
|
||||||
|
/container mounts add dst=/data name=rustdesk_data src=/disk1/rustdesk_data
|
||||||
|
/container mounts add dst=/public name=rustdesk_public_http src=/disk1/rustdesk_public_http
|
||||||
|
|
||||||
|
/container/add mounts=rustdesk_data,rustdesk_public_http dns=172.20.0.254 remote-image=elicro/rustdesk-server:latest interface=veth91 root-dir=disk1/rustdesk envlist=rustdesk_envs start-on-boot=yes
|
||||||
|
|
23
build-gohttp.sh
Executable file
23
build-gohttp.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
BUILDTIME=$(date -u +%Y/%m/%d-%H:%M:%S)
|
||||||
|
|
||||||
|
LDFLAGS="-X main.VERSION=NgTech -X main.BUILDTIME=${BUILDTIME}"
|
||||||
|
if [[ -n "${EX_LDFLAGS:-""}" ]]
|
||||||
|
then
|
||||||
|
LDFLAGS="$LDFLAGS $EX_LDFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
GOOS=linux GOARCH=amd64 go build -ldflags "$LDFLAGS" -o /build/gohttpserver-amd64
|
||||||
|
GOOS=linux GOARCH=arm64 go build -ldflags "$LDFLAGS" -o /build/gohttpserver-arm64
|
||||||
|
GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "$LDFLAGS" -o /build/gohttpserver-arm
|
||||||
|
|
||||||
|
chmod +x /build/gohttpserver-amd64
|
||||||
|
chmod +x /build/gohttpserver-arm64
|
||||||
|
chmod +x /build/gohttpserver-arm
|
||||||
|
|
||||||
|
upx /build/gohttpserver-amd64
|
||||||
|
upx /build/gohttpserver-arm64
|
||||||
|
upx /build/gohttpserver-arm
|
80
build.sh
Executable file
80
build.sh
Executable file
@ -0,0 +1,80 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "cleaning up"
|
||||||
|
|
||||||
|
rm -vrf build-dir/linux/{amd64,arm64,arm}
|
||||||
|
|
||||||
|
mkdir -p build-dir/linux/{amd64,arm64,arm}
|
||||||
|
|
||||||
|
#Download latest version of Rustdesk-server
|
||||||
|
RDLATEST=$(curl https://api.github.com/repos/rustdesk/rustdesk-server/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
wget "https://github.com/rustdesk/rustdesk-server/releases/download/${RDLATEST}/rustdesk-server-linux-amd64.zip" -O "build-dir/linux/amd64/rustdesk-server-linux-amd64.zip"
|
||||||
|
cd build-dir/linux/amd64/ && unzip rustdesk-server-linux-amd64.zip && cd -
|
||||||
|
chmod +x "build-dir/linux/amd64/amd64/hbbs"
|
||||||
|
chmod +x "build-dir/linux/amd64/amd64/hbbr"
|
||||||
|
chmod +x "build-dir/linux/amd64/amd64/rustdesk-utils"
|
||||||
|
mv -v build-dir/linux/amd64/amd64/* build-dir/linux/amd64/
|
||||||
|
|
||||||
|
wget "https://github.com/rustdesk/rustdesk-server/releases/download/${RDLATEST}/rustdesk-server-linux-arm64v8.zip" -O "build-dir/linux/arm64/rustdesk-server-linux-arm64v8.zip"
|
||||||
|
cd build-dir/linux/arm64/ && unzip rustdesk-server-linux-arm64v8.zip && cd -
|
||||||
|
chmod +x "build-dir/linux/arm64/arm64v8/hbbs"
|
||||||
|
chmod +x "build-dir/linux/arm64/arm64v8/hbbr"
|
||||||
|
chmod +x "build-dir/linux/arm64/arm64v8/rustdesk-utils"
|
||||||
|
mv -v build-dir/linux/arm64/arm64v8/* build-dir/linux/arm64/
|
||||||
|
|
||||||
|
wget "https://github.com/rustdesk/rustdesk-server/releases/download/${RDLATEST}/rustdesk-server-linux-armv7.zip" -O "build-dir/linux/arm/rustdesk-server-linux-armv7.zip"
|
||||||
|
cd build-dir/linux/arm/ && unzip rustdesk-server-linux-armv7.zip && cd -
|
||||||
|
chmod +x "build-dir/linux/arm/armv7/hbbs"
|
||||||
|
chmod +x "build-dir/linux/arm/armv7/hbbr"
|
||||||
|
chmod +x "build-dir/linux/arm/armv7/rustdesk-utils"
|
||||||
|
mv -v build-dir/linux/arm/armv7/* build-dir/linux/arm/
|
||||||
|
|
||||||
|
echo "Downloaded rustdesk-server files"
|
||||||
|
|
||||||
|
rm -rf gohttpserver
|
||||||
|
|
||||||
|
git clone https://github.com/codeskyblue/gohttpserver
|
||||||
|
|
||||||
|
cp -v build-gohttp.sh gohttpserver/
|
||||||
|
cp -v Dockerfile-gohttp gohttpserver/Dockerfile
|
||||||
|
|
||||||
|
cd gohttpserver && docker build -t local-build/gohttpserver . && \
|
||||||
|
docker run -it -v $(pwd):/build local-build/gohttpserver && \
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
cp gohttpserver/gohttpserver-amd64 build-dir/linux/amd64/gohttpserver
|
||||||
|
cp gohttpserver/gohttpserver-arm64 build-dir/linux/arm64/gohttpserver
|
||||||
|
cp gohttpserver/gohttpserver-arm build-dir/linux/arm/gohttpserver
|
||||||
|
|
||||||
|
echo "Compiled gohttpserver"
|
||||||
|
|
||||||
|
if [ -d "rustdeskinstall" ];then
|
||||||
|
rm -rf rustdeskinstall
|
||||||
|
fi
|
||||||
|
|
||||||
|
git clone https://github.com/techahold/rustdeskinstall
|
||||||
|
|
||||||
|
cp rustdeskinstall/windowsclientID.ps1 ./
|
||||||
|
cp rustdeskinstall/clientinstall.ps1 ./
|
||||||
|
cp rustdeskinstall/WindowsAgentAIOInstall.ps1 ./
|
||||||
|
|
||||||
|
cp rustdeskinstall/linuxclientinstall.sh ./
|
||||||
|
|
||||||
|
|
||||||
|
#GOHTTPLATEST=$(curl https://api.github.com/repos/codeskyblue/gohttpserver/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
#wget "https://github.com/codeskyblue/gohttpserver/releases/download/${GOHTTPLATEST}/gohttpserver_${GOHTTPLATEST}_linux_amd64.tar.gz" -O "build-dir/linux/amd64/gohttpserver_${GOHTTPLATEST}_linux_amd64.tar.gz"
|
||||||
|
#cd build-dir/linux/amd64/ && tar -xf gohttpserver_${GOHTTPLATEST}_linux_*.tar.gz && cd -
|
||||||
|
|
||||||
|
#wget "https://github.com/codeskyblue/gohttpserver/releases/download/${GOHTTPLATEST}/gohttpserver_${GOHTTPLATEST}_linux_arm64.tar.gz" -O "build-dir/linux/arm64/gohttpserver_${GOHTTPLATEST}_linux_arm64.tar.gz"
|
||||||
|
#cd build-dir/linux/arm64/ && tar -xf gohttpserver_${GOHTTPLATEST}_linux_*.tar.gz && cd -
|
||||||
|
|
||||||
|
#chmod +x "build-dir/linux/arm/gohttpserver"
|
||||||
|
#chmod +x "build-dir/linux/arm64/gohttpserver"
|
||||||
|
#chmod +x "build-dir/linux/amd64/gohttpserver"
|
||||||
|
|
||||||
|
#upx "build-dir/linux/amd64/gohttpserver"
|
||||||
|
#upx "build-dir/linux/arm64/gohttpserver"
|
||||||
|
#upx "build-dir/linux/arm/gohttpserver"
|
||||||
|
|
||||||
|
|
||||||
|
|
16
clientinstall.ps1
Normal file
16
clientinstall.ps1
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
$ErrorActionPreference= 'silentlycontinue'
|
||||||
|
|
||||||
|
If (!(test-path "c:\temp")) {
|
||||||
|
New-Item -ItemType Directory -Force -Path "c:\temp"
|
||||||
|
}
|
||||||
|
cd c:\temp
|
||||||
|
|
||||||
|
If (!(test-path "C:\Program Files\Rustdesk\RustDesk.exe")) {
|
||||||
|
cd c:\temp
|
||||||
|
|
||||||
|
Invoke-WebRequest https://github.com/rustdesk/rustdesk/releases/download/1.1.9/rustdesk-1.1.9-windows_x64.zip -Outfile rustdesk.zip
|
||||||
|
|
||||||
|
expand-archive rustdesk.zip
|
||||||
|
cd rustdesk
|
||||||
|
start .\rustdesk-1.1.9-putes.exe --silent-install
|
||||||
|
}
|
1
container-name
Normal file
1
container-name
Normal file
@ -0,0 +1 @@
|
|||||||
|
rustdesk-server
|
30
get-key-daemon.sh
Executable file
30
get-key-daemon.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
. /.env
|
||||||
|
|
||||||
|
while [ -f "/.dockerenv" ];
|
||||||
|
do
|
||||||
|
if [ ! -f "/public/pub-key" ];then
|
||||||
|
pubname=$(find /data/ -type f -name "*.pub")
|
||||||
|
key=$(cat "${pubname}")
|
||||||
|
if [ -z "${key}" ];then
|
||||||
|
sleep 1
|
||||||
|
else
|
||||||
|
if [ -f "/data/id_ed25519" && -f "/data/id_ed25519.pub" ];then
|
||||||
|
/opt/rustdesk/rustdesk-utils validatekeypair "$(cat /data/id_ed25519.pub)" "$(cat /data/id_ed25519)"
|
||||||
|
if [ "$?" -gt 0 ];then
|
||||||
|
echo "Key pair not valid"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${key}" > /public/pub-key
|
||||||
|
sleep 60
|
||||||
|
else
|
||||||
|
sleep 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
sleep 60
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
300
install.sh
Normal file
300
install.sh
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Get Username
|
||||||
|
uname=$(whoami)
|
||||||
|
admintoken=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c16)
|
||||||
|
|
||||||
|
# identify OS
|
||||||
|
if [ -f /etc/os-release ]; then
|
||||||
|
# freedesktop.org and systemd
|
||||||
|
. /etc/os-release
|
||||||
|
OS=$NAME
|
||||||
|
VER=$VERSION_ID
|
||||||
|
|
||||||
|
UPSTREAM_ID=${ID_LIKE,,}
|
||||||
|
|
||||||
|
# Fallback to ID_LIKE if ID was not 'ubuntu' or 'debian'
|
||||||
|
if [ "${UPSTREAM_ID}" != "debian" ] && [ "${UPSTREAM_ID}" != "ubuntu" ]; then
|
||||||
|
UPSTREAM_ID="$(echo ${ID_LIKE,,} | sed s/\"//g | cut -d' ' -f1)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
elif type lsb_release >/dev/null 2>&1; then
|
||||||
|
# linuxbase.org
|
||||||
|
OS=$(lsb_release -si)
|
||||||
|
VER=$(lsb_release -sr)
|
||||||
|
elif [ -f /etc/lsb-release ]; then
|
||||||
|
# For some versions of Debian/Ubuntu without lsb_release command
|
||||||
|
. /etc/lsb-release
|
||||||
|
OS=$DISTRIB_ID
|
||||||
|
VER=$DISTRIB_RELEASE
|
||||||
|
elif [ -f /etc/debian_version ]; then
|
||||||
|
# Older Debian/Ubuntu/etc.
|
||||||
|
OS=Debian
|
||||||
|
VER=$(cat /etc/debian_version)
|
||||||
|
elif [ -f /etc/SuSe-release ]; then
|
||||||
|
# Older SuSE/etc.
|
||||||
|
OS=SuSE
|
||||||
|
VER=$(cat /etc/SuSe-release)
|
||||||
|
elif [ -f /etc/redhat-release ]; then
|
||||||
|
# Older Red Hat, CentOS, etc.
|
||||||
|
OS=RedHat
|
||||||
|
VER=$(cat /etc/redhat-release)
|
||||||
|
else
|
||||||
|
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
|
||||||
|
OS=$(uname -s)
|
||||||
|
VER=$(uname -r)
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# output ebugging info if $DEBUG set
|
||||||
|
if [ "$DEBUG" = "true" ]; then
|
||||||
|
echo "OS: $OS"
|
||||||
|
echo "VER: $VER"
|
||||||
|
echo "UPSTREAM_ID: $UPSTREAM_ID"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Setup prereqs for server
|
||||||
|
# common named prereqs
|
||||||
|
PREREQ="curl wget unzip tar"
|
||||||
|
PREREQDEB="dnsutils"
|
||||||
|
PREREQRPM="bind-utils"
|
||||||
|
PREREQARCH="bind"
|
||||||
|
|
||||||
|
echo "Installing prerequisites"
|
||||||
|
if [ "${ID}" = "debian" ] || [ "$OS" = "Ubuntu" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "ubuntu" ] || [ "${UPSTREAM_ID}" = "debian" ]; then
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y ${PREREQ} ${PREREQDEB} # git
|
||||||
|
elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "${UPSTREAM_ID}" = "rhel" ] ; then
|
||||||
|
# opensuse 15.4 fails to run the relay service and hangs waiting for it
|
||||||
|
# needs more work before it can be enabled
|
||||||
|
# || [ "${UPSTREAM_ID}" = "suse" ]
|
||||||
|
sudo yum update -y
|
||||||
|
sudo yum install -y ${PREREQ} ${PREREQRPM} # git
|
||||||
|
elif [ "${ID}" = "arch" ]; then
|
||||||
|
sudo pacman -Syu
|
||||||
|
sudo pacman -S ${PREREQ} ${PREREQARCH}
|
||||||
|
else
|
||||||
|
echo "Unsupported OS"
|
||||||
|
# here you could ask the user for permission to try and install anyway
|
||||||
|
# if they say yes, then do the install
|
||||||
|
# if they say no, exit the script
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Choice for DNS or IP
|
||||||
|
PS3='Choose your preferred option, IP or DNS/Domain:'
|
||||||
|
WAN=("IP" "DNS/Domain")
|
||||||
|
select WANOPT in "${WAN[@]}"; do
|
||||||
|
case $WANOPT in
|
||||||
|
"IP")
|
||||||
|
wanip=$(dig @resolver4.opendns.com myip.opendns.com +short)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
|
||||||
|
"DNS/Domain")
|
||||||
|
echo -ne "Enter your preferred domain/dns address ${NC}: "
|
||||||
|
read wanip
|
||||||
|
#check wanip is valid domain
|
||||||
|
if ! [[ $wanip =~ ^[a-zA-Z0-9]+([a-zA-Z0-9.-]*[a-zA-Z0-9]+)?$ ]]; then
|
||||||
|
echo -e "${RED}Invalid domain/dns address${NC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*) echo "invalid option $REPLY";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# Make Folder /opt/rustdesk/
|
||||||
|
if [ ! -d "/opt/rustdesk" ]; then
|
||||||
|
echo "Creating /opt/rustdesk"
|
||||||
|
sudo mkdir -p /opt/rustdesk/
|
||||||
|
fi
|
||||||
|
sudo chown "${uname}" -R /opt/rustdesk
|
||||||
|
cd /opt/rustdesk/ || exit 1
|
||||||
|
|
||||||
|
#Download latest version of Rustdesk
|
||||||
|
RDLATEST=$(curl https://api.github.com/repos/rustdesk/rustdesk-server/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
wget "https://github.com/rustdesk/rustdesk-server/releases/download/${RDLATEST}/rustdesk-server-linux-amd64.zip"
|
||||||
|
unzip rustdesk-server-linux-amd64.zip
|
||||||
|
mv amd64/* /opt/rustdesk/
|
||||||
|
chmod +x /opt/rustdesk/hbbs
|
||||||
|
chmod +x /opt/rustdesk/hbbr
|
||||||
|
|
||||||
|
|
||||||
|
# Make Folder /var/log/rustdesk/
|
||||||
|
if [ ! -d "/var/log/rustdesk" ]; then
|
||||||
|
echo "Creating /var/log/rustdesk"
|
||||||
|
sudo mkdir -p /var/log/rustdesk/
|
||||||
|
fi
|
||||||
|
sudo chown "${uname}" -R /var/log/rustdesk/
|
||||||
|
|
||||||
|
# Setup Systemd to launch hbbs
|
||||||
|
rustdesksignal="$(cat << EOF
|
||||||
|
[Unit]
|
||||||
|
Description=Rustdesk Signal Server
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
LimitNOFILE=1000000
|
||||||
|
ExecStart=/opt/rustdesk/hbbs -k _
|
||||||
|
WorkingDirectory=/opt/rustdesk/
|
||||||
|
User=${uname}
|
||||||
|
Group=${uname}
|
||||||
|
Restart=always
|
||||||
|
StandardOutput=append:/var/log/rustdesk/signalserver.log
|
||||||
|
StandardError=append:/var/log/rustdesk/signalserver.error
|
||||||
|
# Restart service after 10 seconds if node service crashes
|
||||||
|
RestartSec=10
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
)"
|
||||||
|
echo "${rustdesksignal}" | sudo tee /etc/systemd/system/rustdesksignal.service > /dev/null
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable rustdesksignal.service
|
||||||
|
sudo systemctl start rustdesksignal.service
|
||||||
|
|
||||||
|
# Setup Systemd to launch hbbr
|
||||||
|
rustdeskrelay="$(cat << EOF
|
||||||
|
[Unit]
|
||||||
|
Description=Rustdesk Relay Server
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
LimitNOFILE=1000000
|
||||||
|
ExecStart=/opt/rustdesk/hbbr -k _
|
||||||
|
WorkingDirectory=/opt/rustdesk/
|
||||||
|
User=${uname}
|
||||||
|
Group=${uname}
|
||||||
|
Restart=always
|
||||||
|
StandardOutput=append:/var/log/rustdesk/relayserver.log
|
||||||
|
StandardError=append:/var/log/rustdesk/relayserver.error
|
||||||
|
# Restart service after 10 seconds if node service crashes
|
||||||
|
RestartSec=10
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
)"
|
||||||
|
echo "${rustdeskrelay}" | sudo tee /etc/systemd/system/rustdeskrelay.service > /dev/null
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable rustdeskrelay.service
|
||||||
|
sudo systemctl start rustdeskrelay.service
|
||||||
|
|
||||||
|
while ! [[ $CHECK_RUSTDESK_READY ]]; do
|
||||||
|
CHECK_RUSTDESK_READY=$(sudo systemctl status rustdeskrelay.service | grep "Active: active (running)")
|
||||||
|
echo -ne "Rustdesk Relay not ready yet...${NC}\n"
|
||||||
|
sleep 3
|
||||||
|
done
|
||||||
|
|
||||||
|
pubname=$(find /opt/rustdesk -name "*.pub")
|
||||||
|
key=$(cat "${pubname}")
|
||||||
|
|
||||||
|
rm rustdesk-server-linux-amd64.zip
|
||||||
|
|
||||||
|
# Choice for DNS or IP
|
||||||
|
PS3='Please choose if you want to download configs and install HTTP server:'
|
||||||
|
EXTRA=("Yes" "No")
|
||||||
|
select EXTRAOPT in "${EXTRA[@]}"; do
|
||||||
|
case $EXTRAOPT in
|
||||||
|
"Yes")
|
||||||
|
|
||||||
|
# Create windows install script
|
||||||
|
wget https://raw.githubusercontent.com/dinger1986/rustdeskinstall/master/WindowsAgentAIOInstall.ps1
|
||||||
|
sudo sed -i "s|wanipreg|${wanip}|g" WindowsAgentAIOInstall.ps1
|
||||||
|
sudo sed -i "s|keyreg|${key}|g" WindowsAgentAIOInstall.ps1
|
||||||
|
|
||||||
|
# Create linux install script
|
||||||
|
wget https://raw.githubusercontent.com/dinger1986/rustdeskinstall/master/linuxclientinstall.sh
|
||||||
|
sudo sed -i "s|wanipreg|${wanip}|g" linuxclientinstall.sh
|
||||||
|
sudo sed -i "s|keyreg|${key}|g" linuxclientinstall.sh
|
||||||
|
|
||||||
|
# Download and install gohttpserver
|
||||||
|
# Make Folder /opt/gohttp/
|
||||||
|
if [ ! -d "/opt/gohttp" ]; then
|
||||||
|
echo "Creating /opt/gohttp"
|
||||||
|
sudo mkdir -p /opt/gohttp/
|
||||||
|
sudo mkdir -p /opt/gohttp/public
|
||||||
|
fi
|
||||||
|
sudo chown "${uname}" -R /opt/gohttp
|
||||||
|
cd /opt/gohttp
|
||||||
|
GOHTTPLATEST=$(curl https://api.github.com/repos/codeskyblue/gohttpserver/releases/latest -s | grep "tag_name"| awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
wget "https://github.com/codeskyblue/gohttpserver/releases/download/${GOHTTPLATEST}/gohttpserver_${GOHTTPLATEST}_linux_amd64.tar.gz"
|
||||||
|
tar -xf gohttpserver_${GOHTTPLATEST}_linux_amd64.tar.gz
|
||||||
|
|
||||||
|
# Copy Rustdesk install scripts to folder
|
||||||
|
mv /opt/rustdesk/WindowsAgentAIOInstall.ps1 /opt/gohttp/public/
|
||||||
|
mv /opt/rustdesk/linuxclientinstall.sh /opt/gohttp/public/
|
||||||
|
|
||||||
|
# Make gohttp log folders
|
||||||
|
if [ ! -d "/var/log/gohttp" ]; then
|
||||||
|
echo "Creating /var/log/gohttp"
|
||||||
|
sudo mkdir -p /var/log/gohttp/
|
||||||
|
fi
|
||||||
|
sudo chown "${uname}" -R /var/log/gohttp/
|
||||||
|
|
||||||
|
rm gohttpserver_"${GOHTTPLATEST}"_linux_amd64.tar.gz
|
||||||
|
|
||||||
|
# Setup Systemd to launch Go HTTP Server
|
||||||
|
gohttpserver="$(cat << EOF
|
||||||
|
[Unit]
|
||||||
|
Description=Go HTTP Server
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
LimitNOFILE=1000000
|
||||||
|
ExecStart=/opt/gohttp/gohttpserver -r ./public --port 8000 --auth-type http --auth-http admin:${admintoken}
|
||||||
|
WorkingDirectory=/opt/gohttp/
|
||||||
|
User=${uname}
|
||||||
|
Group=${uname}
|
||||||
|
Restart=always
|
||||||
|
StandardOutput=append:/var/log/gohttp/gohttpserver.log
|
||||||
|
StandardError=append:/var/log/gohttp/gohttpserver.error
|
||||||
|
# Restart service after 10 seconds if node service crashes
|
||||||
|
RestartSec=10
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
)"
|
||||||
|
echo "${gohttpserver}" | sudo tee /etc/systemd/system/gohttpserver.service > /dev/null
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable gohttpserver.service
|
||||||
|
sudo systemctl start gohttpserver.service
|
||||||
|
|
||||||
|
|
||||||
|
echo -e "Your IP/DNS Address is ${wanip}"
|
||||||
|
echo -e "Your public key is ${key}"
|
||||||
|
echo -e "Install Rustdesk on your machines and change your public key and IP/DNS name to the above"
|
||||||
|
echo -e "You can access your install scripts for clients by going to http://${wanip}:8000"
|
||||||
|
echo -e "Username is admin and password is ${admintoken}"
|
||||||
|
|
||||||
|
echo "Press any key to finish install"
|
||||||
|
while [ true ] ; do
|
||||||
|
read -t 3 -n 1
|
||||||
|
if [ $? = 0 ] ; then
|
||||||
|
exit ;
|
||||||
|
else
|
||||||
|
echo "waiting for the keypress"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
|
||||||
|
"No")
|
||||||
|
echo -e "Your IP/DNS Address is ${wanip}"
|
||||||
|
echo -e "Your public key is ${key}"
|
||||||
|
echo -e "Install Rustdesk on your machines and change your public key and IP/DNS name to the above"
|
||||||
|
|
||||||
|
echo "Press any key to finish install"
|
||||||
|
while [ true ] ; do
|
||||||
|
read -t 3 -n 1
|
||||||
|
if [ $? = 0 ] ; then
|
||||||
|
exit ;
|
||||||
|
else
|
||||||
|
echo "waiting for the keypress"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
*) echo "invalid option $REPLY";;
|
||||||
|
esac
|
||||||
|
done
|
111
linuxclientinstall.sh
Normal file
111
linuxclientinstall.sh
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
uname=$(whoami)
|
||||||
|
admintoken=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c8)
|
||||||
|
|
||||||
|
|
||||||
|
# identify OS
|
||||||
|
if [ -f /etc/os-release ]; then
|
||||||
|
# freedesktop.org and systemd
|
||||||
|
. /etc/os-release
|
||||||
|
OS=$NAME
|
||||||
|
VER=$VERSION_ID
|
||||||
|
|
||||||
|
UPSTREAM_ID=${ID_LIKE,,}
|
||||||
|
|
||||||
|
# Fallback to ID_LIKE if ID was not 'ubuntu' or 'debian'
|
||||||
|
if [ "${UPSTREAM_ID}" != "debian" ] && [ "${UPSTREAM_ID}" != "ubuntu" ]; then
|
||||||
|
UPSTREAM_ID="$(echo ${ID_LIKE,,} | sed s/\"//g | cut -d' ' -f1)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
elif type lsb_release >/dev/null 2>&1; then
|
||||||
|
# linuxbase.org
|
||||||
|
OS=$(lsb_release -si)
|
||||||
|
VER=$(lsb_release -sr)
|
||||||
|
elif [ -f /etc/lsb-release ]; then
|
||||||
|
# For some versions of Debian/Ubuntu without lsb_release command
|
||||||
|
. /etc/lsb-release
|
||||||
|
OS=$DISTRIB_ID
|
||||||
|
VER=$DISTRIB_RELEASE
|
||||||
|
elif [ -f /etc/debian_version ]; then
|
||||||
|
# Older Debian/Ubuntu/etc.
|
||||||
|
OS=Debian
|
||||||
|
VER=$(cat /etc/debian_version)
|
||||||
|
elif [ -f /etc/SuSe-release ]; then
|
||||||
|
# Older SuSE/etc.
|
||||||
|
OS=SuSE
|
||||||
|
VER=$(cat /etc/SuSe-release)
|
||||||
|
elif [ -f /etc/redhat-release ]; then
|
||||||
|
# Older Red Hat, CentOS, etc.
|
||||||
|
OS=RedHat
|
||||||
|
VER=$(cat /etc/redhat-release)
|
||||||
|
else
|
||||||
|
# Fall back to uname, e.g. "Linux <version>", also works for BSD, etc.
|
||||||
|
OS=$(uname -s)
|
||||||
|
VER=$(uname -r)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install Rustdesk
|
||||||
|
echo "Installing Rustdesk"
|
||||||
|
if [ "${ID}" = "debian" ] || [ "$OS" = "Ubuntu" ] || [ "$OS" = "Debian" ] || [ "${UPSTREAM_ID}" = "ubuntu" ] || [ "${UPSTREAM_ID}" = "debian" ]; then
|
||||||
|
wget https://github.com/rustdesk/rustdesk/releases/download/1.1.9/rustdesk-1.1.9.deb
|
||||||
|
sudo apt install -fy ./rustdesk-1.1.9.deb
|
||||||
|
elif [ "$OS" = "CentOS" ] || [ "$OS" = "RedHat" ] || [ "${UPSTREAM_ID}" = "rhel" ] ; then
|
||||||
|
wget https://github.com/rustdesk/rustdesk/releases/download/1.1.9/rustdesk-1.1.9.rpm
|
||||||
|
sudo yum localinstall ./rustdesk-1.1.9.rpm
|
||||||
|
else
|
||||||
|
echo "Unsupported OS"
|
||||||
|
# here you could ask the user for permission to try and install anyway
|
||||||
|
# if they say yes, then do the install
|
||||||
|
# if they say no, exit the script
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
rustdesk --password ${admintoken}
|
||||||
|
sudo pkill -f "rustdesk"
|
||||||
|
|
||||||
|
# Setup Rustdesk in user profile
|
||||||
|
rustdesktoml2a="$(cat << EOF
|
||||||
|
rendezvous_server = 'wanipreg'
|
||||||
|
nat_type = 1
|
||||||
|
serial = 3
|
||||||
|
|
||||||
|
[options]
|
||||||
|
rendezvous-servers = 'rs-ny.rustdesk.com,rs-sg.rustdesk.com,rs-cn.rustdesk.com'
|
||||||
|
key = 'keyreg'
|
||||||
|
custom-rendezvous-server = 'wanipreg'
|
||||||
|
api-server = 'https://wanipreg'
|
||||||
|
relay-server = 'wanipreg'
|
||||||
|
EOF
|
||||||
|
)"
|
||||||
|
echo "${rustdesktoml2a}" | sudo tee /home/${uname}/.config/rustdesk/RustDesk2.toml > /dev/null
|
||||||
|
|
||||||
|
# Setup Rustdesk in root profile
|
||||||
|
rustdesktoml2b="$(cat << EOF
|
||||||
|
rendezvous_server = 'wanipreg'
|
||||||
|
nat_type = 1
|
||||||
|
serial = 3
|
||||||
|
|
||||||
|
[options]
|
||||||
|
rendezvous-servers = 'rs-ny.rustdesk.com,rs-sg.rustdesk.com,rs-cn.rustdesk.com'
|
||||||
|
key = 'keyreg'
|
||||||
|
custom-rendezvous-server = 'wanipreg'
|
||||||
|
api-server = 'https://wanipreg'
|
||||||
|
relay-server = 'wanipreg'
|
||||||
|
EOF
|
||||||
|
)"
|
||||||
|
echo "${rustdesktoml2b}" | sudo tee /root/.config/rustdesk/RustDesk2.toml > /dev/null
|
||||||
|
|
||||||
|
sudo chown ${uname}:${uname} /home/${uname}/.config/rustdesk/RustDesk2.toml
|
||||||
|
|
||||||
|
|
||||||
|
sudo systemctl restart rustdesk
|
||||||
|
|
||||||
|
echo "ID & Password for Rustdesk ${uname} are:"
|
||||||
|
grep -w id /home/${uname}/.config/rustdesk/RustDesk.toml
|
||||||
|
grep -w password /home/${uname}/.config/rustdesk/RustDesk.toml
|
||||||
|
|
||||||
|
echo "ID & Password for Rustdesk (root) are:"
|
||||||
|
sudo grep -w id /root/.config/rustdesk/RustDesk.toml
|
||||||
|
sudo grep -w password /root/.config/rustdesk/RustDesk.toml
|
11
publish.sh
Executable file
11
publish.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
name="$(head -1 container-name)"
|
||||||
|
docker_username="$(head -1 username)"
|
||||||
|
|
||||||
|
docker login
|
||||||
|
docker buildx build -t "${docker_username}/${name}:latest" --platform linux/amd64,linux/arm64,linux/arm/v7 --push .
|
||||||
|
|
||||||
|
set +x
|
21
start-gohttpserver.sh
Executable file
21
start-gohttpserver.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
. /.env
|
||||||
|
|
||||||
|
PORT="8000"
|
||||||
|
ADMIN_USER="admin"
|
||||||
|
ADMIN_TOKEN="1234"
|
||||||
|
|
||||||
|
if [ -f "/http_port" ];then
|
||||||
|
PORT=$(head -1 /http_port)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "/admin_user" ];then
|
||||||
|
ADMIN_USER=$(head -1 /admin_user)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "/admin_token" ];then
|
||||||
|
ADMIN_TOKEN=$(head -1 /admin_pass)
|
||||||
|
fi
|
||||||
|
|
||||||
|
/opt/rustdesk/gohttpserver -r /public --port ${PORT} --auth-type http --auth-http ${ADMIN_USER}:${ADMIN_TOKEN}
|
12
start-hbbr.sh
Executable file
12
start-hbbr.sh
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
. /.env
|
||||||
|
cd /data
|
||||||
|
|
||||||
|
ENCRYPT_PARAMS=""
|
||||||
|
|
||||||
|
if [ "${ENCRYPTED_ONLY}" = "1" ];then
|
||||||
|
ENCRYPT_PARAMS="-k _"
|
||||||
|
fi
|
||||||
|
|
||||||
|
/opt/rustdesk/hbbr ${ENCRYPT_PARAMS}
|
19
start-hbbs.sh
Executable file
19
start-hbbs.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
. /.env
|
||||||
|
|
||||||
|
cd /data
|
||||||
|
|
||||||
|
ENCRYPT_PARAMS=""
|
||||||
|
RELAY_PARAM=""
|
||||||
|
|
||||||
|
if [ "${ENCRYPTED_ONLY}" = "1" ];then
|
||||||
|
ENCRYPT_PARAMS="-k _"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "${RELAY}" ];then
|
||||||
|
RELAY_PARAM="-r ${RELAY}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
/opt/rustdesk/hbbs ${RELAY_PARAM} ${ENCRYPT_PARAMS}
|
||||||
|
|
98
start.sh
Executable file
98
start.sh
Executable file
@ -0,0 +1,98 @@
|
|||||||
|
#!/usr/sh
|
||||||
|
|
||||||
|
env > /.env
|
||||||
|
chmod +x /.env
|
||||||
|
|
||||||
|
cd /data
|
||||||
|
|
||||||
|
pubkey="/data/id_ed25519.pub"
|
||||||
|
secret="/data/id_ed25519"
|
||||||
|
|
||||||
|
NO_PUB_KEY="1"
|
||||||
|
NO_SECRET="1"
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -z "${PUBLIC_KEY}" ];then
|
||||||
|
if [ ! -z "${SECRET}" ];then
|
||||||
|
echo -n "${PUBLIC_KEY}" > "${pubkey}"
|
||||||
|
echo -n "${SECRET}" > "${secret}"
|
||||||
|
else
|
||||||
|
echo "Environment don't have a: SECRET variable"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Environment don't have a: PUBLIC_KEY variable"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "${pubkey}" ];then
|
||||||
|
NO_PUB_KEY="0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "${secret}" ];then
|
||||||
|
NO_SECRET="0"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${NO_PUB_KEY}${NO_SECRET}" | grep "00"
|
||||||
|
if [ "$?" -gt "0" ];then
|
||||||
|
echo "Generatiing a new key pair"
|
||||||
|
KEY_PAIR=$(/opt/rustdesk/rustdesk-utils genkeypair )
|
||||||
|
PUBLIC_KEY=$(echo "${KEY_PAIR}"|head -1 |awk '{print $3}')
|
||||||
|
SECRET=$(echo "${KEY_PAIR}"|tail -1 |awk '{print $3}')
|
||||||
|
echo -n "${PUBLIC_KEY}" > "${pubkey}"
|
||||||
|
echo -n "${SECRET}" > "${secret}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
/opt/rustdesk/rustdesk-utils validatekeypair $(cat ${pubkey}) $(cat ${secret})
|
||||||
|
if [ "$?" -gt "0" ];then
|
||||||
|
echo "public key and secret are not valid, exiting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
key=$(cat "${pubkey}")
|
||||||
|
echo "PUB Key: ${key}"
|
||||||
|
echo "${key}" > /public/pub-key
|
||||||
|
|
||||||
|
if [ ! -z "${IP}" ];then
|
||||||
|
echo "${IP}" > /public/ip
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "${DOMAIN}" ];then
|
||||||
|
echo "${DOMAIN}" > /public/domain
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "${HTTP_ADMIN_PASS}" ];then
|
||||||
|
echo "${HTTP_ADMIN_PASS}" > /admin_pass
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "${HTTP_ADMIN_USER}" ];then
|
||||||
|
echo "${HTTP_ADMIN_USER}" > /admin_user
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "${HTTP_PORT}" ];then
|
||||||
|
echo "${HTTP_PORT}" > /http_port
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "/public/ip" ];then
|
||||||
|
echo "Generating Windows and Linux client agent installtion script"
|
||||||
|
wanip="$( head -1 /public/ip)"
|
||||||
|
if [ -f "/public/domain" ];then
|
||||||
|
wanip="$( head -1 /public/domain)"
|
||||||
|
fi
|
||||||
|
WINDOWS_PS_INSTALLER_NAME="WindowsAgentAIOInstall.ps1"
|
||||||
|
WINDOWS_PS_INSTALLER_TEMPLATE="/data/${WINDOWS_PS_INSTALLER_NAME}"
|
||||||
|
|
||||||
|
sed -e "s|wanipreg|${wanip}|g" -e "s|keyreg|${key}|g" "${WINDOWS_PS_INSTALLER_TEMPLATE}" > "/public/${WINDOWS_PS_INSTALLER_NAME}"
|
||||||
|
|
||||||
|
LINUX_SH_INSTALLER_NAME="linuxclientinstall.sh"
|
||||||
|
LINUX_SH_INSTALLER_TEMPLATE="/data/${LINUX_SH_INSTALLER_NAME}"
|
||||||
|
|
||||||
|
sed -e "s|wanipreg|${wanip}|g" -e "s|keyreg|${key}|g" "${LINUX_SH_INSTALLER_TEMPLATE}" > "/public/${LINUX_SH_INSTALLER_NAME}"
|
||||||
|
else
|
||||||
|
echo "Couldn't generate installtion script since the file: /public/ip doesn't exist, you need to define the IP environment varialbe"
|
||||||
|
echo "If you wish to override the IP with a domain name define both the IP and the DOMAIN variable"
|
||||||
|
fi
|
||||||
|
|
||||||
|
chmod +x /opt/rustdesk/gohttpserver
|
||||||
|
chmod +x /opt/rustdesk/hbbs
|
||||||
|
chmod +x /opt/rustdesk/hbbr
|
||||||
|
|
||||||
|
/usr/bin/supervisord -c /etc/supervisord.conf
|
42
supervisord.conf
Normal file
42
supervisord.conf
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
[unix_http_server]
|
||||||
|
file=/tmp/supervisor.sock
|
||||||
|
|
||||||
|
[supervisorctl]
|
||||||
|
serverurl=unix:///tmp/supervisor.sock
|
||||||
|
|
||||||
|
[rpcinterface:supervisor]
|
||||||
|
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
|
||||||
|
|
||||||
|
[supervisord]
|
||||||
|
nodaemon=true
|
||||||
|
user=root
|
||||||
|
minfds=1024
|
||||||
|
minprocs=200
|
||||||
|
|
||||||
|
[program:gothttp]
|
||||||
|
command=/bin/sh /start-gohttpserver.sh
|
||||||
|
directory=/opt/rustdesk/
|
||||||
|
user=root
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
|
||||||
|
[program:hbbr]
|
||||||
|
command=/bin/sh /start-hbbr.sh
|
||||||
|
directory=/data
|
||||||
|
user=root
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
|
||||||
|
[program:hbbs]
|
||||||
|
command=/bin/sh /start-hbbs.sh
|
||||||
|
directory=/data
|
||||||
|
user=root
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
||||||
|
|
||||||
|
[program:get_key_daemon]
|
||||||
|
command=/bin/sh /get-key-daemon.sh
|
||||||
|
directory=/data
|
||||||
|
user=root
|
||||||
|
autostart=true
|
||||||
|
autorestart=true
|
22
windowsclientID.ps1
Normal file
22
windowsclientID.ps1
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
$ErrorActionPreference= 'silentlycontinue'
|
||||||
|
# Get RustDesk ID
|
||||||
|
|
||||||
|
If (!("C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml")) {
|
||||||
|
$username = ((Get-WMIObject -ClassName Win32_ComputerSystem).Username).Split('\')[1]
|
||||||
|
$rustid=(Get-content C:\Users\$username\AppData\Roaming\RustDesk\config\RustDesk.toml | Where-Object { $_.Contains("id") })
|
||||||
|
$rustid = $rustid.Split("'")[1]
|
||||||
|
$rustpword = (Get-content C:\Users\$username\AppData\Roaming\RustDesk\config\RustDesk.toml | Where-Object { $_.Contains("password") })
|
||||||
|
$rustpword = $rustpword.Split("'")[1]
|
||||||
|
Write-output "Config file found in user folder"
|
||||||
|
Write-output "$rustid"
|
||||||
|
Write-output "$rustpword"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$rustid=(Get-content C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml | Where-Object { $_.Contains("id") })
|
||||||
|
$rustid = $rustid.Split("'")[1]
|
||||||
|
$rustpword = (Get-content C:\Windows\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config\RustDesk.toml | Where-Object { $_.Contains("password") })
|
||||||
|
$rustpword = $rustpword.Split("'")[1]
|
||||||
|
Write-output "Config file found in windows service folder"
|
||||||
|
Write-output "$rustid"
|
||||||
|
Write-output "$rustpword"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user