[Asterisk-Dev] RE: Asterisk manager proxy/XML -- Use of imap proxy
code (fwd)
David Troy
dave at popvox.com
Fri Mar 18 04:29:45 MST 2005
Olle -- After talking with you and Steve Sokol about this at VON, I wanted
to catch up on your thread regarding adding XML output to the manager
interface.
As you recall I'm the one who re-worked Nicolas Gudino's flash-manager
code into simpleproxy.pl a few months ago. At the time, I also looked
into a C implementation of that proxy, with the understanding that it
would need to be multithreaded and more stateful to be done properly.
I have experience with another similar proxy called 'imapproxy' which is a
proxy for web-based IMAP mail clients; it's very compact, written in C,
and has a lot of the other features we need. I actually contacted the
author of that code to see if he'd mind us using it and also get some tips
on how it's put together. His (positive) response is below.
As for the definite lack of security on simpleproxy.pl, it is intended to
be a big security hole as written. :) My notion would be that you would
set it to listen on 127.0.0.1 only, and/or put it in some other secured
environment, let it login for you once, and then your scripts (which are
trusted, right, because they can reach your trusted manager interface?)
can talk to the proxy without all the overhead of logging in on every
connect, etc...
Anyway, I think that imapproxy would be a great basis for a long term
proxy/xml interface for Manager. I haven't had time to mess with it but
have a project now that might warrant it. I'd appreciate your thoughts.
See http://www.imapproxy.org/ and msg from Dave McMurtrie below.
Best,
Dave
--
David C. Troy
President/CEO
popvox, LLC
dave at popvox.com
410-647-5812
---------- Forwarded message ----------
Date: Sat, 25 Sep 2004 13:56:37 -0400
From: Dave McMurtrie <davemcmurtrie at hotmail.com>
To: dave at popvox.com
Subject: RE: Asterisk manager proxy -- Use of imap proxy code
> 1) Have been using imapproxy for some time with IMP; thanks -- it works
> great!
Excellent.
> 2) There is a need for a similar kind of TCP proxy to imapproxy with
> Asterisk. It has a multithreaded TCP-based asynchronous interface that works
> poorly with CGI/php environment for the same reasons IMAP does. I think
> imapproxy would be a good basis for an 'astmanproxy' that would do similar
> stuff. Asterisk is GPL and we'd do this GPL.
Got ya.
> 3) Do you have any objections to our using imapproxy as a basis for this?
Nope. Not at all. As long as you're doing it GPL and abide by the license
(keep copyright intact, etc) I have no problems with you using the code.
> 4) Do you have any pointers on how to simplify imapproxy down to some core
> functions so I can understand its architecture a bit better?
Hmm. From what I can gather about what you're trying to accomplish I'd say
that you'd be most interested in looking at the src/icc.c module and the
Get_Server_Conn() function in imapcommon.c.
imapproxy keeps track of backend imap server connections in a hash table of
IMAPConnectionContext structures. You can see what these structures look like
in include/imapproxy.h. src/icc.c contains some functions that update these
structures in various ways. Most of imapcommon.c is just stuff related
specifically to imap protocol, however, in Get_Server_Conn() you'll find the
loop that searches the hash table for an IMAPConnectionContext.
Other than these two things, I don't know what other code you may be interested
in. Here's an overview of what's in the various source modules:
main.c: General server startup code.
config.c: routines for parsing a configuration file and setting config values.
logging.c: routines to set up syslog facility and severity levels.
imapcommon.c: general imap protocol stuff (sending and receiving imap data)
becomenonroot.c: setuid and setgid to a non-root user.
hash.c: just the hash function that imapproxy uses for its hash table.
icc.c: routines to manipulate IMAPConnectionContext structures.
request.c: pretty imap specific stuff. The protocol command handler routines.
select.c: related only to caching 'select' output from an imap server.
pimpstat.c: the entire pimpstat program -- just views server counters.
Let me know if you have any more specific questions. I'd be happy to help if I
can.
Thanks,
Dave
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
More information about the asterisk-dev
mailing list