[asterisk-users] OT - How to organize TFTP root directory ?

Steve Edwards asterisk.org at sedwards.com
Fri Oct 23 08:54:34 CDT 2009


> Steve Edwards <asterisk.org at sedwards.com> writes:
>
>> atftpd can do PCRE substitutions to transform a requested file name 
>> into something else. I've not used this facility, but I'm guessing you 
>> could transform:
>>
>>  	SIPDefault.cnf -> cisco/SIPDefault.cnf
>>  	sip.cfg -> polycom/sip.cfg
>>  	spa841.cfg -> sipura/spa841.cfg
>
On Fri, 23 Oct 2009, Benny Amorsen wrote:

> Cute, but all that accomplishes is renaming. I want to run a script 
> which returns a different configuration based on the file name (and 
> possibly the client IP address). Unfortunately there is also no 
> UserAgent-header in TFTP...

So, break out your H&S or your wallet :)

How about adding an option to atftpd to enable "check the execute bit" on 
the requested file. If the file has the execute bit, set the MAC, IP 
Address, etc. as environment variables, exec the file, and return the 
output to the requester?

Then, you could write (for example) spa841.cfg as a shell script which 
have access to the MAC, etc. and could run sed/replace/preprocessor/m4 and 
create the "file" on the fly.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list