rfc-5183

Sieve Email Filtering: Environment Extension

N. Freed
date2008-05 streamIETF wgnon working group statusPROPOSED STANDARD pages10 canonicalhttps://www.rfc-editor.org/rfc/rfc5183 doi10.17487/RFC5183
This document describes the "environment" extension to the Sieve email filtering language. The "environment" extension gives a Sieve script access to information about the Sieve interpreter itself, where it is running, and about any transport connection currently involved in transferring the message. [STANDARDS-TRACK]

Extracted elements (20)

design-rationale §4.3

Groups of related environment items defined in an RFC MAY use a common name prefix of the form 'name.' to namespace related items, while vendor-defined items use 'vnd.' to avoid conflicts with standardized names.

email, registry

design-rationale §1

The environment test is designed to allow Sieve scripts to behave differently when moved between systems or operated in different contexts, without requiring system-specific script variants. The test fails gracefully on unknown items rather than erroring, so scripts can be written portably.

email

interoperability-note §4

The ':count' match type from the 'relational' extension (RFC 5231) works with environment tests: the count is 0 if the environment information returned is the empty string, or 1 otherwise.

email

normative-requirement §4 SHOULD

Extensions designed for interoperable use SHOULD be defined in standards-track or experimental RFCs. Vendor-defined items MUST have a name beginning with the 'vnd.' prefix.

email, registry

normative-requirement §4.1 SHOULD

Implementations SHOULD support as many of the initial standard environment items as possible. Additional standardized items can only be defined in standards-track or experimental RFCs.

email

normative-requirement §4.3 MUST

Items not defined in a standards-track or experimental RFC MUST have a name beginning with the 'vnd.' prefix, followed by the vendor or product name, such as 'vnd.acme.rocket-sled-status'.

email, registry

normative-requirement §4 MUST

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, allowing scripts to handle nonexistent items gracefully.

email

protocol-element §4.1

The 'domain' environment item returns the primary DNS domain associated with the Sieve execution context, usually but not always a proper suffix of the host name.

email, dns

protocol-element §4

The 'environment' extension adds a new 'environment' test to Sieve that retrieves a named item of environment information and matches it against a key-list. The test succeeds if a match occurs; the default match type is ':is' and the default comparator is 'i;ascii-casemap'.

email

protocol-element §4.1

The 'host' environment item returns the fully-qualified domain name of the host where the Sieve script is executing.

email

protocol-element §4.1

The 'location' environment item indicates the type of service evaluating the script: 'MTA' (Message Transfer Agent), 'MDA' (Mail Delivery Agent), 'MUA' (Mail User Agent), or 'MS' (Message Store).

email

protocol-element §4.1

The 'name' environment item returns the product name associated with the Sieve interpreter, and 'version' returns the product version, whose meaning is product-specific and should be interpreted in the context of 'name'.

email

protocol-element §4.1

The 'phase' environment item indicates the point relative to final delivery where the script is evaluated: 'pre', 'during', or 'post', referring to processing before, during, and after final delivery.

email

protocol-element §4.1

The 'remote-host' environment item provides the FQDN of the remote SMTP/LMTP/Submission client, if applicable and available; returns the empty string if the information cannot be obtained.

email

protocol-element §4.1

The 'remote-ip' environment item provides the IP address of the remote SMTP/LMTP/Submission client in IPv4-address-literal, IPv6-address-literal, or General-address-literal format as defined in RFC 2821 Section 4.1.3.

email, ip

protocol-element §4.2

Vendor-defined environment items use names beginning with 'vnd.' and are registered with IANA to prevent conflicts, but are not defined by Internet standards or RFCs.

email, registry

registry §4.3

This document establishes a new IANA registry for Sieve environment item names. Items may be registered on a first-come, first-served basis. The registry is initialized with the eight standard items: domain, host, location, name, phase, remote-host, remote-ip, and version.

email, registry

registry §6

This document registers the 'environment' capability with IANA in the Sieve extensions registry, enabling Sieve scripts to declare use of the environment extension via the capability string 'environment'.

email, registry

security-consideration §5

The environment extension may reveal details about service provider or enterprise infrastructure, such as host names and IP addresses, to scripts that may be crafted by users or attackers.

email, security

security-consideration §5

The 'remote-host' item may be determined via a PTR DNS lookup on the client IP address, which comes from an untrusted source. Testing 'remote-host' against a domain pattern (e.g., '*.example.com') is not a reliable way to verify message origin because anyone controlling PTR records can set them to any domain.

email, security, dns