The concept of a Network Console on Acid is documented at http://www.xenoclast.org/nca/ but we found a couple of problems using that code. The version of openssh distributed with that is rather old and didn't like running on our newer machines. We kept the nca part of the distribution and adjusted dropbear to run it instead.
Rather than distributing binaries, here are the (very small) adjustments to be made to the dropbear source:
- Line 454 of common-session.c:
ses.authstate.pw_gid = pw->pw_gid; ses.authstate.pw_name = m_strdup(pw->pw_name); //ses.authstate.pw_dir = m_strdup(pw->pw_dir); ses.authstate.pw_dir = "/etc/ncad"; ses.authstate.pw_shell = m_strdup(pw->pw_shell);
which has the effect of always checking /etc/ncad/.ssh/authorized_keys for login.
- Line 902 of svr-chansession.c:
//usershell = m_strdup(get_user_shell()); //run_shell_command(chansess->cmd, ses.maxfd, usershell); execv("/sbin/nca",args);
which has the effect of always running /sbin/nca as the shell.
Adjust dropbear source as above. Compile dropbear and install as /sbin/ncad. Compile nca from source - download from link above, change to nca directory and 'make'. Install as /sbin/nca. Use init.d script below - adjust where necessary - to run.
- We tried statically compiling the dropbear binary - it worked on some machines and not other. Debugging this exceeded our time limit (this was a "one day" project!) so we use a dynamically-linked ssh server (although we statically link nca
- The init.d script needs to bring up the network, so network settings are set in /etc/default/ncad. It also copies libraries into /etc/ncad if they're not stored in /lib (in case /usr isn't mounted at runtime)
- We install through a debian package, and our post-install script detects network settings and writes default settings to /etc/default/ncad.