tftp-hpa-execute
About
This is a customized version of tftp-hpa to add the ability to execute execute system commands when files are requested matching certain patterns. I use this to dynamically generate configuration files for VoIP phones when the phones request the file. tftp-hpa’s regex pattern matching system is used to determine if a match occurs or not and executes the command you have specified for that pattern.
For example, a rule can be created to whenever a file beginning with the string 00085D (OUI-Prefix for the Aastra VoIP phone’s MAC address).
Usage:
First you’ll need to run the tftpd daemon specifying a location for your rules file, this is done with the -m argument to the tftpd daemon. You will also need to create the rules file, there is a sample file located in the source tarball in tftpd/sample.rules
in your rules file simply create a line similiar to:
x ^00085D /usr/local/bin/mkaastracfg
This rule will execute the command /usr/local/bin/mkaastracfg and pass the full filename being requested to the program as the first argument.
Download:
Full Download - this is a full copy of the customized source
Patch file - this patch can be applied to tftp-hpa 0.48
tftp-hpa-0.48 execute rule patch
If you have any questions or comments, please feel free to leave a comment here.

