Tuesday, August 6, 2013

Free OpenSource Secure Voice Communication over SSH using SOX on OSX.

This post details a method to send and receive audio simply and securely over the net using opensource free standard command line tools.

What makes this approach powerful is that clients need only setup ssh key-based passwordless authentication to a trusted server of their choosing in the usual way, so that they can read from the fifo over an ssh tunnel. No proprietary closed source software or intermediary is needed for this communication, and once ssh public keys are added to .ssh/authorized_keys on the trusted host for a the given user, no man in the middle is possible.

Your system requires:
  • [sox – Sound eXchange](http://sox.sourceforge.net/) (or any tool that can pipe audio streams to plain unix fifo pipes)
  • [openssh](http://www.openssh.org/)
  • [dd] (you probably already have this, its been standard on computers since before I was born)
I use the following to make that trivial to setup
  • OSX 10.6+
  • [macports](http://sox.sourceforge.net/) sudo port install openssh
    sudo port install sox
But it’s easy to see how this could work on any linux/unix system as well.
In order to allow any computer to talk to any other its best to setup a proxy somewhere out on the net that both the client and server have ssh access to.

>First ssh to the intermediary server and make a fifo pipe that the sound will travel through:
  ssh user@myserver.com "mkfifo one_directional_voice_channel"

>Then on the sound receiving client side where you want to play the sound back:
  ssh user@myserver.com "dd if=one_directional_voice_channel" | sox -p -d --buffer 32

>Next on the sound transmission end with the microphone you want to send the audio from simply:
  sox -d -p --buffer 32 | ssh user@myserver.com "dd of=one_directional_voice_channel"

> Presto. done. On my computer, the default sound input device is the microphone so my voice immediately starts being relayed across the net to the client over the ssh tunnel.

***Well you do need to setup another channel in the other direction for two way voice communication but that's it.

Starting the client listener first ensures the buffers are empty so there is no lag between sending and receiving sound. In my tests a voice stream from my location to a server 1500km away and back has a delay of less than 1 sec.

If it's working you should see an output similar to this:


-: (sox)

  Encoding: Signed PCM
  Channels: 2 @ 32-bit
Samplerate: 44100Hz
Replaygain: off
  Duration: unknown


In:0.00% 00:10:02.08 [00:00:00.00] Out:26.6M [      |      ]        Clip:34

  • your days are numbered M$ Skype *

No comments:

Post a Comment