Name Last modified Size Description
Parent Directory 25-Jul-2008 13:01 -
data_flow.html.foot 25-Jul-2008 13:01 0k
proxy.py.html.foot 25-Jul-2008 13:01 0k
programming.html.foot 25-Jul-2008 13:01 1k
data_flow.html.head 07-Sep-2008 19:46 1k
proxy.py.html.head 07-Sep-2008 19:46 1k
programming.html.head 07-Sep-2008 19:46 1k
simple_proxy_server.py 02-Sep-2001 00:50 1k
proxy_notes.txt 02-Sep-2001 00:50 2k
composing_producers.gif 02-Sep-2001 00:50 3k
data_flow.html.body 25-Jul-2008 13:01 4k
proxy.py.html.body 25-Jul-2008 13:01 4k
data_flow.gif 02-Sep-2001 00:50 4k
simple_proxy_server.pyc 10-Jan-2004 08:27 4k
producers.gif 02-Sep-2001 00:50 6k
data_flow.html 07-Sep-2008 19:46 6k
proxy.py.html 07-Sep-2008 19:46 6k
programming.html.body 25-Jul-2008 13:01 27k
programming.html 07-Sep-2008 19:46 30k
![]()
|
Copyright 1996-2000 by Sam RushingFor more information please contact me at rushing@nightmare.com What is Medusa?Medusa is an architecture for very-high-performance TCP/IP servers (like HTTP, FTP, and NNTP). Medusa is different from most other servers because it runs as a single process, multiplexing I/O with its various client and server connections within a single process/thread. It is capable of smoother and higher performance than most other servers, while placing a dramatically reduced load on the server machine. The single-process, single-thread model simplifies design and enables some new persistence capabilities that are otherwise difficult or impossible to implement. Medusa is supported on any platform that can run Python and includes a functional implementation of the <socket> and <select> modules. This includes the majority of Unix implementations. During development, it is constantly tested on Linux and Win32 [Win95/WinNT], but the core asynchronous capability has been shown to work on several other platforms, including the Macintosh. It might even work on VMS. The Power of PythonA distinguishing feature of Medusa is that it is written entirely in Python. Python (http://www.python.org/) is a 'very-high-level' object-oriented language developed by Guido van Rossum (currently at CNRI). It is easy to learn, and includes many modern programming features such as storage management, dynamic typing, and an extremely flexible object system. It also provides convenient interfaces to C and C++. The rapid prototyping and delivery capabilities are hard to exaggerate; for example
I've heard similar stories from alpha test sites, and other users of the core async library. Server NotesBoth the FTP and HTTP servers use an abstracted 'filesystem object' to gain access to a given directory tree. One possible server extension technique would be to build behavior into this filesystem object, rather than directly into the server: Then the extension could be shared with both the FTP and HTTP servers. HTTPThe core HTTP server itself is quite simple - all functionality is provided through 'extensions'. Extensions can be plugged in dynamically. [i.e., you could log in to the server via the monitor service and add or remove an extension on the fly]. The basic file-delivery service is provided by a 'default' extension, which matches all URI's. You can build more complex behavior by replacing or extending this class. The default extension includes support for the 'Connection: Keep-Alive' token, and will re-use a client channel when requested by the client. FTPOn Unix, the ftp server includes support for 'real' users, so that it may be used as a drop-in replacement for the normal ftp server. Since most ftp servers on Unix use the 'forking' model, each child process changes its user/group persona after a successful login. This is a appears to be a secure design. Medusa takes a different approach - whenever Medusa performs an operation for a particular user [listing a directory, opening a file], it temporarily switches to that user's persona _only_ for the duration of the operation. [and each such operation is protected by a try/finally exception handler]. To do this Medusa MUST run with super-user privileges. This is a HIGHLY experimental approach, and although it has been thoroughly tested on Linux, security problems may still exist. If you are concerned about the security of your server machine, AND YOU SHOULD BE, I suggest running Medusa's ftp server in anonymous-only mode, under an account with limited privileges ('nobody' is usually used for this purpose). I am very interested in any feedback on this feature, most especially information on how the server behaves on different implementations of Unix, and of course any security problems that are found. MonitorThe monitor server gives you remote, 'back-door' access to your server while it is running. It implements a remote python interpreter. Once connected to the monitor, you can do just about anything you can do from the normal python interpreter. You can examine data structures, servers, connection objects. You can enable or disable extensions, restart the server, reload modules, etc... The monitor server is protected with an MD5-based authentication similar to that proposed in RFC1725 for the POP3 protocol. The server sends the client a timestamp, which is then appended to a secret password. The resulting md5 digest is sent back to the server, which then compares this to the expected result. Failed login attempts are logged and immediately disconnected. The password itself is not sent over the network (unless you have foolishly transmitted it yourself through an insecure telnet or X11 session. 8^) For this reason telnet cannot be used to connect to the monitor server when it is in a secure mode (the default). A client program is provided for this purpose. You will be prompted for a password when starting up the server, and by the monitor client. For extra added security on Unix, the monitor server will eventually be able to use a Unix-domain socket, which can be protected behind a 'firewall' directory (similar to the InterNet News server). Performance NotesThe
|