This commit is contained in:
root 2024-07-09 20:39:53 +03:00
commit c54a8b0e05
9 changed files with 116 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
id_ed25519*
db_v2*

30
Makefile Normal file
View File

@ -0,0 +1,30 @@
all:
echo OK
install:
mkdir -p /opt/rustdesk
cp -vf hbbs /opt/rustdesk/
chmod +x /opt/rustdesk/hbbs
cp -vf hbbr /opt/rustdesk/
chmod +x /opt/rustdesk/hbbr
cp -vf rustdesk-utils /opt/rustdesk/
chmod +x /opt/rustdesk/rustdesk-utils
cp -vf hbbr.service /etc/systemd/system/
cp -vf hbbs.service /etc/systemd/system/
cp -vf hbbs.default /etc/default/hbbs
mkdir -p /var/log/rustdesk
systemctl daemon-reload
enable:
systemctl enable hbbs hbbr
start:
systemctl start hbbs hbbr
stop:
systemctl stop hbbs hbbr
restart: stop start
disable:
systemctl disable hbbs hbbr

37
gen-keys.sh Executable file
View 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
hbbr Executable file

Binary file not shown.

23
hbbr.service Normal file
View 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

BIN
hbbs Executable file

Binary file not shown.

2
hbbs.default Normal file
View File

@ -0,0 +1,2 @@
ALWAYS_USE_RELAY=Y
RELAY_SERVERS=rd.ngtech.co.il

22
hbbs.service Normal file
View File

@ -0,0 +1,22 @@
[Unit]
Description=Rustdesk Signal Server
After=network.target
[Service]
Type=simple
LimitNOFILE=1000000
User=root
Group=root
EnvironmentFile=/etc/default/hbbs
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

BIN
rustdesk-utils Executable file

Binary file not shown.