Archived
1
0
This commit is contained in:
MatMoul 2025-08-22 01:58:38 +02:00
parent 0d5cf8f506
commit 8448282afa

View File

@ -11,13 +11,13 @@ function showHelp() {
#echo " stop profile|port target|tmpFile"
echo "proxy:"
echo " profile Name of the profile (~/.config/ssh-proxy/*)"
echo " port Proxy local port"
echo " port Proxy local port"
echo " target Proxy target [user@]server[:port]"
#echo " tmpFile Proxy instance pid file (/tmp/ssh-proxy/*)"
}
if [ "${1}" == "" ]; then
showHelp
showHelp
exit 1
fi
case ${1} in
@ -32,8 +32,8 @@ case ${1} in
;;
esac
if [ "${2}" == "" ]; then
showHelp
exit 1
showHelp
exit 1
fi
LOCAL_PORT=0
@ -104,10 +104,10 @@ function startProxy() {
exit 1
fi
echo "Start proxy ${LOCAL_PORT}"
if ! ssh -fND 127.0.0.1:"${LOCAL_PORT}" "${PROXY_USER}"@"${PROXY_SERVER}" -p "${PROXY_SERVER_PORT}"; then
echo "Error: Proxy start error"
exit 1
fi
if ! ssh -fND 127.0.0.1:"${LOCAL_PORT}" "${PROXY_USER}"@"${PROXY_SERVER}" -p "${PROXY_SERVER_PORT}"; then
echo "Error: Proxy start error"
exit 1
fi
PID=$(lsof -i -P | grep ":${LOCAL_PORT} (LISTEN)" | awk -F ' ' '{print $2}')
if [ "${PID}" == "" ]; then
echo "Error: No PID found"
@ -137,7 +137,7 @@ function stopProxy() {
}
case ${1} in
"start") startProxy;;
"start") startProxy;;
"stop") stopProxy;;
*) exit 1;;
esac