Friday, March 30, 2012

Setting up shellinabox

So I was trying to find a web based terminal program. I'd used Ajaxterm a while back and it does work but is quite clunky. Anyway, I found shellinabox and set it up to test it. It's a straight configure , make , make install type installation. The first time I tried it using the "shellinaboxd -s /:LOGIN" example, it gave me an error about certificate.pem. I ended up following these instructions (repeated below) to generate the self signed certificate.pem;
# cd /var/lib/shellinabox
# openssl genrsa -des3 -out server.key 1024
# openssl req -new -key server.key -out server.csr
# cp server.key server.key.org
# openssl rsa -in server.key.org -out server.key
# openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
# cat server.crt server.key > certificate.pem
And with shellinabox compiled, as root you can run it like so;
   shellinabox -c /var/lib/shellinabox -s /:LOGIN
Then point a browser at https://yourserver:4200 and you should have a login prompt. The first thing I noticed is that the terminal font is quite large. You're meant to be able to adjust this using a user supplied css file. eg.
   shellinaboxd -c /var/lib/shellinabox/ --user-css /:+notpablo.css -s /:LOGIN
I could never get the font and line height to adjust properly (and I read Issue 68 a few times). What ended up working for me was to change the styles.css directly and recompile shellinabox;
cd ~/shellinabox-2.10/shellinaboxvi styles.css and add in the font-size lines highlighted below
#vt100 #console, #vt100 #alt_console, #vt100 #cursor, #vt100 #lineheight {
font-family: "DejaVu Sans Mono", "Everson Mono", FreeMono, "Andale Mono", "Lucida Console", monospace;
font-size: 8pt;
}
#vt100 #lineheight {
position: absolute;
visibility: hidden;
}
#vt100 #cursor {
position: absolute;
font-size: 8pt;
left: 0px;
top: 0px;
overflow: hidden;
z-index: 1;
}