Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

custom ssh port for self hosted serveo #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions serveo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ Forwarding HTTP traffic from https://myfancyalias.serveo.net

`server` - in case you are using your own serveo instance, put its hostname here

`ssh_port` - in case your custom serveo instance is running on port other than default ssh port (i.e. 22), put it here

`port1from` - local hassio port to forward from, default `8123` forwards frontend service

`port1to` - remote serveo port to forward to, default `80` translate to 443 (https)
Expand All @@ -66,6 +68,7 @@ Forwarding HTTP traffic from https://myfancyalias.serveo.net
"alias": "myfancysubdomain",
"private_key": "",
"server": "serveo.net",
"ssh_port": 22,
"port1from": 8123,
"port1to": 80,
"port2from": 0,
Expand Down
4 changes: 3 additions & 1 deletion serveo/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Serveo Free Reverse SSL Proxy",
"version": "0.8",
"version": "0.9",
"slug": "serveo",
"description": "Expose Your hassio to the internet through SSL/HTTPS with one click thanks to SERVEO.net. You DO NOT need to: have external IP, make any router configuration (no need to forward any port), create any logins (DuckDNS and others dynamic DNS services require all this hassle).",
"url": "https://github.com/lechup/hassio-addons/tree/master/serveo",
Expand All @@ -12,6 +12,7 @@
"alias": null,
"private_key": null,
"server": "serveo.net",
"ssh_port": 22,
"port1from": 8123,
"port1to": 80,
"port2from": 0,
Expand All @@ -25,6 +26,7 @@
"alias": "str",
"private_key": "str",
"server": "str",
"ssh_port": "int",
"port1from": "int",
"port1to": "int",
"port2from": "int",
Expand Down
4 changes: 2 additions & 2 deletions serveo/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CONFIG_PATH=/data/options.json
ALIAS="$(jq --raw-output '.alias' ${CONFIG_PATH})"
PRIVATE_KEY="$(jq --raw-output '.private_key' ${CONFIG_PATH})"
SERVER="$(jq --raw-output '.server' ${CONFIG_PATH})"
SSH_PORT="$(jq --raw-output '.ssh_port' ${CONFIG_PATH})"
DOMAIN="$(jq --raw-output '.domain' ${CONFIG_PATH})"
PORT1FROM="$(jq --raw-output '.port1from' ${CONFIG_PATH})"
PORT1TO="$(jq --raw-output '.port1to' ${CONFIG_PATH})"
Expand Down Expand Up @@ -34,7 +35,6 @@ PORT1="-R ${DOMAIN}:${PORT1TO}:localhost:${PORT1FROM}"
PORT2=""
PORT3=""


if [ "${PORT2FROM}" != "0" ] && [ "${PORT2TO}" != "0" ]
then
PORT2=" -R ${DOMAIN}:${PORT2TO}:localhost:${PORT2FROM}"
Expand All @@ -45,7 +45,7 @@ then
PORT3=" -R ${DOMAIN}:${PORT3TO}:localhost:${PORT3FROM}"
fi

CMD="/bin/bash -c 'sleep ${RETRY_TIME} && ssh ${IDENTITY} -tt -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -o ServerAliveInterval=10 -o ServerAliveCountMax=3 ${PORT1}${PORT2}${PORT3} ${ALIAS}@${SERVER}'"
CMD="/bin/bash -c 'sleep ${RETRY_TIME} && ssh ${IDENTITY} -tt -o ExitOnForwardFailure=yes -o StrictHostKeyChecking=no -o ServerAliveInterval=10 -o ServerAliveCountMax=3 ${PORT1}${PORT2}${PORT3} -p ${SSH_PORT} ${ALIAS}@${SERVER}'"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added it as an optional parameter thinking that it might break for those who are using old configurations(without ssh_port parameter), after the update. Does the configuration gets updated on addon update? 🤔

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... that's a good question, I've took it for granted - with default values placed in our config.json but I need to verify it on my instance...


echo "Running '${CMD}' through supervisor!"

Expand Down