Backlog

Port number declared in a variable

0 vote

avatar

Hi!

Would you be able to make port field to be configurable with {variable} ? I do understand that currently port field accept only ints. Perhaps you can add support so it can accept variables as well?

I have a use-case where I want to re-use "SSH Tunnel" connection for various types of connections - SSH, RDP, HTTPS... So my thinking is to make in parent connections CUSTOM_FIELD1 and 2 to be port numbers (local & remote), then invoke SSH Tunnel connection where I would reference {PARENT_CUSTOM_FIELD1} and {2} in port fields. That would allow to re-use the same "SSH Tunnel" for multiple connections/purposes.

Thanks!

All Comments (3)

avatar

Hello,


If you only need to have a variable for the "main" port of an entry, we have the "Custom host port" field located in the advanced settings:


Does that help for your scenario or do you need more than that?


Regards,

Hubert Mireault

avatar

Hi Hubert,


I am not sure what that option "Custom host port" is supposed to do? Is that for declaring a port of the SSH Tunnel host?

Anyway I tried to put there {PARENT_CUSTOM_FIELD3} which is equal to port 8839 on the parent connection (just for the sake of testing) but I don't think "SSH Tunnel" connection inherited anything when I triggered that connection, it still built tunnel from localhost port 8443 to remote host port 443 which is how it is configured.


Just to make it a bit clearer-

Parent session:

Type: Website. Name "WEB" with host 127.0.0.1 port 8443.

CUSTOM_FIELD1: 20.20.20.13

Connection over VPN/SSH/Gateway: Existing SSH, Session: "SSHTUN"


Child session:

Type: SSH Tunnel. Name "SSHTUN". Host: 10.10.10.1.

Outgoing Tunnel Settings: Mode: Local, Local address: 127.0.0.1, Local port 8443; Remote host: $PARENT_CUSTOM_FIELD1$, Remote port: 443


So, when I am opening "WEB" session it invokes child session "SSHTUN". Once tunnel from localhost:8443 to 20.20.20.13:443 is built webpage is accessible on 127.0.0.1:8443.


My question is, if I want to create WEB2 session which should talk to 20.20.20.155 on port 8080 but to re-use existing SSHTUN how can I achieve that if under SSHTUN "Remote port" is hardcoded to port 443?

My thinking would be to set "CUSTOM_FIELD2" to 8080 in parent and then reference that as {PARENT_CUSTOM_FIELD2} in child (SSHTUN session) to be used as Remote port, but I can't.


Please advise if there are anything else can be done. And I hope above is clear :)

avatar

Thank you for the details, I think I understand what you mean. Then no, the "custom host port" alone wouldn't work for your scenario, since it wouldn't modify the right port in your case anyway.



I don't think there's a simple way to 'automate' this at the moment. I'll open a ticket but it's not a trivial change.


Regards,

Hubert Mireault