Network Working Group C. Daboo Internet Draft: SIEVE spamtest and virustest Extensions Document: draft-daboo-sieve-spamtest-00.txt July 2002 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 2002. All Rights Reserved. Daboo Expires January 2003 [Page 1] Internet Draft SIEVE spamtest and virustest Extensions July 2002 Table of Contents 1 Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Conventions Used in This Document . . . . . . . . . . . . . . . 2 3 Open Issues: . . . . . . . . . . . . . . . . . . . . . . . . . 2 4 Introduction and Overview . . . . . . . . . . . . . . . . . . . 2 5 SIEVE Extensions . . . . . . . . . . . . . . . . . . . . . . . 3 5.1 spamtest . . . . . . . . . . . . . . . . . . . . . . . . . 3 5.2 virustest . . . . . . . . . . . . . . . . . . . . . . . . 4 6 Security Considerations . . . . . . . . . . . . . . . . . . . . 5 7 References . . . . . . . . . . . . . . . . . . . . . . . . . . 5 8 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . 6 9 Author's Address . . . . . . . . . . . . . . . . . . . . . . . 6 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 with simple semantics. 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 Open Issues: 1 Is the number of levels for each test reasonable? 2 Should there be a 'spamreport' action? 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 Daboo Expires January 2003 [Page 2] Internet Draft SIEVE spamtest and virustest Extensions July 2002 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 virii in messages processed via SIEVE scripts. These tests return a range of numeric values that indicate the severity of spam or virii in a message. 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. 5 SIEVE Extensions 5.1 spamtest Syntax: spamtest <":gt" / ":ge" / ":lt" / ":le" / ":eq" / ":ne"> SIEVE implementations that implement the "spamtest" test have an identifier of "spamtest" for use with the capability mechanism. The "spamtest" test takes a tagged argument describing the type of numeric comparison to be used, followed by a number representing the numeric value to be tested against. The numeric value is in the range 0 (zero) through 5, with 0 meaning the message is definitely clear of spam, and 5 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 argument is ":gt", and the spamtest value is greater than the number provided, the test is true; otherwise, it is false. If the argument is ":ge", and the spamtest value is greater than or equal to the number provided, the test is true; otherwise, it is false. If the argument is ":lt", and the spamtest value is less than the number provided, the test is true; otherwise, it is false. If the argument is ":le", and the spamtest value is less than or equal to the number provided, the test is true; otherwise, it is false. Daboo Expires January 2003 [Page 3] Internet Draft SIEVE spamtest and virustest Extensions July 2002 If the argument is ":eq", and the spamtest value is equal to the number provided, the test is true; otherwise, it is false. If the argument is ":ne", and the spamtest value is not equal to the number provided, the test is true; otherwise, it is false. Exactly one of ":gt", ":ge", ":lt", ":le", ":eq" or ":ne" must be specified, and anything else is an error. The number must only be in the range 0 through 5, and anything else is an error. Example: require ["spamtest", "fileinto"]; if (spamtest :ge 3) { fileinto "INBOX.spam-trap"; } 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. 5.2 virustest Syntax: virustest <":gt" / ":ge" / ":lt" / ":le" / ":eq" / ":ne"> SIEVE implementations that implement the "virustest" test have an identifier of "virustest" for use with the capability mechanism. The "virustest" test takes a tagged argument describing the type of numeric comparison to be used, followed by a number representing the numeric value to be tested against. The numeric value is in the range 0 (zero) through 2, with 0 meaning the message is definitely clear of virii, 1 meaning the message may contain virii (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 argument is ":gt", and the virustest value is greater than the number provided, the test is true; otherwise, it is false. If the argument is ":ge", and the virustest value is greater than or equal to the number provided, the test is true; otherwise, it is false. If the argument is ":lt", and the virustest value is less than the number provided, the test is true; otherwise, it is false. Daboo Expires January 2003 [Page 4] Internet Draft SIEVE spamtest and virustest Extensions July 2002 If the argument is ":le", and the virustest value is less than or equal to the number provided, the test is true; otherwise, it is false. If the argument is ":eq", and the virustest value is equal to the number provided, the test is true; otherwise, it is false. If the argument is ":ne", and the virustest value is not equal to the number provided, the test is true; otherwise, it is false. Exactly one of ":gt", ":ge", ":lt", ":le", ":eq" or ":ne" must be specified, and anything else is an error. The number must only be in the range 0 through 2, and anything else is an error. Example: require ["virustest", "fileinto"]; if (virustest :eq 1) { fileinto "INBOX.quarantine"; } if (virustest :eq 2) { discard; } 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. 6 Security Considerations SIEVE implementations MUST 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. 7 References [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", RFC 2119, March 1997. [SIEVE] Showalter, "Sieve: A Mail Filtering Language", RFC 3028, January 2001. Daboo Expires January 2003 [Page 5] Internet Draft SIEVE spamtest and virustest Extensions July 2002 8 Acknowledgments 9 Author's Address Cyrus Daboo Cyrusoft International, Inc. Suite 780, 5001 Baum Blvd. Pittsburgh, PA 15213 U.S.A. Email: daboo@cyrusoft.com Daboo Expires January 2003 [Page 6]