Network Working Group N. Freed Internet-Draft Sun Microsystems Expires: May 17, 2007 November 13, 2006 Sieve Email Filtering: Environment and Ihave Extensions draft-freed-sieve-environment-ihave-00 Status of this Memo By submitting this Internet-Draft, each author represents that any applicable patent or other IPR claims of which he or she is aware have been or will be disclosed, and any of which he or she becomes aware will be disclosed, in accordance with Section 6 of BCP 79. 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. This Internet-Draft will expire on May 17, 2007. Copyright Notice Copyright (C) The Internet Society (2006). Abstract This document describes the "environment" and "ihave" extensions to the Sieve email filtering language. The "environment" extension gives Sieve access to information about the environment where the Sieve interpreter is running. The "ihave" extension provides a means to write scripts that can take advantage of optional Sieve features but can still run when those optional features are not available. Freed Expires May 17, 2007 [Page 1] Internet-Draft Sieve Environment and Ihave Extensions November 2006 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Conventions used in this document . . . . . . . . . . . . . . 3 3. Capability Identifiers . . . . . . . . . . . . . . . . . . . . 3 4. Environment Test . . . . . . . . . . . . . . . . . . . . . . . 4 4.1. Standard Environment Items . . . . . . . . . . . . . . . . 4 4.2. Vendor-defined Environment Items . . . . . . . . . . . . . 5 4.3. IANA Registration of Environment Items . . . . . . . . . . 5 4.3.1. Template for Environment Registrations . . . . . . . . 5 4.3.2. Initial Environment Item Registrations . . . . . . . . 6 5. Ihave Test . . . . . . . . . . . . . . . . . . . . . . . . . . 6 6. Security Considerations . . . . . . . . . . . . . . . . . . . 7 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 7 8. References . . . . . . . . . . . . . . . . . . . . . . . . . . 8 8.1. Normative references . . . . . . . . . . . . . . . . . . . 8 8.2. Informative references . . . . . . . . . . . . . . . . . . 9 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 10 Intellectual Property and Copyright Statements . . . . . . . . . . 11 Freed Expires May 17, 2007 [Page 2] Internet-Draft Sieve Environment and Ihave Extensions November 2006 1. Introduction Sieve [I-D.ietf-sieve-3028bis] is a language for filtering email messages at or around the time of final delivery. It is designed to be implementable on either a mail client or mail server. It is suitable for running on a mail server where users may not be allowed to execute arbitrary programs, such as on black box Internet Message Access Protocol [RFC3501] servers, as it has no user-controlled loops or the ability to run external programs. Although sieve is intended to be independent of access protocol, mail architecture, and operating system, in some cases it is useful to allow scripts to access information about their execution context. The "environment" extension provides a new environment test that can be used to implement scripts that behave differently when moved from one system to another or otherwise operated in different contexts. A large number of sieve extensions have already been defined and more are sure to be created over time. Sieve's require clause is used to specify the extensions a particular sieve needs; an error results if the script's require clause calls for an extension that isn't available. This mechanism is sufficient in most situations. However, there can be cases where a script may be able to take advantage of an extension if it is available but can still function if it is not, possibly with some degradation of capabilities. The "ihave" extension provides a means to write scripts that make use of other extensions only when they are actually available. Ihave defines a new ihave test that takes a list of capability names as an argument and succeeds if all of the those capabilities are present. Additionally, specification of the "ihave" extension in the require clause disables parse-time checking of extension use in scripts; run- time checking must be used instead. 2. Conventions used in this document The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119]. The terms used to describe the various components of the Sieve language are taken from [I-D.ietf-sieve-3028bis] section 1.1. 3. Capability Identifiers The capability strings associated with the two extensions defined in Freed Expires May 17, 2007 [Page 3] Internet-Draft Sieve Environment and Ihave Extensions November 2006 this document are "environment" and "ihave". 4. Environment Test Usage: environment [COMPARATOR] [MATCH-TYPE] The environment test retrieves the item of environment information specified by the name string and matches it to the values specified in the key-list. The test succeeds if a match occurs. The type of match defaults to ":is" and the default comparator is "i;ascii- casemap". The current message is not a direct source of information for the environment test; the item of information specified by the name string is extracted from the environment and key-list comes from the script. The environment test MUST fail unconditionally if the specified information item does not exist. A script MUST NOT fail with an error if the item does not exist. This allows scripts to be written that handle nonexistent items gracefully. The "relational" extension [I-D.ietf-sieve-3431bis] adds a match type called ":count". The count of an environment test is 0 if the environment information returned is the empty string, or 1 otherwise. Environment items can be standardized or vendor-defined. An IANA registry is defined for both types of items. 4.1. Standard Environment Items The initial set of standardized environment items is as follows: Freed Expires May 17, 2007 [Page 4] Internet-Draft Sieve Environment and Ihave Extensions November 2006 "name" => the product name associated with the Sieve interpreter "version" => the product version associated with the Sieve interpreter "host" => the fully-qualified domain name of the host where the Sieve script is executing "domain" => the primary DNS domain associated with the Sieve execution context, usually but not always a proper suffix of the host name "place" => Sieve processing is normally performing around or after the time of final delivery. This item provides additional information about the relationship to final delivery. Possible return values are "MTA", meaning the Sieve is being evaluated before final delivery, "MDA", meaning evaluation is occurring during final delivery", and "UA", meaning evaluation is occurring after final delivery. Implementations SHOULD support as many of the items on this initial list as possible. Additional standardized items can only be defined in standards-track or experimental RFCs. 4.2. Vendor-defined Environment Items Environment item names beginning with "vnd." represent vendor-defined extensions. Such extensions are not defined by Internet standards or RFCs, but are still registered with IANA in order to prevent conflicts. Environment item names starting with "vnd." SHOULD be followed by the name of the vendor and product, such as "vnd.acme.rocket-sled-status". 4.3. IANA Registration of Environment Items A registry of environment items is provided by IANA. Item names may be registered on a first-come, first-served basis. Extensions designed for interoperable use SHOULD be defined as standards track or IESG approved experimental RFCs. 4.3.1. Template for Environment Registrations The following template is to be used for registering new Sieve environment item names with IANA. Freed Expires May 17, 2007 [Page 5] Internet-Draft Sieve Environment and Ihave Extensions November 2006 To: iana@iana.org Subject: Registration of new Sieve environment item Item name: [the string for use in the 'environment' test] Description: [a brief description of the semantics of the value the item returns] RFC number: [for extensions published as RFCs] Contact address: [email and/or physical address to contact for additional information] 4.3.2. Initial Environment Item Registrations TBD once the initial list has been determined. 5. Ihave Test Usage: ihave The ihave test provides a means for Sieve scripts to test for the existence of a given extension prior to actually using it. The capabilities argument to ihave is the same as the similarly-named argument to the require control statement: It specifies the names of one or more Sieve extensions or comparators. Unlike most Sieve tests, ihave accepts no match or comparator arguments. The type of match for ihave is always ":is" and the comparator is always "i;ascii-casemap". The strings in the capabilities list are constant strings in context of Sieve variables [I-D.ietf-sieve-variables]. It is an error to pass a non-constant string as an argument to ihave. The Sieve base specification demands that that all Sieve extensions used in a given script be specified in the initial require control statement. It is an error for a script to call for extensions the interpreter doesn't support or to attempt to use extensions that have not been listed in the script's require clause. Use of ihave changes Sieve interpreter behavior and the underlying requirements in the following ways: 1. Use of a given extension is allowed inside of a block enclosed by an ihave test on that extension just as if the extension had been specified in the script's require clause. The extension cannot be used outside of such a block and a runtime error MUST be generated if such usage is attempted. Freed Expires May 17, 2007 [Page 6] Internet-Draft Sieve Environment and Ihave Extensions November 2006 2. Sieve interpreters normally have the option of checking extension use at either parse time or execution time. The specification of "ihave" in a script's require clause changes this behavior: Scripts MUST either defer extension checking to run time or else take the presence of ihave tests into account. 3. Although it makes little sense to do so, an extension can be specified in both the require control statement and in an ihave test. If this is done the ihave test will always return true. 4. Using ihave to set a variable to a particular value and then testing that variable in another block is not permitted as it unduly complicates parse time analysis of scripts. Ihave is designed to be used with extensions that add tests, actions, or comparators. It MUST NOT be used with extensions that change how the content of Sieve scripts are interpreted such as the variables extension [I-D.ietf-sieve-variables] 6. Security Considerations The environment extension may be used to obtain information about the system the sieve implementation is running on. This information in turn may reveal details about service provider or enterprise infrastructure. Ihave, on the other hand, reveals nothing that cannot be found out by trying different require clauses. All of the security considerations given in the base Sieve specification also apply to these extensions. 7. IANA Considerations This specification defines a new IANA registry for Sieve environment item names. The specifics of this registry are given in Section 4.3. Freed Expires May 17, 2007 [Page 7] Internet-Draft Sieve Environment and Ihave Extensions November 2006 The following templates specify the IANA registrations of the two Sieve extensions specified in this document: To: iana@iana.org Subject: Registration of new Sieve extensions Capability name: ENVIRONMENT Capability keyword: environment Capability arguments: N/A Standards Track/IESG-approved experimental RFC number: this RFC Person and email address to contact for further information: Ned Freed E-Mail: ned.freed@mrochek.com Capability name: IHAVE Capability keyword: ihave Capability arguments: N/A Standards Track/IESG-approved experimental RFC number: this RFC Person and email address to contact for further information: Ned Freed E-Mail: ned.freed@mrochek.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 [I-D.ietf-sieve-3028bis] Guenther, P. and T. Showalter, "Sieve: An Email Filtering Language", draft-ietf-sieve-3028bis-09 (work in progress), August 2006, . [I-D.ietf-sieve-3431bis] Segmuller, W. and B. Leiba, "Sieve Extension: Relational Tests", draft-ietf-sieve-3431bis-04 (work in progress), December 2005, . [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. Freed Expires May 17, 2007 [Page 8] Internet-Draft Sieve Environment and Ihave Extensions November 2006 8.2. Informative references [I-D.ietf-sieve-variables] Homme, K., "Sieve Mail Filtering Language: Variables Extension", draft-ietf-sieve-variables-08 (work in progress), December 2005, . [RFC3501] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1", RFC 3501, March 2003. Freed Expires May 17, 2007 [Page 9] Internet-Draft Sieve Environment and Ihave Extensions November 2006 Author's Address Ned Freed Sun Microsystems 3401 Centrelake Drive, Suite 410 Ontario, CA 92761-1205 USA Phone: +1 909 457 4293 Email: ned.freed@mrochek.com Freed Expires May 17, 2007 [Page 10] Internet-Draft Sieve Environment and Ihave Extensions November 2006 Intellectual Property Statement The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79. Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org. Disclaimer of Validity This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM 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. Copyright Statement Copyright (C) The Internet Society (2006). This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights. Acknowledgment Funding for the RFC Editor function is currently provided by the Internet Society. Freed Expires May 17, 2007 [Page 11]