3

I use ssh to get an encrypted connection between servers and local machines all the time. It's fast, it's secure, and there's a way to do it in nearly every system programming language that I've used so far.

My question to you is, can this simple interface be used for secure inter app communication on the same device?

I don't see any flaws with it working with android, Linux, or OS X. I would suppose operating systems like iOS have time constraints for ports being opened but even in that case all you would need to have is background app refresh enabled in order to open the receiving ports from the app being called.

Is there something wrong with my logic in this case? Everything that I've experienced with using ssh so far tells me it would work but, I would love to hear your opinions on this because I really like ssh and wouldn't mind making a little API that provides safe inter app communication.

2
  • "Is there something wrong with my logic in this case? ", yes, everything is wrong ! What on earth is the point of using a network app to communicate locally to other apps ? You would have network calls, listners all sorts of wastes of resources. There area million better ways to do what you want, that's why crypto libraries were invented ! And quite frankly, if someone has sufficient access to your server that they can monitor inter-app communications, then you've got bigger problems to deal with and should probably be reformating your server. Jun 9, 2016 at 17:13
  • @LittleCode the domain sockets mentioned below were pretty much what I was looking for at the time. Inter App communications were new to me when I asked about this and I'm now siding with just building a strong modular API to secure things between apps. Jun 9, 2016 at 21:51

3 Answers 3

3

You say "SSH is fast". It's not. It's fast enough for its intended purpose (remote shell access and occasional file transfer/sshfs) but it's definitely not fast enough for IPC, let alone efficient.

On a local machine there's never any need for encryption between processes. If an attacker can read what you're sending to localhost, he can most definitely read the entire memory and get the key to whatever crypto you're using.

You also need to consider battery life, adding (unnecessary) crypto will induce more CPU load and thus more power usage.

1
  • While you do nail the technicalities, the purpose of the question was simply to see if another layer of protection can be added if need be or if it would be a redundant effort. In terms of fast though, I meant it's fast at being implemented. Normally theres always a way to easily implement this in any programming language which is what got me wondering about this use because it could be used as an easy go to for protection in that one specific spot. Jul 27, 2015 at 10:01
3

There would never be a valid reason to use SSH for communication between processes running on the same device, unless that device was used to simulate a network, in which case it would act as multiple virtual devices anyway so technically not be the same device.

Use unix domain sockets instead. Note that domain sockets are not the same as the Secure Sockets Layer (SSL) which is used for communication over a network.

Unix domain sockets bypass the network layer altogether (which is unnecessary anyway when the processes are on the same host) so are orders of magnitude faster. Since unix sockets are treated like files, access can be controlled using standard methods.

As far as preventing eavesdropping on the communication by unauthorised processes, just as with SSH, if someone has rooted your device they can capture the messages, but of course you will have far more important things to worry about at that point anyway.

1

Try this:

ssh cody@localhost

This works for me, so it should work for you with an ssh-server installed, unless you have blocked the port.

But for what purpose - on the same device? I doubt if it would make things more secure.

7
  • Just an added layer of protection between apps. With the latest news release about Apple's inter app communication being fully open, I got to wondering about how could we guarantee its secured even if we don't know if the OS is secure Jun 26, 2015 at 8:20
  • Just wondering, but does iOS have an ssh-server available without being jailbroken?
    – SPRBRN
    Jun 26, 2015 at 10:42
  • To answer completely, yes and no. It doesn't have specifically ssh-server built into it but Swift does have an easy implementation of running commands through an ssh interface already built. I believe it was built for key authentication originally. Jun 26, 2015 at 10:45
  • I suppose an iOS app will not accept requests by other apps unless they are approved?! And how do you want to listen to the traffic between two apps? It would probably require a jailbroken device. The SSH-interface is probably only a client, not a server!
    – SPRBRN
    Jun 26, 2015 at 10:46
  • That's why apps like server auditor exist as well. Jun 26, 2015 at 10:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .