Search code examples
sshfirewallircnathole-punching

If possible--how to use an irc server (like gmail chat or facebook) to establish ssh connection between two hosts behind firewalls


I have been looking around for a solution that implements this, but google always gives me tutorials on establishing a live chat over an ssh tunnel--not the other way around. I suspect this can be implemented just using tunnels (if it is possible at all), but I am not sure how.

I am sorry if this has been asked, but after looking through the related questions, but I have not been able to find one that I can be sure will work for my particular needs (i.e. I cannot create an ssh session directly with gmail.com etc.) If I am wrong, please just post a link to the applicable question.


Solution

  • If you can establish connections between peers via your IRC channel, then there is a solution.

    1. Don't try to fiddle with IRC itself, but build a solution on top of it.
    2. Use ssh yourself on top of IRC.
    3. I mean create a SSH/SSL connection to a dummy socket you can use to intercept the data sent by SSH. Transform this data (if necessary) to make it transportable via IRC. And send it to the remote peer via IRC.
    4. On the remote peer, intercept your data, un-transform it before giving it to your ssh/ssl connection listener. And proceed the same way to send response.
    5. If the connection is successful ssh will tell you and your can start pouring your data through this secure 'channel'.

    Your data going via IRC will be safe, because ssh is.