Can agents connect to the server via SSH tunnel?

Can I configure the agent such that it registers with the server with an address
that can be reached by the server when using an SSH tunnel to connect to the server (like the SSH DISPLAY environment variable for X forwarding?)

The scenario is that there's an agent installed on my laptop and I am connecting
to our server via an SSH tunnel. I can port forward the outgoing connection OK,
but the agent registers with a particular network interface address which of course
is not reachable by the server. If I could configure the agent to register with an
address like localhost:agentPort I can configure SSH to forward connections back
to my laptop...



Comment actions Permalink

Unfortunately, it is not possible to use SSH tunneling between agent and server.


Comment actions Permalink

I know this question is extremely old and documentation for TC 2017.1 shows how to configure proxy but there actually is a way to use ssh tunneling for server-to-agent connection. 

1. on agent host install autossh and configure reverse tunnel for server to reach the agent 

2. edit and set ownPort and ownAddress to match reverse tunnel above e.g.:

Each agent needs a different port than the default 9090 because the TC server will see all agents to be hosted on the localhost. 


The second tunnel (L localhost:8111:localhost:8111) is for agent-to-server connection. to use it change serverURL in

Comment actions Permalink

Thanks a lot for your comment! :)


In fact, the recent versions of TeamCity do not require server to agent communication, only agent to server.

I.e. TeamCity server does not connect to agent's port (but this port is still used for inter-process agent communication).

Thus, the configuration should work without reverse tunnel from server to agent.




Please sign in to leave a comment.