From 619f756e115948e95f0ae3e51f170fc79a558b29 Mon Sep 17 00:00:00 2001 From: Starfall Date: Thu, 15 Dec 2022 11:41:35 -0600 Subject: diabloii-tunnel: port forward over ssh for diablo ii tcp/ip games --- diabloii-tunnel | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 diabloii-tunnel diff --git a/diabloii-tunnel b/diabloii-tunnel new file mode 100755 index 0000000..bde7906 --- /dev/null +++ b/diabloii-tunnel @@ -0,0 +1,30 @@ +#!/usr/bin/env -S zsh -eu + +service=diabloii +pubkey="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHVMEkZQ+dGB/wwc/Mo7Ejp8QXH9XpUWXKf7RixjBsJO minnow@regulus" +port=4000 + +echo "Creating user..." +adduser --system --shell /bin/false --disabled-password $service + +echo "Creating .ssh directory..." +mkdir /home/$service/.ssh +chown $service:nogroup /home/$service/.ssh +chmod 700 /home/$service/.ssh + +echo "Adding pubkey..." +echo pubkey > /home/$service/.ssh/authorized_keys +chown $service:nogroup /home/$service/.ssh/authorized_keys +chmod 600 /home/$service/.ssh/authorized_keys + +echo "Configuring firewall (ufw)..." +ufw allow in $port/tcp comment "$service" + +echo "Configuring sshd..." +echo "" >> /etc/ssh/sshd_config +echo "Match User $service" >> /etc/ssh/sshd_config +echo " GatewayPorts clientspecified" >> /etc/ssh/sshd_config + +echo "Done setting up ssh tunnel." +echo "On your local machine, use this command to port forward:" +echo "ssh -N -R :$port:localhost:$port $service@starfall.systems &" -- cgit