This commit is contained in:
rustdesk 2021-04-11 01:34:26 +08:00
parent 2648a45f33
commit 83f97a85fb
5 changed files with 26 additions and 8 deletions

7
spk.sh
View File

@ -6,8 +6,8 @@ cd package
mkdir bin logs config
echo port=21116 > config/hbbs.conf
echo key= >> config/hbbs.conf
echo email= >> config/hbbs.conf
echo port=21117 > config/hbbr.conf
echo key= >> config/hbbr.conf
cp ../target/release/hbbs bin/
cp ../target/release/hbbr bin/
strip bin/hbbs
@ -15,6 +15,5 @@ strip bin/hbbr
tar czf ../spk/package.tgz ./*
cd ..
cd spk
VER=1.1.3
tar cf RustDeskServer-x64-$VER.spk ./*
mv RustDeskServer-x64-$VER.spk ..
tar cf rustdesk-server-synology.spk ./*
mv rustdesk-server-synology.spk ..

View File

@ -1,6 +1,6 @@
package="RustDesk Server"
version="1.1.3"
description="RustDesk is a remote desktop software allowing your own rendezvous/relay server. It attempts to make direct connect via TCP hole punch first, and then forward via relay server if direct connection fails. 4 ports are used: NAT test port: 21115(tcp), ID/rendezvous port: 21116(tcp/udp), relay port: 21117(tcp). Key: ()"
description="RustDesk is a remote desktop software allowing your own rendezvous/relay server. It attempts to make direct connect via TCP hole punch first, and then forward via relay server if direct connection fails. 4 ports are used. NAT test port: 21115(tcp), ID/rendezvous port: 21116(tcp/udp), relay port: 21117(tcp), Email: (), Key: ()"
displayname="RustDesk Rendezvous/Relay Server"
maintainer="CarrieZ Studio"
maintainer_url="https://rustdesk.com/zh/"

View File

@ -26,15 +26,28 @@
}
}
}]
},{
"type": "textfield",
"desc": "Registered email, check http://rustdesk.com/server for more information",
"subitems": [{
"key": "email",
"desc": "Email",
"validator": {
"allowBlank": false,
"regex": {
"expr": "/^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/",
"errorText": "Invalid email format"
}
}
}]
},{
"type": "textfield",
"desc": "Only allow the client with the same key",
"subitems": [{
"key": "key",
"desc": "Key",
"defaultValue": "21117",
"validator": {
"allowBlank": True,
"allowBlank": true
}
}]
}]

View File

@ -12,6 +12,7 @@ FWFILENAME="RustDesk_Server.sc"
[ "${hbbr_port}" == "" ] && hbbr_port="21117"
[ "${hbbs_port}" == "" ] && hbbs_port="21116"
[ "${key}" == "" ] && key=""
[ "${email}" == "" ] && email=""
nat_port=`expr ${hbbs_port} - 1`
preinst() {
@ -52,12 +53,14 @@ postinst() {
sed -i "s/ID\/rendezvous port: 21116/ID\/rendezvous port: ${hbbs_port}/" "/var/packages/${PACKAGE_NAME}/INFO"
sed -i "s/NAT test port: 21115/NAT test port: ${nat_port}/" "/var/packages/${PACKAGE_NAME}/INFO"
sed -i "s/Key: ()/Key: (${key})/" "/var/packages/${PACKAGE_NAME}/INFO"
sed -i "s/Email: ()/Email: (${email})/" "/var/packages/${PACKAGE_NAME}/INFO"
sed -i "s/21117/${hbbr_port}/" "/var/packages/${PACKAGE_NAME}/scripts/${FWFILENAME}"
sed -i "s/21116/${hbbs_port}/" "/var/packages/${PACKAGE_NAME}/scripts/${FWFILENAME}"
sed -i "s/21115/${nat_port}/" "/var/packages/${PACKAGE_NAME}/scripts/${FWFILENAME}"
sed -i "s/port=[^ ]*/port=${hbbr_port}/g" "${PACKAGE_BASE}/config/hbbr.conf"
sed -i "s/port=[^ ]*/port=${hbbs_port}/g" "${PACKAGE_BASE}/config/hbbs.conf"
sed -i "s/key=[^ ]*/key=${key}/g" "${PACKAGE_BASE}/config/hbbs.conf"
sed -i "s/email=[^ ]*/email=${email}/g" "${PACKAGE_BASE}/config/hbbs.conf"
# 添加防火墙配置
cat "/var/packages/${PACKAGE_NAME}/scripts/${FWFILENAME}" >"/tmp/${FWFILENAME}"
@ -145,10 +148,12 @@ postupgrade() {
hbbs_port=`${GETKEYVALUE} "${PACKAGE_BASE}/config/hbbs.conf" port` >>/tmp/wakko.txt
nat_port=`expr ${hbbs_port} - 1`
key=`${GETKEYVALUE} "${PACKAGE_BASE}/config/hbbs.conf" key` >>/tmp/wakko.txt
email=`${GETKEYVALUE} "${PACKAGE_BASE}/config/hbbs.conf" email` >>/tmp/wakko.txt
sed -i "s/relay port: 21117/relay port: ${hbbr_port}/" "/var/packages/${PACKAGE_NAME}/INFO" >>/tmp/wakko.txt
sed -i "s/ID\/rendezvous port: 21116/ID\/rendezvous port: ${hbbs_port}/" "/var/packages/${PACKAGE_NAME}/INFO" >>/tmp/wakko.txt
sed -i "s/NAT test port: 21115/NAT test port: ${nat_port}/" "/var/packages/${PACKAGE_NAME}/INFO" >>/tmp/wakko.txt
sed -i "s/Key: ()/Key: (${key})/" "/var/packages/${PACKAGE_NAME}/INFO"
sed -i "s/Email: ()/Email: (${email})/" "/var/packages/${PACKAGE_NAME}/INFO"
sed -i "s/21117/${hbbr_port}/" "/var/packages/${PACKAGE_NAME}/scripts/${FWFILENAME}" >>/tmp/wakko.txt
sed -i "s/21116/${hbbs_port}/" "/var/packages/${PACKAGE_NAME}/scripts/${FWFILENAME}" >>/tmp/wakko.txt
sed -i "s/21115/${nat_port}/" "/var/packages/${PACKAGE_NAME}/scripts/${FWFILENAME}" >>/tmp/wakko.txt

View File

@ -12,6 +12,7 @@ HBBR_LOG="/var/log/hbbr.log"
HBBS_BIN="${PACKAGE_BASE}/bin/hbbs"
HBBS_PORT=`synogetkeyvalue "${PACKAGE_BASE}/config/hbbs.conf" port`
KEY=`synogetkeyvalue "${PACKAGE_BASE}/config/hbbs.conf" key`
EMAIL=`synogetkeyvalue "${PACKAGE_BASE}/config/hbbs.conf" email`
HBBS_LOG="/var/log/hbbs.log"
PACKAGE_ENABLED="/var/packages/${PACKAGE_NAME}/enabled"
PS_CMD="/bin/ps -w"
@ -45,7 +46,7 @@ running_hbbs() {
start() {
[ "$SYNOPKG_TEMP_LOGFILE" == "" ] && SYNOPKG_TEMP_LOGFILE="/var/log/rustdeskserver.start.log"
LANG=C cd "$PACKAGE_BASE" && (nohup "$HBBR_BIN" -p $HBBR_PORT -k "$KEY" > "$HBBR_LOG" 2>&1 &) && (nohup "$HBBS_BIN" -p $HBBS_PORT -k "$KEY" > "$HBBS_LOG" 2>&1 &)
LANG=C cd "$PACKAGE_BASE" && (nohup "$HBBR_BIN" -p $HBBR_PORT -k "$KEY" -m "$EMAIL" > "$HBBR_LOG" 2>&1 &) && (nohup "$HBBS_BIN" -p $HBBS_PORT -k "$KEY" -m "$EMAIL" > "$HBBS_LOG" 2>&1 &)
i=0