Skip to content

Instantly share code, notes, and snippets.

@dzwdz
Last active November 6, 2023 09:25
Show Gist options
  • Select an option

  • Save dzwdz/ca339b854ef8aabdcbf1ca5c510cb785 to your computer and use it in GitHub Desktop.

Select an option

Save dzwdz/ca339b854ef8aabdcbf1ca5c510cb785 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -eu
if [ ! -f /etc/spiped/sshd.key ]; then
echo generating key...
mkdir -p /etc/spiped
dd if=/dev/urandom of=/etc/spiped/sshd.key bs=32 count=1
else
echo key already present.
fi
base64 /etc/spiped/sshd.key
echo making a systemd unit...
cat <<EOF >/etc/systemd/system/spiped-sshd.service
[Unit]
Description=spiped for sshd
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/usr/bin/spiped -F -d -s '[0.0.0.0]:8022' -t '[127.0.0.1]:22' -k /etc/spiped/sshd.key
[Install]
WantedBy=multi-user.target
EOF
echo starting it...
systemctl daemon-reload
systemctl start spiped-sshd.service
systemctl enable spiped-sshd.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment