acomminos / Plumble-Legacy

Plumble- an enhanced Mumble app for Android.
https://play.google.com/store/apps/details?id=com.morlunk.mumbleclient
Other
58 stars 16 forks source link

Add TCP-over-SOCKS proxy support (to enable Mumble over Tor!) #60

Open n8fr8 opened 11 years ago

n8fr8 commented 11 years ago

I'm a developer with Tor Project and the Guardian Project, and we are really interested in seeing your client support proxy settings with a Force TCP-only mode.

Beyond that a simple "Use with Orbot" (our Tor for Android app) would be great to simplify setup for users (just enable TCP over SOCKS5 to localhost:9050).

We have some code here to show how to use SOCKS5 sockets properly, as well as check if Orbot is installed and running: https://github.com/guardianproject/onionkit

We may end up sending a pull request for this ourselves, but in the meantime, it would be great to have more people out there thinking about proxy support in their apps!

abeluck commented 11 years ago

I've enabled the forceTcp option in the preferences, then transparently proxied Plumble through Orbot but it crashes (see backtrace and debug log below). It seems its still trying to use UDP at some point, but we can only use TCP with Tor.

I/Plumble (19036): com.morlunk.mumbleclient.app.ConnectedActivityLogic: Connecting I/ActivityManager( 932): Displayed com.morlunk.mumbleclient/.app.ChannelActivity: +424ms I/Plumble (19036): UDP Socket opened D/Plumble (19036): <<< Version D/Plumble (19036): <<< Authenticate W/Plumble (19036): unhandled message type Version I/Plumble (19036): com.morlunk.mumbleclient.app.ConnectedActivityLogic: Synchronizing I/Plumble (19036): MumbleService: Connection state changed to Synchronizing D/Plumble (19036): MumbleConnection: CryptSetup W/Plumble (19036): unhandled message type PermissionQuery D/Plumble (19036): <<< UDPTunnel D/Plumble (19036): >>> ServerSync D/Plumble (19036): <<< UserState W/Plumble (19036): unhandled message type SuggestConfig E/Plumble (19036): Error while sending message: sendto failed: EPERM (Operation not permitted) E/Plumble (19036): java.net.SocketException: sendto failed: EPERM (Operation not permitted) E/Plumble (19036): at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:506) E/Plumble (19036): at libcore.io.IoBridge.sendto(IoBridge.java:475) E/Plumble (19036): at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:182) E/Plumble (19036): at java.net.DatagramSocket.send(DatagramSocket.java:284) E/Plumble (19036): at com.morlunk.mumbleclient.service.MumbleConnection.sendUdpMessage(MumbleConnection.java:455) E/Plumble (19036): at com.morlunk.mumbleclient.service.PingThread.run(PingThread.java:33) E/Plumble (19036): at java.lang.Thread.run(Thread.java:856) E/Plumble (19036): Caused by: libcore.io.ErrnoException: sendto failed: EPERM (Operation not permitted) E/Plumble (19036): at libcore.io.Posix.sendtoBytes(Native Method) E/Plumble (19036): at libcore.io.Posix.sendto(Posix.java:151) E/Plumble (19036): at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:177) E/Plumble (19036): at libcore.io.IoBridge.sendto(IoBridge.java:473) E/Plumble (19036): ... 5 more I/Plumble (19036): com.morlunk.mumbleclient.app.ConnectedActivityLogic: Connected E/Plumble (19036): Error reading socket E/Plumble (19036): java.net.PortUnreachableException: E/Plumble (19036): at libcore.io.IoBridge.maybeThrowAfterRecvfrom(IoBridge.java:556) E/Plumble (19036): at libcore.io.IoBridge.recvfrom(IoBridge.java:516) E/Plumble (19036): at java.net.PlainDatagramSocketImpl.doRecv(PlainDatagramSocketImpl.java:161) E/Plumble (19036): at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:169) E/Plumble (19036): at java.net.DatagramSocket.receive(DatagramSocket.java:253) E/Plumble (19036): at com.morlunk.mumbleclient.service.MumbleConnection$UdpSocketReader.process(MumbleConnection.java:127) E/Plumble (19036): at com.morlunk.mumbleclient.service.MumbleSocketReader$1.run(MumbleSocketReader.java:26) E/Plumble (19036): at java.lang.Thread.run(Thread.java:856) E/Plumble (19036): Caused by: libcore.io.ErrnoException: recvfrom failed: ECONNREFUSED (Connection refused) E/Plumble (19036): at libcore.io.Posix.recvfromBytes(Native Method) E/Plumble (19036): at libcore.io.Posix.recvfrom(Posix.java:136) E/Plumble (19036): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:164) E/Plumble (19036): at libcore.io.IoBridge.recvfrom(IoBridge.java:513) E/Plumble (19036): ... 6 more D/dalvikvm(19036): GC_CONCURRENT freed 301K, 4% free 10145K/10476K, paused 5ms+6ms, total 53ms I/Plumble (19036): MumbleService: Connection state changed to Connected W/System.err(19036): java.lang.InterruptedException W/System.err(19036): at java.lang.VMThread.sleep(Native Method) W/System.err(19036): at java.lang.Thread.sleep(Thread.java:1031) W/System.err(19036): at java.lang.Thread.sleep(Thread.java:1013) W/System.err(19036): at com.morlunk.mumbleclient.service.PingThread.run(PingThread.java:45) W/System.err(19036): at java.lang.Thread.run(Thread.java:856) I/Plumble (19036): com.morlunk.mumbleclient.app.ConnectedActivityLogic: Disconnected W/dalvikvm(19036): threadid=12: thread exiting with uncaught exception (group=0x42096930) E/AndroidRuntime(19036): FATAL EXCEPTION: AsyncTask #4 E/AndroidRuntime(19036): java.lang.RuntimeException: An error occured while executing doInBackground() E/AndroidRuntime(19036): at android.os.AsyncTask$3.done(AsyncTask.java:299) E/AndroidRuntime(19036): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) E/AndroidRuntime(19036): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) E/AndroidRuntime(19036): at java.util.concurrent.FutureTask.run(FutureTask.java:239) E/AndroidRuntime(19036): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) E/AndroidRuntime(19036): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) E/AndroidRuntime(19036): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) E/AndroidRuntime(19036): at java.lang.Thread.run(Thread.java:856) E/AndroidRuntime(19036): Caused by: java.lang.NullPointerException E/AndroidRuntime(19036): at com.morlunk.mumbleclient.service.MumbleService.sendAccessTokens(MumbleService.java:720) E/AndroidRuntime(19036): at com.morlunk.mumbleclient.app.ChannelActivity$9.doInBackground(ChannelActivity.java:663) E/AndroidRuntime(19036): at com.morlunk.mumbleclient.app.ChannelActivity$9.doInBackground(ChannelActivity.java:1) E/AndroidRuntime(19036): at android.os.AsyncTask$2.call(AsyncTask.java:287) E/AndroidRuntime(19036): at java.util.concurrent.FutureTask.run(FutureTask.java:234) E/AndroidRuntime(19036): ... 4 more W/ActivityManager( 932): Force finishing activity com.morlunk.mumbleclient/.app.ChannelActivity I/Plumble (19036): MumbleService: Connection state changed to Disconnected W/System.err(19036): java.net.SocketException: sendto failed: EPERM (Operation not permitted) W/System.err(19036): at libcore.io.IoBridge.maybeThrowAfterSendto(IoBridge.java:506) W/System.err(19036): at libcore.io.IoBridge.sendto(IoBridge.java:475) W/System.err(19036): at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java:182) W/System.err(19036): at java.net.DatagramSocket.send(DatagramSocket.java:284) W/System.err(19036): at com.morlunk.mumbleclient.app.ServerList$ServerInfoTask.doInBackground(ServerList.java:198) W/System.err(19036): at com.morlunk.mumbleclient.app.ServerList$ServerInfoTask.doInBackground(ServerList.java:1) W/System.err(19036): at android.os.AsyncTask$2.call(AsyncTask.java:287) W/System.err(19036): at java.util.concurrent.FutureTask.run(FutureTask.java:234) W/System.err(19036): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) W/System.err(19036): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) W/System.err(19036): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) W/System.err(19036): at java.lang.Thread.run(Thread.java:856) W/System.err(19036): Caused by: libcore.io.ErrnoException: sendto failed: EPERM (Operation not permitted) W/System.err(19036): at libcore.io.Posix.sendtoBytes(Native Method) W/System.err(19036): at libcore.io.Posix.sendto(Posix.java:151) W/System.err(19036): at libcore.io.BlockGuardOs.sendto(BlockGuardOs.java:177) W/System.err(19036): at libcore.io.IoBridge.sendto(IoBridge.java:473) W/System.err(19036): ... 10 more I/Mumble (19036): mService set I/Plumble (19036): com.morlunk.mumbleclient.app.ConnectedActivityLogic: Disconnected

acomminos commented 11 years ago

Hi,

I believe a UDP ping is still sent when Force TCP is enabled. I'll see if I can eliminate that and get back to you.

Thanks for your interest!

Andrew

n8fr8 commented 11 years ago

Yeah, the basic threat model here is that the Mumble server a user is trying to connect to is either A) blocked or B) under surveillance of some sort. This means, we want no packets flowing directly between the user/client and the server directly.

Great work by the way. Really happy to discover someone took up the mantle of keeping this app going. I think selling in Google Play, but also being open-source makes a lot of sense. Do you have also have a donation/tip jar somewhere?

acomminos commented 11 years ago

Very interesting. I'd love to help you guys get this going- later today I'll make a branch with a TCP-only mode working. I'll post in the thread when I do.

I've added a donate link to the repo's README BTW, if you are interested.

Zuko commented 11 years ago

First of all you should fix udp connection in android 4.0.4 24 sty 2013 18:59, "Andrew Comminos" notifications@github.com napisał(a):

Very interesting. I'd love to help you guys get this going- later today I'll make a branch with a TCP-only mode working. I'll post in the thread when I do.

I've added a donate link to the repo's README BTW, if you are interested.

— Reply to this email directly or view it on GitHubhttps://github.com/Morlunk/Plumble/issues/60#issuecomment-12664108.

acomminos commented 11 years ago

@Zuko, I have a local change that I hope will fix that issue already. I haven't pushed it yet as it causes a little bit of instability with maintaining connection state. I'll throw it into that branch tonight and you can test it if you'd like.

Zuko commented 11 years ago

Ok 24 sty 2013 19:06, "Andrew Comminos" notifications@github.com napisał(a):

@Zuko https://github.com/Zuko, I have a local change that I hope will fix that issue already. I haven't pushed it yet as it causes a little bit of instability with maintaining connection state. I'll throw it into that branch tonight and you can test it if you'd like.

— Reply to this email directly or view it on GitHubhttps://github.com/Morlunk/Plumble/issues/60#issuecomment-12664458.

acomminos commented 11 years ago

@n8fr8 or @abeluck; can you please check out branch netfix and see if it fixes this issue. I'm still investigating issues with UDP connections on lower Android versions.

Thanks!

Zuko commented 11 years ago

plumble from "netfix" branch, crash on start (after adding the server)

abeluck commented 11 years ago

This looks way better than the hack I cooked up :)

It seems to mostly work too. With this branch, I was able to connect to our mumble server with Force TCP enabled and Orbot doing full transparent proxying. Waiting for my colleagues to come online so I can test with voice.

There is one problem: I keep getting disconnected after 30seconds to a minute. Here's the log:

I/Plumble ( 3808): UDP Socket opened I/Plumble ( 3808): com.morlunk.mumbleclient.app.ConnectedActivityLogic: Synchronizing I/Plumble ( 3808): MumbleService: Connection state changed to Synchronizing D/Plumble ( 3808): <<< Version D/Plumble ( 3808): <<< Authenticate W/Plumble ( 3808): unhandled message type Version D/Plumble ( 3808): MumbleConnection: CryptSetup I/Plumble ( 3808): Experimental opus support enabled. W/Plumble ( 3808): unhandled message type PermissionQuery D/Plumble ( 3808): <<< UDPTunnel D/Plumble ( 3808): >>> ServerSync D/Plumble ( 3808): <<< UserState I/Plumble ( 3808): com.morlunk.mumbleclient.app.ConnectedActivityLogic: Connected W/Plumble ( 3808): unhandled message type SuggestConfig I/Plumble ( 3808): Selected recording sample rate: 48000 D/Plumble ( 3808): <<< Authenticate .... E/Plumble ( 3808): Error reading socket E/Plumble ( 3808): java.io.EOFException E/Plumble ( 3808): at libcore.io.Streams.readFully(Streams.java:83) E/Plumble ( 3808): at java.io.DataInputStream.readShort(DataInputStream.java:169) E/Plumble ( 3808): at com.morlunk.mumbleclient.service.MumbleConnection$TcpSocketReader.process(MumbleConnection.java:87) E/Plumble ( 3808): at com.morlunk.mumbleclient.service.MumbleSocketReader$1.run(MumbleSocketReader.java:26) E/Plumble ( 3808): at java.lang.Thread.run(Thread.java:856) E/Plumble ( 3808): Connection lost W/System.err( 3808): java.lang.InterruptedException W/System.err( 3808): at java.lang.VMThread.sleep(Native Method) W/System.err( 3808): at java.lang.Thread.sleep(Thread.java:1031) W/System.err( 3808): at java.lang.Thread.sleep(Thread.java:1013) W/System.err( 3808): at com.morlunk.mumbleclient.service.PingThread.run(PingThread.java:47) W/System.err( 3808): at java.lang.Thread.run(Thread.java:856) I/Plumble ( 3808): com.morlunk.mumbleclient.app.ConnectedActivityLogic: Disconnected I/Plumble ( 3808): MumbleService: Connection state changed to Disconnected

huertanix commented 11 years ago

I installed Plumble from the Play Store so I'm not sure if I have the latest and greatest, but I don't see a menu to set a proxy in Plumble's settings. Is this feature currently pending release?

acomminos commented 11 years ago

Functionality is underway in the Jumble repository, which will be used in a future release of Plumble. Thanks for your patience!

huertanix commented 11 years ago

@Morlunk Awesome, looking forward to the next release! :)