Networking

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • pipe message to app

    5 answers - 144 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi !!
    Is there any way to use ${run} to pipe the current message
    (including headers) to an external aplication and get the
    output ?
  • No.1 | | 586 bytes | |

    David Saez Padros wrote:

    Hi !!

    Is there any way to use ${run} to pipe the current message
    (including headers) to an external aplication and get the
    output ?

    A 'spamd' or 'malware' call essentially does something similar to utilize
    SpamAssasin and ClamAV (or other AV scanner), and I have long wondered how
    difficult it would be to 'declare' sockets or IP for more such calls.

    Anyone presently doing this?

    Ex: Anyone invokong a 'Dspam' run from a DATA acl instead of awaiting the routers?

    Bill
  • No.2 | | 1948 bytes | |

    Bill,

    I have a hack that I'm currently trying in order to use dspam from DATA.

    As per
    there is a file that contains the whole message after the first call
    to malware until the end of acl_smtp_data.

    I'll note that the biggest issue is that this only allows for a
    'global' dspam setup since acl_smtp_data is only run once for all
    recipients (although 90% of our mail goes to just one user, so it
    would be possible to pass that along).

    So I have:

    deny malware = *
    message = This message contains a virus ($malware_name).

    # After the first 'malware' call there is a file at
    # <spool_directory>/scan/<message_id>/<message_id>.eml
    # that contains the whole message, so we can use that to have dspam inline

    # Call dspam via ${run} now that we have a message we can process
    # Note that we cannot have by-user checks here since this is for everyone
    warn condition = ${if and { \
    {<={$message_size}{128k}} \
    { !eq{$acl_m14}{} } \
    } {1}{0}}
    set acl_m15 = ${run {/usr/local/bin/exim_dspam
    $spool_directory/scan/$message_exim_id/$message_exim_id.eml}
    {$value}{}}
    add_header = X-FILTER-DSPAM: by $primary_hostname on $tod_full

    warn condition = ${if !eq{$acl_m15}{}}
    add_header = X-DSPAM-Result: ${extract {result}{$acl_m15}}
    add_header = X-DSPAM-Confidence: ${extract {confidence}{$acl_m15}}
    add_header = X-DSPAM-Probability: ${extract {probability}{$acl_m15}}
    add_header = X-DSPAM-Signature: ${extract {signature}{$acl_m15}}

    and /usr/local/bin/exim_dspam is:

    #!/bin/sh

    DS_MDE=notrain
    DS_USER=dspamusr

    cat $1 | \
    dspam $DS_MDE \
    $DS_USER \
    \
    | \
    sed -e 's/^[^;]*; //; s/[";]//g;'

    end of exim_dspam

    Any improvements/suggestions would be more than welcome.

    David
    roverwolf (AT) gmail (DOT) com
  • No.3 | | 1149 bytes | |

    Hi !!

    I have a hack that I'm currently trying in order to use dspam from DATA.

    As per
    there is a file that contains the whole message after the first call
    to malware until the end of acl_smtp_data.

    I'll note that the biggest issue is that this only allows for a
    'global' dspam setup since acl_smtp_data is only run once for all
    recipients (although 90% of our mail goes to just one user, so it
    would be possible to pass that along).

    I just write a C function to be called using dlfunc that uses
    spool_mbox to get the message and executes whatever it has been
    specified as the first argument and injects the message to it's
    stdin and returns what it reads from the programs stdout. It's
    intended to be used to add dspam headers at transport (hope that
    spool_mbox will work at transport) but it could be used for any other
    application and in any other situation. I need to test it and when
    it works it could be used that way:

    headers_add = ${dlfunc{pipe_message.o}{pipe_message}\
    {/usr/bin/dspam xxxx}}

    tomorrow i will try to give it a test
  • No.4 | | 1729 bytes | |

    >Hi !!
    >
    >I have a hack that I'm currently trying in order to use dspam from DATA.
    >
    >As per
    >there is a file that contains the whole message after the first call
    >to malware until the end of acl_smtp_data.
    >
    >I'll note that the biggest issue is that this only allows for a
    >'global' dspam setup since acl_smtp_data is only run once for all
    >recipients (although 90% of our mail goes to just one user, so it
    >would be possible to pass that along).
    >
    >I just write a C function to be called using dlfunc that uses
    >spool_mbox to get the message and executes whatever it has been
    >specified as the first argument and injects the message to it's
    >stdin and returns what it reads from the programs stdout. It's
    >intended to be used to add dspam headers at transport (hope that
    >spool_mbox will work at transport) but it could be used for any other
    >application and in any other situation. I need to test it and when
    >it works it could be used that way:
    >
    >headers_add = ${dlfunc{pipe_message.o}{pipe_message}\
    >{/usr/bin/dspam xxxx}}
    >
    >tomorrow i will try to give it a test
    >


    >Best regards


    While testing, let me know if you have any thoughts on the (partially)
    documented
    feature of dlfunc to call a C wrapper that in turn calls some other
    language's code.

    Not that a pipe cannot also do that, but dlfunc *might* be able to call
    any-posix-compliant
    binary without caring if the *source* was in C or some other language.

    Thanks,

    Bill
  • No.5 | | 949 bytes | |

    Hi !!

    >headers_add = ${dlfunc{pipe_message.o}{pipe_message}\
    >{/usr/bin/dspam xxxx}}
    >>

    >tomorrow i will try to give it a test
    >>

    While testing, let me know if you have any thoughts on the (partially)
    documented
    feature of dlfunc to call a C wrapper that in turn calls some other
    language's code.

    i have done all in c, there is no wrapper

    Not that a pipe cannot also do that, but dlfunc *might* be able to call
    any-posix-compliant
    binary without caring if the *source* was in C or some other language.

    what do you mean ? by now i have a working test that open a
    read/write pipe to dspam (pipe, fork, dup2, etc ) that is able
    to inject in stdin and read dspam stdout. The only concern that i
    have is how to make it work (get the whole message) while expanded
    in a transport.

Re: pipe message to app


max 4000 letters.
Your nickname that display:
In order to stop the spam: 4 + 3 =
QUESTION ON "Networking"

EMSDN.COM