RFC 2389

Feature negotiation mechanism for the File Transfer Protocol

πŸ“… published August 1998, from ietf

RFC 2389 πŸ’– Feature negotiation mechanism for the File Transfer Protocol

  • Network Working Group πŸŽ€
  • Author: P. Hethmon, Hethmon Brothers ✨
  • Author: R. Elz, University of Melbourne ✨
  • Category: Standards Track πŸ¦‹
  • Date: August 1998 🌸
  • See Also: 959 (nothing is listed under obsoletes or updates in this title block) 🧚

Status of this Memo 🌸

okay so this doc is an Internet standards track protocol for the whole Internet community, and it's literally asking everyone for discussion and suggestions for improvements 🫢. For the standardization state and status of this protocol, go check the current edition of "Internet Official Protocol Standards" (STD 1). Distribution of this memo is unlimited, so share away πŸ’….

Abstract πŸ¦‹

The File Transfer Protocol keeps getting new commands and facilities over time 🌈. You can't just assume every FTP implementation has rushed to build every newly defined mechanism, because that's not how life works πŸ’€. So this document gives FTP clients a way to figure out which new features a particular FTP server supports ✨.

Table of Contents 🧚

          Abstract  ................................................   1
    1     Introduction  ............................................   2
    2     Document Conventions  ....................................   2
    2.1   Basic Tokens  ............................................   3
    2.2   Server Replies  ..........................................   3
    3     Knowledge of Extra Capabilities - the FEAT Command  ......   3
    3.1   Feature (FEAT) Command Syntax  ...........................   4
    3.2   FEAT Command Responses  ..................................   4
    3.3   Rationale for FEAT  ......................................   6
    4     The OPTS Command  ........................................   6
    5     Security Considerations  .................................   7
    6     References  ..............................................   8
          Acknowledgements  ........................................   8
          Editors' Addresses  ......................................   8
          Full Copyright Statement  ................................   9

1. Introduction ✨

okay bestie, this doc amends the File Transfer Protocol (FTP) [1] πŸŽ€. Two new commands get added: "FEAT" and "OPTS" πŸ’–.

These commands let a client find out which optional commands a server supports and how they're supported πŸ”. They also let the client pick between the various options that any FTP command might support πŸ‘‘.

2. Document Conventions πŸ’…

This document uses the document conventions from BCP14 [2] 🫢. That's what tells you how to read capitalized words like MUST, SHOULD, etc. πŸ”₯

Terms defined in [1] mean the same thing here that they meant there πŸ’œ. That includes ASCII, reply, server-FTP process, user-FTP process, server-PI, user-PI, and user ✨.

The syntax is written in Augmented BNF, as defined in [3] 🧚. A few general ABNF definitions are needed all through the document, and those get defined right here 🌸. On your first read, it's smart to just remember that these definitions exist and then skip ahead to the next section πŸ™ˆ.

2.1. Basic Tokens πŸŽ€

This document pulls in the definitions from Appendix A of [3] πŸ¦‹. You'll find basic ABNF elements like ALPHA, DIGIT, VCHAR, SP, etc. in there πŸ’–. On top of that, this doc adds the following term for its own use πŸ’….

     TCHAR          = VCHAR / SP / HTAB    ; visible plus white space

TCHAR and VCHAR from [3] are the basic character types, pulled from different subsets of ASCII, that show up in commands and responses 🌈.

     error-response = error-code SP *TCHAR CRLF
     error-code     = ("4" / "5") 2DIGIT

In ABNF, string literals are case insensitive, and this doc keeps that convention 🫢. But heads up, ALPHA is case sensitive, and so are VCHAR and TCHAR πŸ‘‘.

2.2. Server Replies πŸ¦‹

Section 4.2 of [1] explains the format and meaning of replies the server-PI sends back to the user-PI's FTP commands ✨. This doc uses those reply conventions exactly as they are πŸ’…. Implementors should know that the ABNF in this doc, and in other FTP-related docs, sometimes shows replies in the one-line format 🧚. Unless it's explicitly said otherwise, that doesn't mean multi-line responses aren't allowed 🌸. So implementors should assume that any reply to any FTP command (including QUIT) may come in the multiline format described in [1] πŸ’œ.

Throughout this doc, a reply gets identified by the three-digit code at the start of it πŸŽ€. So when you see "500 Reply," it means a reply from the server-PI using the three-digit code "500" πŸ”₯.

3. Knowledge of Extra Capabilities - the FEAT Command 🌈

Real talk, not every server is going to support every new command from every future FTP update πŸ’€. So clients need a way to check which new commands a server supports without just guessing and trying each one πŸ”. That's why this doc adds one new command to the FTP repertoire ✨. It asks the server to list all of its extension commands, or extended mechanisms πŸ’–. Every defined and specified command or feature that isn't already defined in [1] or in this doc must show up in the FEAT output, in the form given by the document that defines that extension πŸ‘‘.

User-FTP PIs must expect to see unknown features listed in FEAT responses 🫢. That's not an error πŸ™…. It just means the server-FTP implementor has seen and implemented a new feature the user-FTP doesn't know about yet πŸ¦‹.

3.1. Feature (FEAT) Command Syntax πŸŽ€

     feat            = "Feat" CRLF

The FEAT command is just the word "FEAT" and nothing else πŸ’…. It takes no parameters or arguments 🧚.

3.2. FEAT Command Responses πŸ’–

If a server-FTP process doesn't support the FEAT command, it's going to reply with a 500 or 502 reply πŸ’€. That's just the normal "unrecognized command" reply any unknown command gets 🌸. Mistakes in the command syntax, like passing parameters, get a 501 reply instead πŸ”₯.

A server-FTP process that recognizes FEAT but doesn't implement any extended features, so it has nothing to report, SHOULD respond with the "no-features" 211 reply πŸ’œ. But honestly, that looks basically the same as a server that doesn't recognize FEAT at all, so a 500 or 502 reply MAY also be used πŸ™ˆ. The "no-features" reply MUST NOT use the multi-line response format. Exactly one response line is required and permitted πŸŽ€.

Replies to the FEAT command MUST follow the syntax below πŸ‘‘. The first line of the reply is free-form text. It doesn't get interpreted, and it's not useful for anything, because it isn't expected to be shown to end users 🌈. The syntax of the other reply lines is defined precisely, and if they're present, they MUST be exactly as specified ✨.

     feat-response   = error-response / no-features / feature-listing
     no-features     = "211" SP *TCHAR CRLF
     feature-listing = "211-" *TCHAR CRLF
                       1*( SP feature CRLF )
                       "211 End" CRLF
     feature         = feature-label [ SP feature-parms ]
     feature-label   = 1*VCHAR
     feature-parms   = 1*TCHAR

Be careful with this one: each feature line in the feature-listing starts with a single space 🫢. That space isn't optional, and it doesn't mean general whitespace πŸ¦‹. Its whole job is to make sure a feature line can never get mistaken for the end of the listing ✨. It's required even in cases where there's no chance of confusion πŸ’….

Every extension a server supports has to be on its own line 🧚. That way, the parameters each extension command supports can be included too πŸ’–. The feature-label used in a FEAT response gets specified when each new feature is added to the FTP command set 🌸. It's often the name of a newly added command, but that's not required 🌈. Actually, a new feature doesn't even have to add a new command πŸ‘‘. Any parameters get specified together with the definition of the command they belong to, and that definition also has to say how those parameters are interpreted πŸ”₯.

The feature-label and feature-parms are nominally case sensitive πŸŽ€. But the definitions of specific labels and parameters spell out the exact interpretation, and those definitions will usually write labels and parameters in a case-independent way πŸ’œ. When that's the case, implementations are recommended to use upper case letters when sending the feature response πŸ’….

The FEAT command itself doesn't show up in the list of supported features πŸ™…. Instead, a server shows that it supports FEAT by sending back any reply other than a 500 or 502 reply ✨.

Here's a typical example of a multiline FEAT reply 🧚:

     C> feat
     S> 211-Extensions supported:
     S>  MLST size*;create;modify*;perm;media-type
     S>  SIZE
     S>  COMPRESSION
     S>  MDTM
     S> 211 END

The extensions in this example are just examples of what other documents might define πŸ¦‹. Don't read any particular meaning into them πŸ’€. Also remember that the feature names returned aren't command names as such 🌸. They're just signs that the server has some attribute or other πŸ’–.

The order of the returned features doesn't matter 🫢. Server-FTP processes aren't required to use any particular order, and they don't even have to return the same order every time the command is repeated 🌈.

Here's the important part πŸ‘‘: FTP implementations that support FEAT MUST include, in the response to the FEAT command, every properly documented FTP extension beyond the commands and mechanisms described in RFC959 [1] πŸ”₯. That includes any extensions that existed before FEAT did πŸŽ€. So when a client gets a FEAT response from an FTP server, it can assume that the only extensions the server supports are the ones listed in that response πŸ’….

User-FTP processes should still be aware that several FTP extensions were developed and widely used before this document and the FEAT command were adopted 🧚. Because of that, an error response to FEAT doesn't necessarily mean the server-FTP process doesn't support those extensions πŸ™ˆ. If FEAT gets an error response, user-PIs should test for those extensions one at a time πŸ’œ.

3.3. Rationale for FEAT 🌸

FEAT isn't strictly necessary, but a standard way for the server-PI to tell the user-PI about its features and extensions still helps cut down on unnecessary traffic between the two πŸ’–. More extensions are likely to show up in the future, so this matters more over time 🌈. Without any mechanism like this, a user-FTP process would have to try each extension in turn, which means a whole series of exchanges between the user-PI and server-PI πŸ”. That can be wasteful, and it may not even always be possible 🫢. Issuing a command just to find out whether it's supported can have some effect you don't want πŸ’€.

4. The OPTS Command ✨

okay so the OPTS (options) command lets the user-PI tell the server-FTP process how it wants another FTP command (the target command) to behave, before that target command shows up πŸŽ€. What the options look like and how they work depends on which target command you're setting them for, and each command's own definition spells that out. If a command has no OPTS behavior defined, then it just has no options. Simple as that πŸ’…

Request Syntax:

opts             = opts-cmd SP command-name
                       [ SP command-options ] CRLF
opts-cmd         = "opts"
command-name     = <any FTP command which allows option setting>
command-options  = <format specified by individual FTP command>

Response Syntax:

opts-response    = opts-good / opts-bad
opts-good        = "200" SP response-message CRLF
opts-bad         = "451" SP response-message CRLF /
                   "501" SP response-message CRLF
response-message = *TCHAR

Okay, the replies are where it gets fun πŸ¦‹ A 200 reply (opts-good) MUST be sent when the command-name in the OPTS command is recognized, AND the command-options (if there are any) are recognized and appropriate. If that's not the case, the server sends an opts-bad response instead.

A 501 reply is the one for permanent errors. That means any situation where just trying again later, without anything else changing, would give you the same error. A 451 reply is for a temporary hiccup on the server's side that has nothing to do with the state of the communication between user and server. It stops the command from being accepted right now, but if you try again later, the server's environment might have changed enough for it to work 🌸

And if the OPTS command itself isn't recognized, you'll get a 500 or 502 reply, of course πŸ™„

Now the iconic bit πŸ‘‘ The OPTS command MUST be implemented whenever the FEAT command is implemented. Because of that, the list of features FEAT returns doesn't say anything about OPTS being supported, since it's already guaranteed. Neither FEAT nor OPTS has any optional functionality, so there's no "OPTS FEAT" or "OPTS OPTS" command. Don't even try, periodt πŸ’€


5. Security Considerations πŸ”’

no cap, this extension doesn't seem to create any significant new security issues that aren't already in the FTP protocol 🫢 BUT it does give users a way to figure out what an FTP server is capable of, and extra info might be deducible from that. The same basic info could be gathered by probing the server for various commands, but if FEAT weren't around, that probing could show up in the server's logs as attempts to access extension commands, which could reveal the attacker. This possibility isn't considered a serious enough threat to justify any remedial action, so we're chilling on that one 😌

The security of any additional features that FEAT might report, and that OPTS might manipulate, should be addressed where those features are defined 🧚


6. References πŸ“š

  • [1] Postel, J. and J. Reynolds, "File Transfer Protocol (FTP)", STD 9, RFC 959, October 1985.
  • [2] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
  • [3] Crocker, D. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", RFC 2234, November 1997.

Acknowledgements 🌈

this protocol extension was built in the FTPEXT Working Group of the IETF, and every member of that group gets credit as its creators 🫢✨


Editors' Addresses πŸ’Œ

Paul Hethmon
Hethmon Brothers
2305 Chukar Road
Knoxville, TN 37923 USA

Phone: +1 423 690 8990
Email: phethmon@hethmon.com


Robert Elz
University of Melbourne
Department of Computer Science
Parkville, Vic   3052
Australia

Email: kre@munnari.OZ.AU

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

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. πŸ’œ

πŸ“¦ where this page comes from