🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #66994

New NNTP draft -- Sections 9-12

#66994
From: Russ Allbery
Date: Wed, 29 Oct 2003 18:36
462 lines
20458 bytes
[ See <http://www.davros.org/nntp-texts/draft20.txt> for the complete
  document, including credits and references.  This is part of a series of
  postings of the sections of the new NNTP draft, which is currently in
  Last Call. ]


NNTP                                                          C. Feather
Internet-Draft                                                  Thus plc
Expires: April 15, 2004                                 October 16, 2003


9. Augmented BNF Syntax for NNTP

   Each of the following sections describes the syntax of a major
   element of NNTP. This syntax extends and refines the descriptions
   elsewhere in this specification, and should be given precedence when
   resolving apparent conflicts. Note that ABNF [RFC2234] strings are
   case insensitive. Non-terminals used in several places are defined in
   a separate section at the end.

9.1 Commands

    This syntax defines the non-terminal "command-line", which
   represents what is sent from the client to the server.

     command-line = command EOL
     command = article-command /
           body-command /
           date-command /
           group-command /
           hdr-command /
           head-command /
           help-command /
           ihave-command /
           last-command /
           list-active-command /
           list-active-times-command /
           list-distrib-pats-command /
           list-distributions-command /
           list-extensions-command /
           list-headers-command /
           list-newsgroups-command /
           list-overview-fmt-command /
           listgroup-command /
           mode-reader-command /
           newgroups-command /
           newnews-command /
           next-command /
           over-command /
           post-command /
           quit-command /
           stat-command /
           x-command

     article-command = "ARTICLE" [article-ref]
     body-command = "BODY" [article-ref]
     date-command = "DATE"
     group-command = "GROUP" WS newsgroup-name
     hdr-command = "HDR" WS header-meta-name [range-ref]
     head-command = "HEAD" [article-ref]
     help-command = "HELP"
     ihave-command = "IHAVE" WS message-id
     last-command = "LAST"
     list-active-command = "LIST" [WS "ACTIVE" [WS wildmat]]
     list-active-times-command = "LIST" WS "ACTIVE.TIMES" [WS wildmat]
     list-distrib-pats-command = "LIST" WS "DISTRIB.PATS"
     list-distributions-command = "LIST" WS "DISTRIBUTIONS"
     list-extensions-command = "LIST" WS "EXTENSIONS"
     list-headers-command = "LIST" WS "HEADERS"
     list-newsgroups-command = "LIST" WS "NEWSGROUPS" [WS wildmat]
     list-overview-fmt-command = "LIST" WS "OVERVIEW.FMT"
     listgroup-command = "LISTGROUP" [WS newsgroup-name]
     mode-reader-command = "MODE" WS "READER"
     newgroups-command = "NEWGROUPS" WS date-time
     newnews-command = "NEWNEWS" WS wildmat WS date-time
     next-command = "NEXT"
     over-command = "OVER" [WS range-ref]
     post-command = "POST"
     quit-command = "QUIT"
     stat-command = "STAT" [article-ref]
     x-command = x-command-name *(WS x-argument)
         ; Each extension command is specified fully elsewhere

     article-ref = WS (article-number / message-id)
     article-number = 1*16DIGIT
     date = [2DIGIT] 6DIGIT
     date-time = date WS time [WS "GMT"]
     header-meta-name = header-name / metadata-name
     metadata-name = ":" 1*A-NOTCOLON
     newsgroup-name = 1*wildmat-exact
     range = article-number ["-" [article-number]]
     range-ref = WS (range / message-id)
     time = 6DIGIT
     x-command-name = 3*12A-CHAR
     x-argument = 1*P-CHAR

     wildmat = wildmat-pattern *("," ["!"] wildmat-pattern)
     wildmat-pattern = 1*wildmat-item
     wildmat-item = wildmat-exact / wildmat-wild
     wildmat-exact = %x21-29 / %x2B / %x2D-3E / %x40-5A / %x5E-7E /
          UTF8-non-ascii  ; exclude * , ? [ \ ]
     wildmat-wild = "*" / "?"


9.2 Responses

    This syntax defines the non-terminal "response", which represents
   what is sent from the server to the client in response to a command.

     response = simple-response / multiline-response
     multiline-response = simple-response *content-line termination
     termination = "." CRLF
     content-line = [content-text] CRLF
     content-text = (".." / B-NONDOT) *B-CHAR

     simple-response = 3DIGIT arguments [ SP trailing-comment ] CRLF
     trailing-comment = *U-CHAR
     arguments = *( SP argument ) ; How many depends on the response
     argument = 1*A-CHAR


9.3 Articles

    This syntax defines the non-terminal "article", which represents the
   format of an article as described in Section 3.4.

     article = 1*header CRLF body
     header = header-name ":" [CRLF] SP header-content CRLF
     header-content = *( P-CHAR / [CRLF] WS )
     body = *(*B-CHAR CRLF)


9.4 General non-terminals

     header-name = 1*A-NOTCOLON
     message-id = "<" 1*248A-NOTGT ">"

     ; Assorted special character sets
     ;   A- means based on ASCII, excluding controls and SP
     ;   P- means based on UTF-8, excluding controls and SP
     ;   U- means based on UTF-8, excluding NUL CR and LF
     ;   B- means based on bytes, excluding NUL CR and LF
     A-CHAR     = %x21-7E
     A-NOTCOLON = %x21-39 / %x3B-7E  ; exclude ":"
     A-NOTGT    = %x21-3D / %x3F-7E  ; exclude ">"
     P-CHAR     = A-CHAR / UTF8-non-ascii
     U-CHAR     = %x01-09 / %x0B-0C / %x0E-7F / UTF8-non-ascii
     B-CHAR     = %x01-09 / %x0B-0C / %x0E-FF
     B-NONDOT   = %x01-09 / %x0B-0C / %x0E-2D / %x2F-FF  ; exclude "."

     CR = %x0D
     CRLF = CR LF
     DIGIT = %x30-39
     EOL = *(SP / HT) CRLF
     HT = %x09
     LF = %x0A
     SP = %x20
     UTF8-non-ascii = UTF8-2 / UTF8-3 / UTF8-4
     UTF8-2    = %xC2-DF UTF8-tail
     UTF8-3    = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2UTF8-tail /
                 %xED %x80-9F UTF8-tail / %xEE-EF 2UTF8-tail
     UTF8-4    = %xF0 %x90-BF 2UTF8-tail / %xF1-F3 3UTF8-tail /
                 %xF4 %x80-8F 2UTF8-tail
     UTF8-tail = %x80-BF
     WS = 1*(SP / HT)


10. IANA Considerations

   This specification requires IANA to keep a registry of
   extension-labels. The initial contents of this registry are specified
   in Section 8.1. As described in Section 8, names beginning with X are
   reserved for private use while all other names are to be associated
   with a specification in an RFC on the standards-track or defining an
   IESG-approved experimental protocol.


11. Security Considerations

   This section is meant to inform application developers, information
   providers, and users of the security limitations in NNTP as described
   by this document. The discussion does not include definitive
   solutions to the problems revealed, though it does make some
   suggestions for reducing security risks.

11.1 Personal and Proprietary Information

   NNTP, because it was created to distribute network news articles,
   will forward whatever information is stored in those articles.
   Specification of that information is outside this scope of this
   document, but it is likely that some personal and/or proprietary
   information is available in some of those articles. It is very
   important that designers and implementers provide informative
   warnings to users so personal and/or proprietary information in
   material that is added automatically to articles (e.g. in headers) is
   not disclosed inadvertently. Additionally, effective and easily
   understood mechanisms to manage the distribution of news articles
   SHOULD be provided to NNTP Server administrators, so that they are
   able to report with confidence the likely spread of any particular
   set of news articles.

11.2 Abuse of Server Log Information

   A server is in the position to save session data about a user's
   requests that might identify their reading patterns or subjects of
   interest. This information is clearly confidential in nature and its
   handling can be constrained by law in certain countries. People using
   the NNTP protocol to provide data are responsible for ensuring that
   such material is not distributed without the permission of any
   individuals that are identifiable by the published results.

11.3 Weak Authentication and Access Control

   There is no user-based or token-based authentication in the basic
   NNTP specification. Access is normally controlled by server
   configuration files. Those files specify access by using domain names
   or IP addresses. However, this specification does permit the creation
   of extensions to the NNTP protocol itself for such purposes. While
   including such mechanisms is optional, doing so is strongly
   encouraged.

   Other mechanisms are also available. For example, a proxy server
   could be put in place that requires authentication before connecting
   via the proxy to the NNTP server.

11.4 DNS Spoofing

   Many existing NNTP implementations authorize incoming connections by
   checking the IP address of that connection against the IP addresses
   obtained via DNS lookups of lists of domain names given in local
   configuration files. Servers that use this type of authentication,
   and clients that find a server by doing a DNS lookup of the server
   name, rely very heavily on the Domain Name Service, and are thus
   generally prone to security attacks based on the deliberate
   misassociation of IP addresses and DNS names. Clients and servers
   need to be cautious in assuming the continuing validity of an IP
   number/DNS name association.

   In particular, NNTP clients and servers SHOULD rely on their name
   resolver for confirmation of an IP number/DNS name association,
   rather than caching the result of previous host name lookups. Many
   platforms already can cache host name lookups locally when
   appropriate, and they SHOULD be configured to do so. It is proper for
   these lookups to be cached, however, only when the TTL (Time To Live)
   information reported by the name server makes it likely that the
   cached information will remain useful.

   If NNTP clients or servers cache the results of host name lookups in
   order to achieve a performance improvement, they MUST observe the TTL
   information reported by DNS. If NNTP clients or servers do not
   observe this rule, they could be spoofed when a previously accessed
   server's IP address changes. As network renumbering is expected to
   become increasingly common, the possibility of this form of attack
   will grow. Observing this requirement thus reduces this potential
   security vulnerability.

   This requirement also improves the load-balancing behavior of clients
   for replicated servers using the same DNS name and reduces the
   likelihood of a user's experiencing failure in accessing sites that
   use that strategy.

11.5 UTF-8 issues

   UTF-8 [RFC2279] permits only certain sequences of octets and
   designates others as either malformed or "illegal". The Unicode
   standard identifies a number of security issues related to illegal
   sequences and forbids their generation by conforming implementations.

   Implementations of this specification MUST NOT generate malformed or
   illegal sequences and SHOULD detect them and take some appropriate
   action. This could include:

   o  generating a 501 response code.

   o  replacing such sequences by the sequence %xEF.BF.BD, which encodes
      the "replacement character" U+FFFD;

   o  closing the connection;

   o  replacing such sequences by a "guessed" valid sequence (based on
      properties of the UTF-8 encoding);

   In the last case, the implementation MUST ensure that any replacement
   cannot be used to bypass validity or security checks. For example,
   the illegal sequence %xC0.A0 is an over-long encoding for space
   (%x20). If it is replaced by the latter in a command line, this needs
   to happen before the command line is parsed into individual
   arguments. If the replacement came after parsing, it would be
   possible to generate an argument with an embedded space, which is
   forbidden. Use of the "replacement character" does not have this
   problem, since it is permitted wherever non-US-ASCII characters are.
   Implementations SHOULD use one of the first two solutions where the
   general structure of the NNTP stream remains intact, and close the
   connection if it is no longer possible to parse it sensibly.

11.6 Caching of LIST EXTENSIONS results

   The LIST EXTENSIONS command provides information about the extensions
   currently available from the server. Whenever there is a relevant
   change to the server state, the results of this command are required
   to change accordingly.

   In most situations the results from this command in a given server
   state will not change from session to session; a given extension will
   be installed permanently on a server. Some clients may therefore wish
   to remember which extensions a server supports to avoid the delay of
   an additional command and response, particularly if they open
   multiple connections in the same session.

   However, information about extensions related to security and privacy
   MUST NOT be cached, since this could allow a variety of attacks.

   For example, consider a server which permits the use of cleartext
   passwords on links that are encrypted but not otherwise:

      [Initial TCP connection setup completed.]
      [S] 200 NNTP Service Ready, posting permitted
      [C] LIST EXTENSIONS
      [S] 202 Extensions supported:
      [S] XENCRYPT
      [S] .
      [C] XENCRYPT
      [Client and server negotiate encryption on the link]
      [S] 283 Encrypted link established
      [C] LIST EXTENSIONS
      [S] 202 Extensions supported:
      [S] XSECRET
      [S] .
      [C] XSECRET   fred flintstone
      [S] 290 Password for fred accepted

   If the client caches the last LIST EXTENSIONS result, then on the
   next session it will attempt to use XSECRET on an unencrypted link:

      [Initial TCP connection setup completed.]
      [S] 200 NNTP Service Ready, posting permitted
      [C] XSECRET   fred flintstone
      [S] 483 Only permitted on secure links

   exposing the password to any eavesdropper. While the primary cause of
   this is passing a secret without first checking the security of the
   link, caching of LIST EXTENSIONS results can increase the risk.

   Any security extension should include requirements to check the
   security state of the link in a manner appropriate to that extension.

   Caching should normally only be considered for anonymous clients that
   do not use any security or privacy extensions and for which the time
   required for an additional command and response is a noticable issue.


12. Acknowledgments

   The author acknowledges the original authors of NNTP as documented in
   RFC 977 [RFC977]: Brian Kantor and Phil Lapsey.

   The author gratefully acknowledges the work of the NNTP committee
   chaired by Eliot Lear. The organization of this document was
   influenced by the last available draft from this working group. A
   special thanks to Eliot for generously providing the original
   machine-readable sources for that document.

   The author gratefully acknowledges the work of the DRUMS working
   group, specifically RFC 1869 [RFC1869], which is the basis of the
   NNTP extensions mechanism detailed in this document.

   The author gratefully acknowledges the authors of RFC 2616 [RFC2616]
   for providing specific and relevant examples of security issues that
   should be considered for HTTP. Since many of the same considerations
   exist for NNTP, those examples that are relevant have been included
   here with some minor rewrites.

   The author gratefully acknowledges the comments and additional
   information provided by the following individuals in preparing one or
   more of the progenitors of this document:

      Russ Allbery <rra@stanford.edu>
      Wayne Davison <davison@armory.com>
      Chris Lewis <clewis@bnr.ca>
      Tom Limoncelli <tal@mars.superlink.net>
      Eric Schnoebelen <eric@egsner.cirr.com>
      Rich Salz <rsalz@osf.org>

   This work was motivated by the work of various news reader authors
   and news server authors, which includes those listed below:

   Rick Adams
      Original author of the NNTP extensions to the RN news reader and
      last maintainer of Bnews

   Stan Barber
      Original author of the NNTP extensions to the news readers that
      are part of Bnews

   Geoff Collyer
      Original author of the OVERVIEW database proposal and one of the
      original authors of CNEWS

   Dan Curry
      Original author of the xvnews news reader

   Wayne Davison
      Author of the first threading extensions to the RN news reader
      (commonly called TRN)

   Geoff Huston
      Original author of ANU NEWS

   Phil Lapsey
      Original author of the UNIX reference implementation for NNTP

   Iain Lea
      Original maintainer of the TIN news reader

   Chris Lewis
      First known implementer of the AUTHINFO GENERIC extension

   Rich Salz
      Original author of INN

   Henry Spencer
      One of the original authors of CNEWS

   Kim Storm
      Original author of the NN news reader

   Finally, the present author gratefully acknowledges the vast amount
   of work put into previous drafts by the previous author:

      Stan Barber <sob@academ.com>


Full Copyright Statement

   Copyright (C) The Internet Society (2003). 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 assignees.

   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.

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>
Technical Details
Message-ID: <87d6cf3n8h.fsf@windlord.stanford.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp-relay.ihug.net!ihug.co.nz!nntp.cs.ubc.ca!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <87d6cf3n8h.fsf@windlord.stanford.edu>
Subject: New NNTP draft -- Sections 9-12
Date: Wed, 29 Oct 2003 10:36:14 -0800
From: Russ Allbery <rra@stanford.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.20140818.mbox.gz!news5.aus1.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!nntp-relay.ihug.net!ihug.co.nz!nntp.cs.ubc.ca!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail
Newsgroups: news.software.nntp
Organization: The Eyrie
Lines: 462
NNTP-Posting-Host: windlord.stanford.edu
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: news.Stanford.EDU 1067452576 1562 171.64.19.147 (29 Oct 2003 18:36:16
 GMT)
X-Complaints-To: news@news.stanford.edu
User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Common Lisp, linux)
Cancel-Lock: sha1:uOqV4BzyWhSw5AYB7R5WoOQL9j0=