skip to content
 

We use TFTP to boot machines for auto-installing. We have quite a lot of them, and it's a pain to have to generate individual files for each of them. The patch below provides CGI-like functionality: if the execute bit on the file is set, the file is executed in an environment where 'Peer' is set to the IP address of the client. The standard output is sent to the client. In our case, we tend to use this for automatically providing a tailored pxelinux.cfg file which tells a machine to reinstall its operating system if required.

The patch also provides flexible filename remapping by way of a helper program which is called for each request. The output of that helper program must be a single line containing the name of the new file, which may or may not be the same as the original request. We use this so that when our WinPE clients request Boot.WIM they get sent the contents of Boot32bit.WIM or Boot64bit.WIM depending on whether our internal database thinks that machine is 32bit or 64bit.

How to install it?

Get the patch (Or a patch for 5.2 from here). It's formatted for a debian system, so apt-get source tftp-hpa, drop 04-tftpcgi.patch into tftp-hpa-5.0/debian/patches/ and add the name to the end of tftp-hpa-5.0/debian/patches/series. dpkg-buildpackage should build the package for you.

On other systems, extract the tftp-hpa source code and patch from the patch. Compile. Install.

Config

Append -x $DIR to the command line to cause tftpd to change directory into $DIR.

Append -M $HELPER to the command line to cause tftpd to run $HELPER in an enviroment where OriginalFile is set to the requested filename and Peer is set to the IP address of the tftp client. The output of $HELPER should be a new filename, perhaps different from the original. (Think filename remapping but on a more flexible scale.)

System status 

System monitoring page

Can't find what you're looking for?

Then you might find our A-Z site index useful. Or, you can search the site using the box at the top of the page, or by clicking here.