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

2009-10-24 Thread Olivier
2009/10/24 Warren Selby wcse...@selbytech.com

 What I do is run virtual interfaces on one box, and run multiple instances
 of atftpd inside xinetd,


Great idea !
I didn't know it could be possible to run several instances of xinetd, each
binded to a specific IP address.
Is this specific to xinetd or does openbsd-inetd also support this feature ?
Anyway, I'll check this in openbsd-inetd doc myself and (hopefully) report
my findings here.

Thanks for sharing this !!
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

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

2009-10-24 Thread Dave Platt

 Great idea !
 I didn't know it could be possible to run several instances of xinetd, each
 binded to a specific IP address.
 Is this specific to xinetd or does openbsd-inetd also support this feature ?
 Anyway, I'll check this in openbsd-inetd doc myself and (hopefully) report
 my findings here.

xinetd will let you do multiple bindings of a single port, with a
single instance of xinetd running.

You would define two service entries in the config file, with the
same service name, different ids (e.g. tftp1 and tftp2),
and different bind addresses (one for each interface).  Each
service entry would then run a different server program, or the
same server program with different server_args.

As far as I know, standard BSD (and Linux) inetd doesn't have
this capability.


___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


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

2009-10-24 Thread Olivier
2009/10/24 Dave Platt dpl...@radagast.org


 xinetd will let you do multiple bindings of a single port, with a
 single instance of xinetd running.
 ...


 As far as I know, standard BSD (and Linux) inetd doesn't have
 this capability.


Good to know !
Thanks for the pointer !!

Testing xinetd is on my todo list, now.
___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

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

2009-10-24 Thread Steve Edwards
On Sat, 24 Oct 2009, Dave Platt wrote:

 xinetd will let you do multiple bindings of a single port, with a single 
 instance of xinetd running.

 You would define two service entries in the config file, with the same 
 service name, different ids (e.g. tftp1 and tftp2), and different 
 bind addresses (one for each interface).  Each service entry would 
 then run a different server program, or the same server program with 
 different server_args.

How about tftp-cisco and tftp-polycom?

You can also name the Ethernet interfaces to match:

sudo ifconfig eth0:cisco w.x.y.z up

Might as well make it obvious for the next guy.

A good work-around, but I still like the idea of adding an execute 
configuration tool feature to atftpd.

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

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


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

2009-10-24 Thread Tzafrir Cohen
On Thu, Oct 22, 2009 at 10:50:29PM +0200, Benny Amorsen wrote:
 Olivier oza-4...@myamail.com writes:
 
  Most (if not all) IP phones support provisioning through DHCP/TFTP.
  The trouble is some phones seem to require to store their config files in
  TFTP root directory.
 
 A lot of IP phones support HTTP instead of TFTP. This helps, because it
 is fairly easy to write a script which dynamically generates the
 configuration.

Right. Using TFTP has the obvious problem of placing all the
configurations of the phones inthe open. Anybody can just go and grab
them.

(Hmmm... I wonder what it would take to do a brute-force scan on the
range of all the MAC addresses used by IP phones)

It is slow and unextendible. HTTP allow you to provide different content
by User-Agent, by Host (name-based virtual hosting), and many other.

Just in case you want to provide dynamic content over TFTP, be sure to
cache it somewhere, as the dumb TFTP client can request any block of
data from the middle of a file.

It's no like a simple HTTP client takes that much ammount of code.
Etherboot (http://etherboot.org/ ) has had an implementation of PXE over
HTTP for quite some time. They were operating under the strict
limitations of 64kB code size limit (and weren't getting anywhere near
that, unless you built it with all the card drivers).

TFTP should just die.

-- 
   Tzafrir Cohen
icq#16849755  jabber:tzafrir.co...@xorcom.com
+972-50-7952406   mailto:tzafrir.co...@xorcom.com
http://www.xorcom.com  iax:gu...@local.xorcom.com/tzafrir

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


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

2009-10-23 Thread Benny Amorsen
Steve Edwards asterisk@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

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...


/Benny


___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


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

2009-10-23 Thread Steve Edwards
 Steve Edwards asterisk@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 HS 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   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
Newline  Fax: +1-760-731-3000

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


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

2009-10-23 Thread Warren Selby
What I do is run virtual interfaces on one box, and run multiple instances
of atftpd inside xinetd, each one bound to a different IP and a different
root directory.  Thus, my file structure looks like this -

/home/phones/
/home/phones/cisco/
/home/phones/cisco/7960 (root directory for one of the atftpd instances)
/home/phones/cisco/7961 (root directory for another atftpd instance)

Then, with a little dhcpd.conf magic, you can easily point different sets of
phones to different tftp servers, using pools that match on key Product ID
(I think) strings.

--Warren Selby

On Fri, Oct 23, 2009 at 8:54 AM, Steve Edwards asterisk@sedwards.comwrote:

  Steve Edwards asterisk@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 HS 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   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
 Newline  Fax: +1-760-731-3000

 ___
 -- Bandwidth and Colocation Provided by http://www.api-digital.com --

 asterisk-users mailing list
 To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

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

2009-10-22 Thread Dave Fullerton
Olivier wrote:
 Hi,
 
 Most (if not all) IP phones support provisioning through DHCP/TFTP.
 The trouble is some phones seem to require to store their config files in
 TFTP root directory.
 This makes this TFTP root directory a bit messy.
 
 What are the best practices or tricks to manage this TFTP root directory ?
 
 I was thinking of either :
 
 1. building a dedicated source TFTP tree in which files are cleanly
 organized (vendor/models:...) which would be synchronized (one way ? two
 ways ?) with the official TFTP tree (that would be then, collapsed to a
 single directory)
 
 2. tune DHCP/TFTP server config so that each phone would retrieve its config
 files from a vendor-dedicated subdirectory.
 
 I don't have a clue about solution 2. Is it even possible ?
 Solution doesn't look very encouraging as it might be difficult to keep
 trees in sync.
 

#2 might be possible, but there's a lot of depends on factors.

The ISC dhcpd often packaged in linux distributions has the ability to 
specify different dhcp options to different pools of addresses. You 
can then assign clients to pools based on a substring match of their mac 
address. This then requires that the client (phone) will use the URL 
specified in dhcp option 66. With all this put together you can assign 
each brand of phone to its own pool/options where the options point it 
to a URL containing the firmware for that brand of phone.

I do this with my polycom phones and it works well. Don't know if it 
works with other brands of phones.

-Dave

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


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

2009-10-22 Thread Jared Smith
On Thu, 2009-10-22 at 11:15 -0400, Dave Fullerton wrote:
 #2 might be possible, but there's a lot of depends on factors.
 
 The ISC dhcpd often packaged in linux distributions has the ability to 
 specify different dhcp options to different pools of addresses. You 
 can then assign clients to pools based on a substring match of their mac 
 address. This then requires that the client (phone) will use the URL 
 specified in dhcp option 66. With all this put together you can assign 
 each brand of phone to its own pool/options where the options point it 
 to a URL containing the firmware for that brand of phone.
 
 I do this with my polycom phones and it works well. Don't know if it 
 works with other brands of phones.

I've done this on a number of different phones, using both the ISC dhcpd
server as well as dnsmasq.  I've never encountered any problems with it.



-- 
Jared Smith
Training Manager
Digium, Inc.


___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


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

2009-10-22 Thread Olivier
2009/10/22 Jared Smith jsm...@digium.com

 On Thu, 2009-10-22 at 11:15 -0400, Dave Fullerton wrote:
  #2 might be possible, but there's a lot of depends on factors.
 
  The ISC dhcpd often packaged in linux distributions has the ability to
  specify different dhcp options to different pools of addresses. You
  can then assign clients to pools based on a substring match of their mac
  address. This then requires that the client (phone) will use the URL
  specified in dhcp option 66. With all this put together you can assign
  each brand of phone to its own pool/options where the options point it
  to a URL containing the firmware for that brand of phone.
 
  I do this with my polycom phones and it works well. Don't know if it
  works with other brands of phones.

 I've done this on a number of different phones, using both the ISC dhcpd
 server as well as dnsmasq.  I've never encountered any problems with it.


Could you then mix different brands and models ?

I think assigning a given address or an address pool to certain phones is
quite easy.
The trouble is to somehow forward every TFTP request coming from this
address to a given subdirectory.

For example, Thomson ST2030S phones would query a kind of bootfile (whose
name can be changed with ISC DHCP server options) but it would later query
another config file which (apparently) must reside on TFTP root.

Sometimes, I wondered if I should have several logical IP addresses for my
physical TFTP server so that I could forward each TFTP request to
appropriate subdirectory : if TFTP request is received in address1, then
root directory is /srv/tftp/dir1
and so on ...





 --
 Jared Smith
 Training Manager
 Digium, Inc.


 ___
 -- Bandwidth and Colocation Provided by http://www.api-digital.com --

 asterisk-users mailing list
 To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

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

2009-10-22 Thread Benny Amorsen
Olivier oza-4...@myamail.com writes:

 Most (if not all) IP phones support provisioning through DHCP/TFTP.
 The trouble is some phones seem to require to store their config files in
 TFTP root directory.

A lot of IP phones support HTTP instead of TFTP. This helps, because it
is fairly easy to write a script which dynamically generates the
configuration.

Someone really ought to write a TFTP daemon with the same feature... Or
a TFTP plugin for apache perhaps.


/Benny


___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users


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

2009-10-22 Thread Steve Edwards
On Thu, 22 Oct 2009, Benny Amorsen wrote:

 A lot of IP phones support HTTP instead of TFTP. This helps, because it
 is fairly easy to write a script which dynamically generates the
 configuration.

 Someone really ought to write a TFTP daemon with the same feature... Or
 a TFTP plugin for apache perhaps.

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

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

___
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users