Re: crm114 on sockets ...
Chris Babcock <[email protected]>
| Newsgroups | gmane.mail.spam.crm114 |
|---|---|
| Organization | Kolonel Panic |
| Message-ID | <[email protected]> |
On Wed, 1 Apr 2009 22:52:40 +0200 Paolo <[email protected]> wrote: > users with special needs, or just willing to experiment with I/O on > sockets, may want to try socat(1): > > http://www.dest-unreach.org/socat/doc/socat.html#EXAMPLES > > > HTH socat -d -d -lmlocal2 \ TCP4-LISTEN:80,bind=myaddr1,su=nobody,fork,range=10.0.0.0/8,reuseaddr \ TCP4:www.domain.org:80,bind=myaddr2 TCP port forwarder, each side bound to another local IP address (bind). This example handles an almost arbitrary number of parallel or consecutive connections by fork'ing a new process after each accept()... So *that* is what socat does that netcat doesn't. Nice. This is the start of using CRM as a milter: socat tcp-l:10024,reuseaddr,fork system:'smtp-serve.crm $FIFO',nofork Where 'smtp-serve.crm' is the smallest possible script for implementing an SMTP dialog as server and $FIFO is an environment variable that the daemonized milter.crm uses to create a named pipe to listen on. The main loop of milter.crm calls "syscall <async> (::) (::) (:status:) /:filter: <:*:_env_FIFO:/" repeatedly. This call blocks on an empty fifo, and CRM reads to EOF when data is sent. The result is nice, clean serialization of data from parallel connections without any rapid looping. If the message passes the filter then an SMTP client routine reinjects mail on port 10025. The message passing through the milter is not exactly mbox format because of the need to preserve the actual recipients instead of reconstructing a list from message headers, but do that and you have a drop in replacement for amavisd-new and SpamAssassin - at least on most Postfix installs. Chris ------------------------------------------------------------------------------ _______________________________________________ Crm114-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/crm114-general
signature.asc
(application/pgp-signature, 489 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iQEcBAEBAgAGBQJJ1RnbAAoJEASgqNsqZfCHKfIH/2FRZPYxcAiJsUQ837fp28w0 b0xa4N4bxwmBL5tbCHRgPRv1vqmvjd/LAF0yTkIia25OA5MiASnGS0LwoIHL7A0S POTpdmV02tVMWP/tllD319/lFyddyFbpAWV6duAv1MTMNwBcBFTDPTJocZaon0H1 E9pTY84+NrwYT2pLfTQ0zNIEAVvtLs26uQNtpGLR64tB1sFm4l929PoCuLNExpR2 0GuMmIESvUn2TAAG/AN9E8icG0PRsi6dKEuEaDVyW44QO6X/zwv8ZlEVRdcwcj0G UQmASfWe85t7MnEdjSCzc1cTktHMwTqC8FdZ6Y+VLJhhuKgA3KdM4Gi9sCBz8so= =l5kt -----END PGP SIGNATURE-----