README file for the Xenoboot CD
-------------------------------

The Xenoboot CD is designed to allow centralised control of server
booting over the internet.  

IP address allocation, etc. is done by a local dhcpd, then higher
level control comes from the central boot servers over the WAN.
Specifically, the CD boots to linux, then requests a script from the
bootserver (using SOAP over HTTP/S), and runs it.

The CD contains a copy of the Erik Arjan Hendriks's "Two kernel Monte"
module, which allows it to boot another kernel from the running
system.

Because the CD boots to a full linux environment, the boot scripts
supplied by the server can checksum and reinstall other parts of the
filesystem, kernels, etc. before continuing the boot process.  This
allows remote recovery even if the local filesystem is trashed.  The
idea is that the Xenoboot CD is left in the drive and becomes a part
of the normal boot sequence of the remotely administered machine.

Obviously, for complete remote recovery, some sort of watchdog or
remote reset switch is needed to fix wedged machines.


1) Building.

The factory.sh script script will tailor and build an ISO image from the 
unpacked filesystem.


2) Boot sequence.

The Xenoboot CD boots to a ramdisk (isolinux/initrd.gz), scans the PCI
bus and loads whatever drivers look plausible.  At this stage it also
mounts procfs on /proc, and the main CD filesystem on /usr, then
passes control to /usr/bootme/bootscript.

/usr/bootme/bootscript tries to bring up an ethernet interface,
invokes dhcpcd to configure it, and puts some basic iptables packet
filters in place.

If that succeeds, it finds all the IP addresses of the boot server
from DNS, and for each address it runs /usr/bootme/soapclient.pl to
try and get the next-stage script from it.  If it gets a script back,
it passes control to that script.

The arguments of the SOAP request are:
 - The contents of the file /usr/bootme/ID
 - The command line passed to the kernel at boot time
 - The contents of the file /ROOTID, or the root filesytem device
 - The system uptime in seconds
 - The details of the DHCP lease, from /etc/dhcpcd/dhcpcd-eth0.info

If all the IP addresses fail, /usr/bootme/bootscript returns, and the
RC scripts will keep running it again until it succeeds or a human
intervenes.


3) Configuration 

Basic configuration can be done by factory.sh.

The ID string of the CD is in a file /bootme/ID

The file bootme/cacert.pem contains a CA cert, which the soapclient.pl
script uses to authenticate the server before accepting a script from
it.

The name and fallback IP address of the SOAP server are in files in
/bootme/.

The version number of the CD is kept in the file isolinux/isolinux.cfg,
where it is passed to the kernel on boot, in the 'xenoboot='
command-line option.  soapclient.pl passes it on to the SOAP server.


4)  Things to put in the bootscript:

Start an SSHD:  
    echo 'user:x:1000:100::/:/bin.sh' >> /etc/passwd
    echo 'user:(crypted password):1000:0:::::' >>/etc/shadow
    rm -f /etc/ssh/ssh_host*
    /usr/bin/ssh-keygen -t rsa1 -b 1024 -f /etc/ssh/ssh_host_key -N ''
    /usr/bin/ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''
    /usr/bin/ssh-keygen -d -f /etc/ssh/ssh_host_dsa_key -N ''
    (or copy in your own host keys)
    iptables -A INPUT -p tcp --dport 22 -j ACCEPT
    /usr/sbin/sshd
    sleep 600

Boot another linux kernel using the "Two kernel monte":
    (get the kernel onto the system, verify MD5, etc)
    /usr/local/sbin/xenoboot (kernel) (command-line options)

There are a couple of sample scripts and an example SOAP server in the 
server/ directory.

--
$Id: README,v 1.2 2002/08/08 10:59:02 tjd21 Exp $
