# Cyrus and Netnews

Note that the NNTP support in Cyrus is still relatively young in the grand scheme of things, and has not been tested under a heavy Usenet load. That being said, the code appears to be stable and is currently running in production serving 50-60 newsgroups with a volume of about 6000 messages per day.

## Introduction

Cyrus has the ability to export Usenet via IMAP and/or export shared IMAP mailboxes via NNTP. This is made possible by a new NNTP daemon which is included with Cyrus.

This document assumes that you have successfully been able to setup your Cyrus IMAP server. If you have not already done so, please refer to the rest of the documentation. This document also assumes that you are familiar with Usenet and shared IMAP mailboxes.

There is a diagram that shows the interactions of the various components of the NNTP support in Cyrus which may be helpful in understanding the "big picture".

## Installation

You will need to build Cyrus IMAPd with the `--enable-nntp` configure option. This builds nntpd and the associated utilities.

### Requirements

Obviously you must have a newsfeed from your ISP or Usenet provider.

## Configuration

The first thing that must be done is to decide where your newsgroup mailboxes will reside, either at the toplevel of your hierarchy (eg, `comp.mail.imap`) or rooted elsewhere (eg, `netnews.comp.mail.imap`). If your newsgroup mailboxes are not at the toplevel of your hierarchy, then you must specify the parent with the `newsprefix` in `imapd.conf`. Using the example above, `newsprefix` would be set to `netnews`.

You must create a mailbox for each newsgroup that you would like to receive/export before the newsgroups can be used. If some groups are private, be sure to set the ACLs accordingly. The `tools/mknewsgroups` script can be used to help facilitate mass creation of newsgroup mailboxes. When using this script, be sure to add posting rights for 'anyone' (eg. `mknewsgroups -a 'anyone +p' ...`) so that articles can be fed/posted.

### Receiving articles

In order to receive usenet articles, you must make sure that the Cyrus `nntpd` service is enabled in `cyrus.conf`. The `master/conf/normal.conf` and `master/conf/prefork.conf` sample configs both include entries for `nntpd` (disabled by default).

Whenever `nntpd` receives an article, it automatically adds a To: header with email addresses corresponding to the newsgroups that the article is destined for (eg, post+comp.mail.imap). The presence of this header makes it easier for email clients to post/reply to the newsgroup. The "pseudo" user that is used when constructing the email address can be specified with the `newspostuser` option in `imapd.conf` (default = "post").

#### Push (traditional) feeds

If your usenet peer will be pushing articles to you, no further configuration is necessary, beyond letting your peer access your Cyrus server on port 119 (nntp).

#### Pull (suck) feeds

If you prefer to pull articles from your peer (and your provider allows it), then you can use the `fetchnews` utility which will use the NNTP NEWNEWS command to retrieve articles from your peer and feed them to your Cyrus server. You will probably want to configure `fetchnews` as an EVENT in `cyrus.conf` to be called periodically (eg, once an hour, every 15 minutes, etc).

#### imapfeed

Alternatively, if you already have an INN v2.3 server in-house you can use the included `imapfeed` utility (written by the authors of Cyrus) to feed articles to your Cyrus server via LMTP. Consult the INN documentation for further details.

#### Control Messages

Control messages are accepted, parsed and delivered to the corresponding `control.*` pseudo-group (eg, `control.newgroup`, `control.cancel`, etc) if it exists, so that they may be reviewed by an administrator.

NOTE: Automatic execution of control messages is currently disabled until PGP verification and ACL checking are implemented (hopefully by v2.2.1).

### Reading/Posting articles

In order to have articles posted by your local users propagate to the outside world, you must specify the name of your usenet peer with the `newspeer` option in `imapd.conf`. This is the host that `nntpd` contacts to feed outgoing articles. Also note that you may specify an optional wildmat to filter which groups will be fed (see `imapd.conf(5)` for details).

#### News clients

If anonymous logins are disabled (default) in `imapd.conf`, then your news clients will have to be configured to login with a username and password, otherwise they will not be allowed to post. Furthermore, if plaintext logins are disabled in `imapd.conf`, then you might have to configure your news clients to use SSL/TLS and enable the `nntps` service in `cyrus.conf`.

If you want to allow your news clients to use the NNTP NEWNEWS command, you will have to enable the `allownewnews` option in `imapd.conf`.

#### Email clients

If you are exporting Usenet via IMAP, then your users will reply to and post articles via SMTP. In order for these messages to be fed into your server (and subsequently to the outside world) you need to use an email to news gateway, such as lmtp2nntp. You need to configure your MTA (Sendmail, Postfix, etc) so that `lmtp2nntp` is used as the local mailer whenever it receives a news article. A simple rule for doing this in Sendmail is shown below:

    <kdb># mail addressed to post+ goes to lmtp2nntp@localhost
    LOCAL_RULE_0
    Rpost + $+ < @ $=w . >		$#lmtp2nntp $@ localhost $: $1

For other configurations, consult the `lmtp2nntp` and documentation and your MTA documentation.

NOTE: If anonymous logins are disabled (default) in `imapd.conf`, then you should configure `lmtp2nntp` to use its "feed" operation mode.

### Expiring articles

To expire usenet articles on a regular basis, you should use the `expirenews` utility. This utility both expunges articles from their mailboxes and prunes message-ids from `netnews.db`. The `master/conf/normal.conf` and `master/conf/prefork.conf` sample configs both include EVENT entries for `expirenews` (disabled by default).

last modified: $Date: 2003/03/12 20:54:32 $