Network Working Group                                          C. Daboo
Internet Draft: SIEVE Spamtest and Virustest Extensions
Document: draft-daboo-sieve-spamtest-03.txt                  April 2003

                SIEVE Spamtest and Virustest Extensions

Status of this Memo

    This document is an Internet-Draft and is in full conformance with
    all provisions of Section 10 of RFC2026.

    Internet-Drafts are working documents of the Internet Engineering
    Task Force (IETF), its areas, and its working groups.  Note that
    other groups may also distribute working documents as
    Internet-Drafts.

    Internet-Drafts are draft documents valid for a maximum of six
    months and may be updated, replaced, or obsoleted by other documents
    at any time.  It is inappropriate to use Internet-Drafts as
    reference material or to cite them other than as "work in progress."

    The list of current Internet-Drafts can be accessed at
    http://www.ietf.org/ietf/1id-abstracts.txt.

    The list of Internet- Draft Shadow Directories can be accessed at
    http://www.ietf.org/shadow.html.


Copyright Notice

     Copyright (C) The Internet Society 2003. All Rights Reserved.


























Daboo                   Expires October 2003                   [Page 1]


Internet Draft    SIEVE Spamtest and Virustest Extensions    April 2003

                           Table of Contents
     1  Abstract  . . . . . . . . . . . . . . . . . . . . . . . . . .  2
     2  Conventions Used in This Document  . . . . . . . . . . . . . . 2
     3  Change History  . . . . . . . . . . . . . . . . . . . . . . .  2
     4  Introduction and Overview  . . . . . . . . . . . . . . . . . . 3
     5  SIEVE Extensions  . . . . . . . . . . . . . . . . . . . . . .  3
       5.1  General Considerations . . . . . . . . . . . . . . . . . . 3
       5.2  Test spamtest . . . . . . . . . . . . . . . . . . . . . .  4
       5.3  Test virustest . . . . . . . . . . . . . . . . . . . . . . 5
     6  Security Considerations . . . . . . . . . . . . . . . . . . .  5
     7  IANA Considerations  . . . . . . . . . . . . . . . . . . . . . 6
       7.1  spamtest registration . . . . . . . . . . . . . . . . . .  6
       7.2  virustest registration . . . . . . . . . . . . . . . . . . 6
     8  References  . . . . . . . . . . . . . . . . . . . . . . . . .  7
       8.1  Normative References . . . . . . . . . . . . . . . . . . . 7
       8.2  Non-Normative References  . . . . . . . . . . . . . . . .  7
     9  Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . . 7
    10  Author's Address  . . . . . . . . . . . . . . . . . . . . . .  7
    11  Full Copyright Statement . . . . . . . . . . . . . . . . . . . 7

1 Abstract

    The SIEVE [SIEVE] "spamtest" and "virustest" extensions permit users
    to use simple, portable commands for spam and virus tests on email
    messages.  Each extension provides a new test using matches against
    numeric 'scores'.  It is the responsibility of the underlying SIEVE
    implementation to do the actual checks that result in values
    returned by the tests.

2 Conventions Used in This Document

    Conventions for notations are as in [SIEVE] section 1.1, including
    use of [KEYWORDS].

    The term 'spam' is used in this document to refer to unsolicited or
    unwanted email messages.  This document does not attempt to define
    what exactly constitutes spam, or how it should be identified, or
    what actions should be taken when detected.

    The term 'virus' is used in this document to refer to any type of
    message whose content can cause malicious damage.  This document
    does not attempt to define what exactly constitutes a virus, or how
    it should be identified, or what actions should be taken when
    detected.

3 Change History

    Changes from -02 to -03:
    1   Changed test values to be arbitrary strings with numeric value
        as first token.
    2   Changed 'virii' to 'viruses'.



Daboo                   Expires October 2003                   [Page 2]


Internet Draft    SIEVE Spamtest and Virustest Extensions    April 2003

    Changes from -01 to -02:
    1   Fixed syntax in examples.
    2   Updated references section to normative/informative.

    Changes from -00 to -01:
    1   Changed so that tests use standard SIEVE syntax.
    2   Added requirement for relation extension for numeric
        comparisons.
    3   Changed spamtest numeric range to 0->10.


4 Introduction and Overview

    SIEVE scripts are frequently being used to do spam and virus
    filtering based on either implicit script tests (e.g. tests for
    'black-listed' senders directly encoded in the SIEVE script), or via
    testing messages modified by some external spam or virus checker
    that handled the message prior to SIEVE.  The use of third-party
    spam and virus checker tools poses a problem since each tool has its
    own way of indicating the result of its checks.  These usually take
    the form of a header added to the message, the content of which
    indicates the status using some syntax defined by the particular
    tool.  Each user has to then create their own SIEVE scripts to match
    the contents of these headers to do filtering.  This requires the
    script to stay in synchronisation with the third party tool as it
    gets updated or perhaps replaced with another.  Thus scripts become
    tied to specific environments, and lose portability.

    The purpose of this document is to introduce two SIEVE tests that
    can be used to implement 'generic' tests for spam and viruses in
    messages processed via SIEVE scripts.  These tests return a string
    containing a range of numeric values that indicate the severity of
    spam or viruses in a message, or a string that indicates the message
    has not passed through any spam or virus checking tools.  The spam
    and virus checks themselves are handled by the underlying SIEVE
    implementation in whatever manner is appropriate, and the
    implementation maps the results of these checks into the numeric
    ranges defined by the new tests.  Thus a SIEVE implementation can
    have a spam test that implicitly checks for third-party spam tool
    headers and determines how those map into the spamtest numeric
    range.

    In order to do numeric comparisons against the returned strings,
    server implementations MUST also support the SIEVE relational
    [RELATIONAL] extension, in addition to the extensions described
    here.  All examples below assume the relational extension is
    present.

5 SIEVE Extensions

5.1 General Considerations



Daboo                   Expires October 2003                   [Page 3]


Internet Draft    SIEVE Spamtest and Virustest Extensions    April 2003

    The "spamtest" and "virustest" tests described below both return a
    string which has one of two formats:

        1    a string that starts with a numeric value, followed by an
        optional space (%x20) character and optional arbitrary text.
        The numeric value can be compared to specific values using the
        SIEVE relational [RELATIONAL] extension in conjunction with the
        "i;ascii-numeric" comparator [ACAP], which will test for the
        presence of a numeric value at the start of the string, ignoring
        any additional text in the string.  The additional text can be
        used to carry implementation specific details about the tests
        performed and descriptive comments about the result.  Tests can
        be done using standard string comparators against this text if
        it helps to refine behaviour, however this will break
        portability of the script as the text will likely be specific to
        a particular implementation.

        2    a string containing "NIL" only.

5.2 Test spamtest

        Syntax: spamtest [COMPARATOR] [MATCH-TYPE] <value: string>

    SIEVE implementations that implement the "spamtest" test have an
    identifier of "spamtest" for use with the capability mechanism.

    The "spamtest" test evaluates to true if the spamtest result matches
    the value.  The type of match is specified by the optional match
    argument, which defaults to ":is" if not specified.

    The spamtest result is a string starting with a numeric value in the
    range "0" (zero) through "10", with "0" meaning the message is
    definitely clear of spam, and "10" meaning the message is definitely
    spam.  The underlying SIEVE implementation will map whatever spam
    check is done into this numeric range, as appropriate.  If the
    message has not been categorised by any spam checking tools, then
    the spamtest result is "NIL".

    Examples:

        require ["spamtest", "fileinto",
                 "relational", "comparator-i;ascii-numeric"];

        if spamtest :value "ge" :comparator "i;ascii-numeric" "3"
        {
            fileinto "INBOX.spam-trap";
        }
        elsif spamtest :is "NIL"
        {
            fileinto "INBOX.unclassified";
        }



Daboo                   Expires October 2003                   [Page 4]


Internet Draft    SIEVE Spamtest and Virustest Extensions    April 2003

        In this example, any message with a spamtest value greater than
        or equal to "3" is filed into a mailbox called "INBOX.spam-trap"
        in the user's mailstore.  Any message that has not passed
        through a spam check tool will be filed into the mailbox
        "INBOX.unclassified".

5.3 Test virustest

        Syntax: virustest [COMPARATOR] [MATCH-TYPE] <value: string>

    SIEVE implementations that implement the "virustest" test have an
    identifier of "virustest" for use with the capability mechanism.

    The "virustest" test evaluates to true if the virustest result
    matches the value.  The type of match is specified by the optional
    match argument, which defaults to ":is" if not specified.

    The virustest result is a string starting with a numeric value in
    the range "0" (zero) through "2", with "0" meaning the message is
    definitely clear of viruses, "1" meaning the message may contain
    viruses (looks suspicious) and "2" meaning the message definitely
    contains a virus.  The underlying SIEVE implementation will map
    whatever virus check is done into this numeric range, as
    appropriate.  If the message has not been categorised by any virus
    checking tools, then the virustest result is "NIL".

    Example:

            require ["virustest", "fileinto",
                     "relational", "comparator-i;ascii-numeric"];

            if virustest :value "eq" :comparator "i;ascii-numeric" "1"
            {
                fileinto "INBOX.quarantine";
        }
            elsif virustest :value "eq" :comparator "i;ascii-numeric" "2"
            {
                discard;
            }
            elsif virustest :is "NIL"
            {
                fileinto "INBOX.unclassified";
            }

        In this example, any message with a virustest value equal to "1"
        is filed into a mailbox called "INBOX.quarantine" in the user's
        mailstore.  Any message with a virustest value equal to "2" is
        discarded (removed) and not delivered to the user's mailstore.
        Any message that has not passed through a virus check tool will
        be filed into the mailbox "INBOX.unclassified".




Daboo                   Expires October 2003                   [Page 5]


Internet Draft    SIEVE Spamtest and Virustest Extensions    April 2003

6 Security Considerations

    SIEVE implementations SHOULD ensure that "spamtest" and "virustest"
    tests can only occur for messages that have gone through a
    legitimate spam or virus check process.  If such checks rely on the
    addition of special headers to messages, it is the responsibility of
    the implementation to ensure that such headers cannot be spoofed by
    the sender, to prevent the implementation from being tricked into
    returning the wrong result for the test.

    Beyond that, the "spamtest" and "virustest" extensions do not raise
    any security considerations that are not present in the base [SIEVE]
    protocol, and these issues are discussed in [SIEVE].


7 IANA Considerations

    The following templates specify the IANA registration of the Sieve
    extensions specified in this document:

7.1 spamtest registration

    To: iana@iana.org
    Subject: Registration of new Sieve extension

    Capability name: spamtest
    Capability keyword: spamtest
    Capability arguments: N/A
    Standards Track/IESG-approved experimental RFC number: this RFC
    Person and email address to contact for further information:

      Cyrus Daboo
      Cyrusoft International, Inc.
      Suite 780, 5001 Baum Blvd.
      Pittsburgh, PA 15213
      U.S.A.

      Email: daboo@cyrusoft.com

    This information should be added to the list of sieve extensions
    given on http://www.iana.org/assignments/sieve-extensions.

7.2 virustest registration

    To: iana@iana.org
    Subject: Registration of new Sieve extension

    Capability name: virustest
    Capability keyword: virustest
    Capability arguments: N/A
    Standards Track/IESG-approved experimental RFC number: this RFC
    Person and email address to contact for further information:


Daboo                   Expires October 2003                   [Page 6]


Internet Draft    SIEVE Spamtest and Virustest Extensions    April 2003

     Cyrus Daboo
     Cyrusoft International, Inc.
     Suite 780, 5001 Baum Blvd.
     Pittsburgh, PA 15213
     U.S.A.

     Email: daboo@cyrusoft.com

    This information should be added to the list of sieve extensions
    given on http://www.iana.org/assignments/sieve-extensions.


8 References

8.1 Normative References

    [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate
    Requirement Levels", RFC 2119, March 1997.

    [RELATIONAL] Segmuller, W. "Sieve Extension:  Relational Tests", RFC
    3431, December 2002.

    [SIEVE] Showalter, "Sieve:  A Mail Filtering Language", RFC 3028,
    January 2001.

8.2 Non-Normative References

    [ACAP] Newman, C. and J. G. Myers, "ACAP -- Application
    Configuration Access Protocol", RFC 2244, November 1997.


9 Acknowledgments

    Thanks to Tony Hansen, Jutta Degener and Ned Freed for comments on
    the original draft.  Thanks to Ashish Gawarikar for catching some
    example syntax errors.


10 Author's Address

    Cyrus Daboo
    Cyrusoft International, Inc.
    Suite 780, 5001 Baum Blvd.
    Pittsburgh, PA 15213
    U.S.A.

    Email: daboo@cyrusoft.com

11 Full Copyright Statement

    Copyright (C) The Internet Society 2003.  All Rights Reserved.



Daboo                   Expires October 2003                   [Page 7]


Internet Draft    SIEVE Spamtest and Virustest Extensions    April 2003

    This document and translations of it may be copied and furnished to
    others, and derivative works that comment on or otherwise explain it
    or assist in its implementation may be prepared, copied, published
    and distributed, in whole or in part, without restriction of any
    kind, provided that the above copyright notice and this paragraph
    are included on all such copies and derivative works.  However, this
    document itself may not be modified in any way, such as by removing
    the copyright notice or references to the Internet Society or other
    Internet organizations, except as needed for the purpose of
    developing Internet standards in which case the procedures for
    copyrights defined in the Internet Standards process must be
    followed, or as required to translate it into languages other than
    English.

    The limited permissions granted above are perpetual and will not be
    revoked by the Internet Society or its successors or assigns.

    This document and the information contained herein is provided on an
    "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
    TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
    BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
    HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.































Daboo                   Expires October 2003                   [Page 8]