Android and Linux

Sunday, January 22, 2012

ssh problem with Locale Execute Plugin

I recently found ssh commands to be flaky when running them with the Locale Execute Plugin for Tasker. A check of the log showed a couple interesting lines:

D/LocaleExecute( 7130): stderr: ssh: Warning: Reading the random source seems to have blocked.
D/LocaleExecute( 7130): stderr: If you experience problems, you probably need to find a better entropy source.

/dev/random is a random number generator that keeps a pool of random bits for use in cryptography, but it uses computer activity to generate them and if the computer isn't active enough, it will block the sending of random bits until it gets some more.

/dev/urandom is more foolproof in operation because, when it runs out of random bits from computer activity, it generates some more on it's own, but if an attacker knew the algorithms used by urandom, they could in theory use that to hack anything replying on urandom as an entropy source. But as the man pages say "Knowledge of how to do this is not available in the current unclassified literature, but it is theoretically possible that such an attack may exist. If this is a concern in your application, use /dev/random instead."

Unless you think the NSA is trying to crask the ssh link between your phone and computer, it should be safe to link /dev/random to /dev/urandom.

cd /dev
mv random random.bak
ln -s urandom random

I don't know why this problem only manifested itself when ssh was ran with the Locale Execute Plugin. I assume when ran from a terminal, the terminal app was creating enough noise for the kernel to keep the entropy pool filled or something.