SSH tunneling Subsonic?

Need help? Post your questions here.

Moderator: moderators

SSH tunneling Subsonic?

Postby mu » Sat Mar 19, 2011 10:53 pm

Hello, I'm posting for some help with tunneling Subsonic through another server.

My current situation has it that my dorm internet is very picky about incoming connections. For example, all bittorrent downloading and uploading are blocked no matter the port. As it happens, I have access to a server that I ssh tunnel for bittorrent.

Since it seems that I cannot connect to Subsonic outside of my network, I am looking for a way to utilize my server to facilitate a connection. I'm just unclear on the correct procedure. I tried to follow this post to no avail.

Basically, to tunnel internet on this computer I start a Cygwin terminal (I'm on Windows 7) and use the command `ssh -D 9999 user@host`, and then connect with a web browser that is configured to a SOCKS localhost:9999. I've tried utilizing this same command and then configuring the port number in Subsonic Control Panel to 9999, but I don't think it is working. Neither my-server:9999, localhost:9999, localhost, or me.subsonic.org works.

So I hope this is due to an ignorance of SSH and that I am able to use Subsonic from this internet connection.

Thanks.
mu
 
Posts: 4
Joined: Sat Mar 19, 2011 10:45 pm

Postby Minime » Sun Mar 20, 2011 4:36 pm

I have ssh server already setup and though i never had a need to use it for this purpose i thought i would do a quick test to see if i could do what you want to achieve here.

As mentioned i already have ssh server running on Ubuntu 10.04 server(My subsonic server) and have X11 forwarding successfully so here is what i have done:

ssh -X -p xxxx user@ip_address

xxxx being my port number. Once i logged in with my password i run:firefox on the terminal and had it tunneled to my remote laptop and was able to log into my subsonic server through the browser, flash worked fine and tested by playing a track that seemingly played fine, but i could not hear the audio playback on my laptop. I suspect this may be down to subsonic player and could have worked if i set player to external or even jukebox in subsonic. So the theory of tunneling subsonic works i guess if you have X11 forwarding set to yes by editing the config file in: /etc/ssh/sshd_config if you haven't already. Hope that helps.
Best Regards
Minime,
-----------------------------------------------------------------
Subsonic 4.6 | Ubuntu 10.04 LTS inside a VMWare host
Galaxy SII with ICS 4.0.1 & Android App v3.0 Combo
XBMC Dharma with t0mm0-xbmc-addons
+ A few custom Mods
User avatar
Minime
 
Posts: 68
Joined: Fri Dec 17, 2010 5:19 am
Location: UK

Postby 3R3 » Tue Mar 22, 2011 9:27 am

So X11 forwarding works, but have you tried an "normal" tunnel without X11 too? This would make sound functional for sure, lower service layer ;-)
User avatar
3R3
 
Posts: 332
Joined: Mon May 04, 2009 2:09 pm
Location: Germany

Postby Skidd » Tue Mar 22, 2011 1:22 pm

The -D switch is really a SOCKS specific ssh thing. In theory though, a SOCKS server should have no problem handling subsonic traffic. Just to confirm this, I tried it on my machine and it worked fine.

I have linux running on all my machines, including my work machine here.
I tried

Code: Select all
ssh -D 9999 me@my.server


Launched firefox, setup the SOCKS port to 9999 and had no trouble getting to my subsonic music. There must be something else going wrong with your setup. Granted thought, I don't have any restrictions in accessing subsonic, so it's possible I'm getting traffic around my tunnel. I'll try cutting off my subsonic server at my firewall as an added test. I'll post up what I find.

Another thing you can try is the -L switch to access your subsonic server directly.

Code: Select all
ssh -L 4040:my.subsonic.server:4040 me@my.sshserver


Now, your local computers port 4040 will tunnel to your subsonic servers 4040 port. Launch your web browser, turn off your proxy for now, and access

Code: Select all
http://localhost:4040


You can still use both the -D and -L together to keep your SOCKS setup.

Code: Select all
ssh -L 4040:my.subsonic:4040 -D 9999 me@my.server


Just be sure to set "localhost" as a machine to NOT use the proxy for.
Skidd
 
Posts: 15
Joined: Wed Mar 09, 2011 10:07 pm

Postby Skidd » Tue Mar 22, 2011 1:36 pm

Ok.. an update for ya... I turned off my firewall tunnel of my subsonic server, cutting it off from the internet for now.

Using the -D switch and a SOCKS setup, I found that I had to use the IP address of my subsonic server instead of it's DNS name. I can't say exactly why, but firefox kept trying to go somewhere else with teh DNS named access to subsonic. I'm guessing that it's something to do with where the DNS resolution occurs. With a SOCKS setup, I expect the DNS is resolved locally, not at the remote SSH server. Thus, my local DNS server actually doesn't know about the internal name of my subsonic machine. Make sense.

P.S.
I actually prefer to use the -L option and port forward all my http traffic to a "tinyproxy" server. It's an option you might consider. It should work similar, except that the remote machine will do all your web traffic and dns access, and return the results. No local DNS lookups at all.

Code: Select all
ssh -L 8888:localhost:8888 me@mytinyproxyserver


Then, setup firefox to connect to an http proxy at localhost port 8888
Skidd
 
Posts: 15
Joined: Wed Mar 09, 2011 10:07 pm

Postby mu » Wed Mar 23, 2011 2:56 pm

Since I can't seem to get any instructions to work, let me explain further my problem and what I'm trying to accomplish:

I have a local computer running Windows 7 with all of my music on it. However, because I connect through a router that my university has control over, there are restrictions placed on my connection. While I can set up Subsonic on my local computer and connect to it via localhost, any attempt to connect to it via a computer or device outside of my network fails.

I have a server outside of my network that I have remote control over. I'm looking for a way to forward (keep in mind my terminology may not be appropriate) Subsonic's connection to my remote server, and then be able to connect to it using that server's address. For example, instead of trying to connect to [my local ip]:port and failing, I'd connect to [remote ip]:port outside the network and connect properly.

I'm using my phone, which is running the official Android Subsonic app, to try to access subsonic, not a web browser. A lot of these instructions seem to revolve around accessing this tunneled connection through a browser, which is not what I'm trying to do.

I've tried the instructions of the last few posts but I can't seem to do what I'm trying to do.
mu
 
Posts: 4
Joined: Sat Mar 19, 2011 10:45 pm

Postby alphawave7 » Wed Mar 23, 2011 5:37 pm

You will need to contact university IT and find out if ANY port can be used for your service. If not, I'm afraid your only option is to use the external server, and install Subsonic and your music on it, rather than your local machine.
alphawave7
 
Posts: 1036
Joined: Thu Feb 11, 2010 9:54 am

Postby Skidd » Thu Mar 24, 2011 8:54 pm

Ok... that's totally different!

Where is Subsonic running? on the remote server? But, your music is on the Windows 7 box inside the school router? The only way you could do that is if you tunneled SMB or something similar. If your music and subsonic are on different machines, that'll be really hard to do.

If subsonic is running on the Windows 7 box inside the school router, you can reverse tunnel via ssh to your remote server. Assuming the remote server does not have subsonic running on it.

From Windows 7 machine running Subsonic:
[code]ssh -R 192.168.0.1:4040:localhost:4040 name@remoteserver

You must replace the 192.168.0.1 IP address, to the ip address of the remote server. If you leave this part out, the reverse tunnel will only be visible to the 127.0.0.1 address. To make it visible on the remote servers network, you must includes it's IP address.

Now, port 4040 on the remote server will direct all traffic back through the SSH tunnel to your local machines port 4040 subsonic server.

Is that more what you had in mind?
Skidd
 
Posts: 15
Joined: Wed Mar 09, 2011 10:07 pm

Postby mu » Sun Mar 27, 2011 8:04 pm

Yes, my music is on the computer running Windows 7 and the Subsonic software. What you described (port 4040 on the remote server directing all traffic back through the ssh tunnel to the local machine) sounds like exactly what I want.

However, I'm still getting connection errors. I've set Subsonic to run on port 4040. My remote server's IP is 212.117.167.131. So I run:

ssh -R 212.117.167.131:4040:localhost:4040 user@remoteserver

I've tried setting up ssh before and after starting Subsonic's service; I've tried running Cygwin with administrator control, and so on, and I've been unable to connect through either my phone or my browser. localhost:4040 works fine, however.

Not sure what else to try. It would defeat the point of Subsonic if I tried to run it off the remote server (too much music anyways). I think I'll try to get cmd.exe to run ssh, but otherwise I'm open to suggestions.
mu
 
Posts: 4
Joined: Sat Mar 19, 2011 10:45 pm

Postby Skidd » Mon Mar 28, 2011 3:57 am

I gave it a test on my systems here, and it worked... then I realized, I was connecting to "localhost" on my server in my test. Connecting the external IP was not working.

Turns out by default most ssh servers disable the use of Gateway ports except on the localhost interface. If you have access, you need to modify the "sshd_config" file with the following:

GatewayPorts clientspecified


Then, restart the ssh service.

You can also simplify the SSH connection string with the following

ssh -R *:4040:0.0.0.0:4040 me@myserver


This will bind all eth interfaces to port 4040 on the remote server, and tunnel back to the local machines 4040 port.

I tried this, and it did indeed work.
Skidd
 
Posts: 15
Joined: Wed Mar 09, 2011 10:07 pm

Postby mu » Wed Mar 30, 2011 2:03 am

Yep, it works. Thanks for the help!
mu
 
Posts: 4
Joined: Sat Mar 19, 2011 10:45 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 9 guests