1
This commit is contained in:
commit
31c4ef2c89
63
Makefile
Normal file
63
Makefile
Normal file
@ -0,0 +1,63 @@
|
||||
all:
|
||||
echo OK
|
||||
|
||||
install: install-rustdek install-services generate-keypair
|
||||
|
||||
install-rustdek:
|
||||
mkdir -p /opt/rustdesk
|
||||
cp -vf bin/hbbr /opt/rustdesk/
|
||||
cp -vf bin/hbbs /opt/rustdesk/
|
||||
cp -vf bin/rustdesk-utils /opt/rustdesk/
|
||||
cp -vf bin/gen-keys.sh /opt/rustdesk/
|
||||
mkdir -p /var/log/rustdesk
|
||||
|
||||
install-services:
|
||||
cp -vf hbbr.service /etc/systemd/system/
|
||||
cp -vf hbbs.service /etc/systemd/system/
|
||||
systemctl daemon-reload
|
||||
|
||||
generate-keypair:
|
||||
/opt/rustdesk/gen-keys.sh
|
||||
|
||||
generate-new-keypair: cleanup-old-keys generate-keypair
|
||||
|
||||
|
||||
start:
|
||||
systemctl start hbbr hbbs
|
||||
|
||||
stop:
|
||||
systemctl stop hbbr hbbs;true
|
||||
|
||||
enable:
|
||||
systemctl enable hbbr hbbs
|
||||
|
||||
disable:
|
||||
systemctl disable hbbr hbbs
|
||||
|
||||
status:
|
||||
systemctl status hbbr hbbs
|
||||
|
||||
|
||||
cleanup-old-settings:
|
||||
rm -vf /opt/rustdesk/db_v2.*
|
||||
|
||||
cleanup-old-keys:
|
||||
rm -vf /opt/rustdesk/id_ed25519*
|
||||
|
||||
cleanup-old-services: stop
|
||||
rm -vf /etc/systemd/system/hbbr.service;true
|
||||
rm -vf /etc/systemd/system/hbbs.service;true
|
||||
|
||||
cleanup-binaries:
|
||||
rm -vf /opt/rustdesk/hbbr
|
||||
rm -vf /opt/rustdesk/hbbs
|
||||
rm -vf /opt/rustdesk/gen-keys.sh
|
||||
rm -vf /opt/rustdesk/rustdesk-utils
|
||||
|
||||
cleanup-logs:
|
||||
rm -vf /var/log/rustdesk/*.log
|
||||
|
||||
distclean: cleanup-old-services cleanup-old-settings cleanup-old-keys cleanup-binaries
|
||||
|
||||
download:
|
||||
bash download-latest.sh
|
37
bin/gen-keys.sh
Executable file
37
bin/gen-keys.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
public_key="/opt/rustdesk/id_ed25519.pub"
|
||||
private_key="/opt/rustdesk/id_ed25519"
|
||||
|
||||
function genNewKeys() {
|
||||
echo "Generatiing a new key pair"
|
||||
KEY_PAIR=$(/opt/rustdesk/rustdesk-utils genkeypair )
|
||||
PUBLIC_KEY=$(echo "${KEY_PAIR}"|head -1 |awk '{print $3}')
|
||||
PRIVATE_KEY=$(echo "${KEY_PAIR}"|tail -1 |awk '{print $3}')
|
||||
echo -n "${PUBLIC_KEY}" > "${public_key}"
|
||||
echo -n "${PRIVATE_KEY}" > "${private_key}"
|
||||
}
|
||||
|
||||
function validateNewKeys() {
|
||||
PUBLIC_KEY=$(cat "${public_key}" 2>/dev/null)
|
||||
PRIVATE_KEY=$(cat "${private_key}" 2>/dev/null )
|
||||
/opt/rustdesk/rustdesk-utils validatekeypair "${PUBLIC_KEY}" "${PRIVATE_KEY}"
|
||||
}
|
||||
|
||||
stat "${public_key}" >/dev/null 2>&1
|
||||
stat "${private_key}" >/dev/null 2>&1
|
||||
|
||||
valid_key_pair="0"
|
||||
|
||||
while [[ "$valid_key_pair" != "1" ]]; do
|
||||
validateNewKeys | grep "^Key pair is VALID" >/dev/null
|
||||
if [ "$?" -eq "0" ];then
|
||||
echo "Foudn the keys to be VALID"
|
||||
valid_key_pair="1"
|
||||
else
|
||||
echo "Found the keys to be invalid"
|
||||
valid_key_pair="0"
|
||||
genNewKeys
|
||||
fi
|
||||
|
||||
done
|
BIN
bin/rustdesk-utils
Executable file
BIN
bin/rustdesk-utils
Executable file
Binary file not shown.
11
download-latest.sh
Executable file
11
download-latest.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
URL="https://github.com/rustdesk/rustdesk-server/releases/download/1.1.7-4/rustdesk-server-linux-amd64.zip"
|
||||
|
||||
wget "${URL}" -O "rustdesk-server-linux-amd64.zip"
|
||||
|
||||
unzip "rustdesk-server-linux-amd64.zip"
|
||||
|
||||
mkdir -p bin
|
||||
mv -v amd64/* bin/
|
||||
rmdir -v amd64
|
23
hbbr.service
Normal file
23
hbbr.service
Normal file
@ -0,0 +1,23 @@
|
||||
[Unit]
|
||||
Description=RustDesk Relay Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
Group=root
|
||||
|
||||
#Environment="KEY_PRIV=private_key_text"
|
||||
#Environment="KEY_PUB=pub_key_text"
|
||||
|
||||
LimitNOFILE=1000000
|
||||
|
||||
WorkingDirectory=/opt/rustdesk/
|
||||
ExecStart=/opt/rustdesk/hbbr -k _
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
StandardOutput=append:/var/log/rustdesk/relayserver.log
|
||||
StandardError=append:/var/log/rustdesk/relayserver.error
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
26
hbbs.service
Normal file
26
hbbs.service
Normal file
@ -0,0 +1,26 @@
|
||||
[Unit]
|
||||
Description=Rustdesk Signal Server
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
LimitNOFILE=1000000
|
||||
User=root
|
||||
Group=root
|
||||
|
||||
Environment="ALWAYS_USE_RELAY=Y"
|
||||
Environment="RELAY_SERVERS=www.ngtech.co.il,192.168.200.114"
|
||||
|
||||
#Environment="KEY_PRIV=private_key_text"
|
||||
#Environment="KEY_PUB=pub_key_text"
|
||||
|
||||
WorkingDirectory=/opt/rustdesk/
|
||||
ExecStart=/opt/rustdesk/hbbs -k _
|
||||
StandardOutput=append:/var/log/rustdesk/signalserver.log
|
||||
StandardError=append:/var/log/rustdesk/signalserver.error
|
||||
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user