ca-cas: Start adding support for non-TTY operation

I'd like to make a proper TCP server out of this, so support for arbitrary
command sockets is needed.

Signed-off-by: Morten Hustveit <morten.hustveit@gmail.com>