Record of some of the computer tech I deal with so that it's documented at least somewhere.

Wednesday, 30 September 2009

PXE booting QEMU in Debian

The PXE booting in Debian QEMU is broken

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=412010

You need the pxe-* files from http://trac.kju-app.org/browser/trunk/qemu/qemu/pc-bios?rev=106

and put them in /usr/share/qemu

That's all well and good but it uses QEMU's DHCP values for the TFTP server etc. so you need *another* qemu running as the TFTP server and that's not what I want.

So, next step is trying gpxe, so it's off to http://rom-o-matic.net/gpxe/ and got the all-drivers version.

Dammit, I can get 9pxeload working but not bootp so I get boot from ether0 but it can't see 10.0.0.9 from 10.0.2.2

bah

Monday, 21 September 2009

markdown to pdf

pandoc seems interesting. The debian package didn't satisfy its dependencies though.

first up is texlive-latex-base, only 138Mb!

% markdown2pdfrkdown2pdf ./werc.cat-v.org/docs/web_server_setup/lighttpd.md
markdown2pdf: pdfLaTeX failed with error code 1
markdown2pdf: error context:
! LaTeX Error: File `ucs.sty' not found.

! Emergency stop.


! ==> Fatal error occurred, no output PDF file produced!
markdown2pdf: Please install the 'unicode' package from CTAN:
http://www.ctan.org/tex-archive/macros/latex/contrib/unicode/


ffs, thats no help, check the page out, it assumes one knows what's going on.

ok, on to htmldoc

sigh, another program that ignores pipes by default HELLO THIS IS UNIX

markdown.pl ./werc.cat-v.org/docs/web_server_setup/lighttpd.md| htmldoc --book --footer . -f output.pdf -

works good enough, some font embedding issues but not fatal, though to get it in a pipeline you need to give it an output file with .pdf at the end, IDIOTS

#!/usr/local/plan9/bin/rc
markdown.pl $1 | htmldoc --book --footer . -f /tmp/md2pdf.$pid.pdf -
cat /tmp/md2pdf.$pid.pdf
rm -f /tmp/md2pdf.$pid.pdf

Tuesday, 15 September 2009

DNDR dns caching proxy

Although that sounds dangerously like a DNS server I just couldn't face bind/named.

Curiously it's not an OpenBSD binary package, I wonder if there's a reason for that.

http://sourceforge.net/projects/dnrd/
untar it then
./configure && make && make install
adduser dnrd
mkdir /usr/local/etc/dnrd
mv /usr/local/share/man/man8/dnrd.8 /usr/share/man/man8/dnrd.8

It will proxy DNS from the IP you specifiy on the command line with -s (required) and also serve out entries on a hosts like file : /usr/local/etc/dnrd/master
so for me it's
/usr/local/sbin/dnrd -b -s 85.189.102.5 -s 85.189.39.5
The -b tells it to round robin the -s entries
ooh why haven't I got round to doing it before, it's fabbo, another one to go in the box marked "essential".

Curiously the master file is only used when -d [1-4] is specified (it doesn't daemonize)
Then because loads of debug is spewing out I ended up installing rc-1.6-readline. I really need to get p9p sorted out.

pkg_add ftp://ftp.plig.net/pub/OpenBSD/snapshots/packages/i386/rc-1.6-readline.tgz
In the meantime at least I can write sane code.

Sunday, 13 September 2009

OpenBSD firewall

Installed 4.6 on my EPIA 5000 fanless & the HD I have in it is too noisy so I want to run it read only.
I've already posted about /etc/pf.conf

I've enabled syslogd on momo to accept udp syslog posts (syslogd -u) which uses UDP 514

Then in the firewall (goo) I've changed /etc/syslog.conf to send all syslog messages to @momo

Easy peasy.

Next is to mount the filesystems read only which I found here.

change fstab to something like this :
/dev/wd0a / ffs ro,noatime 1 1
swap /tmp mfs rw,noatime,nodev,nosuid,-s=20000 0 0
swap /var mfs rw,noatime,nodev,nosuid,-s=40000 0 0
swap /dev mfs rw,noatime,nosuid,noexec,-s=20000 0 0

do this patch
cp /etc/rc /etc/rc.orig && echo '/fastboot.*XXX
a
mtree -qdef /etc/mtree/4.4BSD.dist -p / -u
cp /root/MAKEDEV /dev; cd /dev; sh MAKEDEV all
.
w
q' | ed /etc/rc



to make changes later
mount -u -o rw / unless, like me, your CF card reader has a RO jumper !! lucky me
mount -u -o ro / to make it ro again.
I got rid of /usr/ports and ended up with about 500Mb of disk used, so I'm well under the 1Gb target. And I've got stuff on there from where I was putting Mercurial on.

Filesystem Size Used Avail Capacity Mounted on
/dev/wd0a 158M 32.9M 117M 22% /
/dev/wd0g 3.5G 3.4M 3.3G 0% /home
/dev/wd0f 3.5G 490M 2.9G 14% /usr
mfs:30180 9.3M 37.0K 8.8M 0% /dev
mfs:17306 9.3M 21.0K 8.8M 0% /tmp
mfs:28721 18.8M 1.2M 16.7M 7% /var