Skip to content

Instantly share code, notes, and snippets.

@p120ph37
Created June 19, 2020 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save p120ph37/5b473f9cbb8f7801c2db9f397a96f997 to your computer and use it in GitHub Desktop.
Save p120ph37/5b473f9cbb8f7801c2db9f397a96f997 to your computer and use it in GitHub Desktop.
Stuntman install for CentOS
yum install -y curl make gcc-c++ boost-devel openssl-devel
curl http://www.stunprotocol.org/stunserver-1.2.16.tgz | tar -xz
cd stunserver
make
cp stunserver /usr/sbin
cat - >/etc/init.d/stunserver <<'END'
#!/bin/sh
# chkconfig: 345 91 09
### BEGIN INIT INFO
# Provides: stunserver
# Required-Start: $network
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Description: Suntman STUN server
### END INIT INFO
PROG_BIN=/usr/sbin/stunserver
PROG_ARGS=
PROG_NAME=$(basename $PROG_BIN)
PID_FILE=/var/run/$PROG_NAME.pid
RUN_USER=root
. /etc/rc.d/init.d/functions
case "$1" in
start)
echo -n "Starting $PROG_NAME: "
daemon --user "$RUN_USER" --pidfile "$PID_FILE" "
nohup $PROG_BIN $PROG_ARGS >/dev/null 2>&1 &
echo \$! >$PID_FILE
"
if [ $? = 0 ]; then
success
else
failure
fi
echo
;;
stop)
echo -n "Shutting down $PROG_NAME: "
killproc -p $PID_FILE -b $PROG_BIN $PROG_NAME
;;
restart)
$0 stop
$0 start
;;
status)
status -p $PID_FILE -b $PROG_BIN $PROG_NAME
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $?
END
chmod 755 /etc/init.d/stunserver
chkconfig --add stunserver
service stunserver start
./stunclient 127.0.0.1 # just to check that it's responding
@p120ph37
Copy link
Author

You can run this in one line as follows (assuming you have curl installed):

curl https://gist.githubusercontent.com/p120ph37/5b473f9cbb8f7801c2db9f397a96f997/raw/install_stuntman.sh | bash -

@ewerkhoven
Copy link

nice

@aatherall
Copy link

Very nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment