diff --git a/Create-Remote-User.bash b/Create-Remote-User.bash index a21247f..469b894 100755 --- a/Create-Remote-User.bash +++ b/Create-Remote-User.bash @@ -32,7 +32,7 @@ Host ${SSH_HOST} LogLevel INFO EOF -ssh ${REMOTE_USER_TO_CREATE}@${SSH_HOST} -f "echo export PATH=$PATH:~/.bin > ~/." +ssh ${REMOTE_USER_TO_CREATE}@${SSH_HOST} -f "mkdir ~/.bin" ssh ${REMOTE_USER_TO_CREATE}@${SSH_HOST} -f "echo export PATH=$PATH:~/.bin > ~/.bash_profile" echo diff --git a/Install-SteamCMD.bash b/Install-SteamCMD.bash index 3268309..e055856 100755 --- a/Install-SteamCMD.bash +++ b/Install-SteamCMD.bash @@ -14,4 +14,5 @@ cat << 'EOF' > /usr/sbin/steamcmd /home/Steam/steamcmd.sh "$@" EOF +chmod 755 /usr/sbin/steamcmd /usr/sbin/steamcmd +quit diff --git a/Port-Forward.bash b/Port-Forward.bash new file mode 100755 index 0000000..cce82f5 --- /dev/null +++ b/Port-Forward.bash @@ -0,0 +1,73 @@ +#!/bin/bash --posix + +set -e + +IP="" +INBOUND_PORT="" +FORWARD_PORT="" + +usage() { + printf "%s" "Usage: + --ip + The ip address to forward data to + Example: + --ip 192.168.10.11 + --inbound-port + The port that data will be received on + Example: + --inbound-port 22 + --forward-port + The port that data will be forwarded to + Example: + --forward-port 2020 + + All above flags must be passed with arguments" +} + + +error() { + printf '%s\n' "$1" >&2 + exit 1 +} + +while :; do + case $1 in + -h|-\?|--help) + usage # Display a usage synopsis. + exit + ;; + --) # End of all options. + shift + break + ;; + --ip) + shift + [[ "${1}" == "" ]] && error "--ip requires an argument" + IP=${1} + ;; + --inbound-port) + shift + [[ "${1}" == "" ]] && error "--inbound-port requires an argument" + INBOUND_PORT=${1} + ;; + --forward-port) + shift + [[ "${1}" == "" ]] && error "--forward-port requires an argument" + FORWARD_PORT=${1} + ;; + -?*) + printf 'Unknown option: %s\n' "$1" >&2 + usage + ;; + *) # Default case: No more options, so break out of the loop. + break + esac + + shift +done + +firewall-cmd --permanent --add-forward-port=port="${INBOUND_PORT}":proto=tcp:toaddr="${IP}":toport="${FORWARD_PORT}" +firewall-cmd --permanent --add-port="${INBOUND_PORT}"/tcp +firewall-cmd --add-masquerade + +echo "Routing all data on ${INBOUND_PORT} to ${IP}${FORWARD_PORT}" \ No newline at end of file