ietf-corpus

rfc-5804

A Protocol for Remotely Managing Sieve Scripts

A. Melnikov (Editor), T. Martin
date2010-07 streamIETF areaapp wgsieve statusPROPOSED STANDARD pages49 canonicalhttps://www.rfc-editor.org/rfc/rfc5804 doi10.17487/RFC5804 errataview
Sieve scripts allow users to filter incoming email. Message stores are commonly sealed servers so users cannot log into them, yet users must be able to update their scripts on them. This document describes a protocol "ManageSieve" for securely managing Sieve scripts on a remote server. This protocol allows a user to have multiple scripts, and also alerts a user to syntactically flawed scripts. [STANDARDS TRACK]

updated by

Extracted elements (30)

design-rationale §1.3

Response codes use a slash-separated hierarchy to allow future extension while preserving backward compatibility: a client that recognizes a parent code but not a more specific child (e.g., understands QUOTA but not QUOTA/MAXSCRIPTS) treats the child as the parent, so new detail can be added without breaking existing clients.

email

design-rationale §1.7

The VERSION capability was introduced to distinguish servers compliant with RFC 5804 from older pre-specification implementations. Lack of VERSION indicates the server predates this specification and does not support RENAMESCRIPT, CHECKSCRIPT, or NOOP commands. The version numbering scheme uses major.minor where incrementing major signals a backward-incompatible change.

email

interoperability-note §2.11

Servers not supporting RENAMESCRIPT can be accommodated by clients emulating the operation via LISTSCRIPTS, GETSCRIPT, PUTSCRIPT, SETACTIVE, and DELETESCRIPT. The VERSION capability signals whether RENAMESCRIPT is natively supported.

email

normative-requirement §2.1.1 MUST

A ManageSieve client MUST verify the server's TLS certificate identity against the reference identity (hostname or IP) to prevent man-in-the-middle attacks; if using SASL PLAIN over TLS and server identity cannot be verified, the client MUST NOT attempt PLAIN authentication.

email, tls, security

normative-requirement §1.7 MUST

A server implementation MUST return SIEVE, IMPLEMENTATION, and VERSION capabilities in response to every capabilities exchange. The SASL capability list MUST be non-empty after TLS is established.

email

normative-requirement §2.6 MUST

A server MUST check submitted scripts for validity (grammar compliance and supported extensions) on PUTSCRIPT; any script that fails MUST NOT be stored, and the NO response MUST include a human-readable error message with the line number of the first error.

email

normative-requirement §2.1 MUST

After a successful STARTTLS or AUTHENTICATE command that negotiates a SASL security layer, the server MUST re-issue its capability results followed by an OK response, to protect against man-in-the-middle attacks that alter the capability list.

email, security, tls

normative-requirement §2.1 MUST

Both client and server implementations MUST implement the SCRAM-SHA-1 SASL mechanism, as well as PLAIN over TLS, to ensure interoperability.

email, crypto, security

normative-requirement §2.1 MUST

Both client and server MUST use the SASLprep profile of StringPrep to prepare authorization identities for transmission or comparison; if preparation fails or results in an empty string (unless transmitted as empty), the server MUST fail the authentication.

email, security

normative-requirement §1.3 MUST

Client implementations MUST tolerate (ignore) response codes they do not recognize; clients supporting a parent code (e.g., QUOTA) MUST treat an unrecognized child (e.g., QUOTA/MAXSCRIPTS) as the parent.

email

normative-requirement §1.2 MUST

If a server has an inactivity timeout resulting in client autologout, it MUST be no less than 30 minutes after successful authentication. The timeout MAY be less before authentication.

email

normative-requirement §2 MUST

Prior to successful authentication, only AUTHENTICATE, CAPABILITY, STARTTLS, LOGOUT, and NOOP commands are valid; servers MUST reject all other commands with a NO response.

email

normative-requirement §2.1 MUST

Reauthentication is not supported: after a successfully completed AUTHENTICATE command, the server MUST reject any further AUTHENTICATE commands with a NO reply in the same session.

email, security

normative-requirement §1.5 MUST

Servers SHOULD impose quotas to prevent storage overflow; if a command would exceed quota, servers that impose quotas MUST reply with a NO response containing the QUOTA response code.

email

normative-requirement §1.6 MUST

Sieve script names MUST comply with Net-Unicode Definition and prohibit specific control characters (0000-001F, 007F, 0080-009F, 2028, 2029). Servers MUST allow names up to 128 Unicode characters and MUST NOT truncate names that exceed the server's internal limit.

email

normative-requirement §1.8 MUST

The ManageSieve client MUST resolve DNS using an SRV record for service 'sieve' and proto 'tcp' (e.g., _sieve._tcp.example.net) before connecting; if SRV lookup fails, the fallback SHOULD be a normal A/AAAA lookup to the default port 4190.

email, dns

normative-requirement §2.10 MUST NOT

The server MUST NOT allow the client to delete an active script; a DELETESCRIPT request targeting the active script MUST be rejected with a NO response, SHOULD contain the ACTIVE response code.

email

normative-requirement §2 MUST NOT

When pipelining commands, a group sent together MUST NOT include an AUTHENTICATE, STARTTLS, or HAVESPACE command anywhere but as the last command in the list (with a narrow exception for single-round-trip SASL mechanisms that do not negotiate a security layer).

email

protocol-element §2

ManageSieve defines thirteen core commands: AUTHENTICATE, STARTTLS, LOGOUT, CAPABILITY, HAVESPACE, PUTSCRIPT, LISTSCRIPTS, SETACTIVE, GETSCRIPT, DELETESCRIPT, RENAMESCRIPT, CHECKSCRIPT, and NOOP. Commands valid in all states are CAPABILITY, LOGOUT, and NOOP; AUTHENTICATE and STARTTLS are only valid in non-authenticated state; all others are only valid in authenticated state.

email

protocol-element §1.3

Response codes provide machine-parsable detail within OK, NO, or BYE responses. The defined codes are: AUTH-TOO-WEAK, ENCRYPT-NEEDED, QUOTA (with sub-codes QUOTA/MAXSCRIPTS and QUOTA/MAXSIZE), REFERRAL, SASL, TRANSITION-NEEDED, TRYLATER, ACTIVE, NONEXISTENT, ALREADYEXISTS, TAG, and WARNINGS.

email

protocol-element §1.7

Server capabilities are sent automatically upon connection and after successful STARTTLS and AUTHENTICATE. Defined capabilities include IMPLEMENTATION, SASL, SIEVE, STARTTLS, MAXREDIRECTS, NOTIFY, LANGUAGE, OWNER, and VERSION. Capability names are case-insensitive and each may appear at most once.

email

protocol-element §2.8

The SETACTIVE command activates a named script or, when given an empty-string argument, disables any currently active script. At most one script may be active at a time; disabling when no script is active MUST result in OK.

email

registry §6.1

IANA created a ManageSieve Capabilities registry. New capabilities MUST be specified in a Standards-Track or IESG-approved Experimental RFC. Initial entries are IMPLEMENTATION, SASL, SIEVE, STARTTLS, NOTIFY, MAXREDIRECTS, LANGUAGE, OWNER, and VERSION.

email, registry

registry §6.3

IANA created a ManageSieve Response Codes registry. New response codes MUST be specified in a Standards-Track or IESG-approved Experimental RFC. Initial entries are AUTH-TOO-WEAK, ENCRYPT-NEEDED, QUOTA, QUOTA/MAXSCRIPTS, QUOTA/MAXSIZE, REFERRAL, SASL, TRANSITION-NEEDED, TRYLATER, ACTIVE, NONEXISTENT, ALREADYEXISTS, TAG, and WARNINGS.

email, registry

security-consideration §2.1

After a SASL security layer is established, the server MUST re-announce all SASL mechanisms it was capable of negotiating. Clients MAY compare the pre- and post-authentication mechanism lists to detect active down-negotiation attacks; user-oriented clients SHOULD notify the user or close the connection if a downgrade is detected.

email, security, crypto

security-consideration §5

ManageSieve transactions are susceptible to passive eavesdropping and man-in-the-middle attacks unless TLS (STARTTLS) and/or SASL integrity/confidentiality services are used. If an implementation supports eavesdropping-vulnerable mechanisms such as PLAIN, it MUST support at least one configuration where those mechanisms are not advertised or used without an external security layer.

email, security, tls

security-consideration §5

The TRANSITION-NEEDED and ENCRYPT-NEEDED response codes on failed AUTHENTICATE may disclose whether a username is valid. Server implementations SHOULD provide the ability to disable per-user conditional application of these codes. A malicious server can use TRANSITION-NEEDED to force disclosure of a user's password; clients SHOULD be able to disable the password-transition feature.

email, security

state-machine §2

A ManageSieve session has two states: non-authenticated (initial state and state after UNAUTHENTICATE) and authenticated. Transition to authenticated occurs on successful AUTHENTICATE. STARTTLS does not change state. UNAUTHENTICATE returns from authenticated to non-authenticated without affecting established TLS/SASL security layers.

email, security

wire-format §4

Literal strings from client to server use the format `{N+}CRLF` followed by N octets (the '+' indicates non-synchronizing literal). Literals from server to client use `{N}CRLF` followed by N octets (no '+' character). Quoted strings are limited to 1024 octets between the double-quote characters.

email

wire-format §3

The sieve URL scheme has the form `sieve://authority[/[owner/]scriptname]`. The scriptname and owner components are UTF-8 percent-encoded. An empty owner (`sieve://example.com//script`) is distinct from a missing owner (`sieve://example.com/script`) and is reserved for global scripts.

email