[news.software.b] handling of moderated newsgroups in 2.11

shannon@sun.uucp (Bill Shannon) (11/29/86)

I just installed 2.11 and have found quite a change in the way
moderated newsgroups are handled.  In 2.10.3 inews would check
for mod.* newsgroups but otherwise let you post to any newsgroup.
We have several local moderated newsgroups that were not named
mod.*.  By putting a line in the LIBDIR/moderators file, postnews
would not let people post directly to these newsgroups but would
instead send mail to the "moderator".  In our case the moderator
is a mail alias that uses recnews to post the article.  (The mail
alias also sends the article to people who want to read this
"newsgroup" using mail.)

In 2.11, inews checks the last field in the active file to determine
if a newsgroup is moderated, and if so rejects direct postings
(unless the posting has been "approved").  postnews does no check for
moderated newsgroups.  It leaves everything up to inews, which converts
(unapproved) postings to moderated newsgroups into mail to the moderator.
It finds the moderator by looking for a "backbone" entry in LIBDIR/
mailpaths and converting the newsgroup name into a mail address by
changing the '.'s to '-'s.

The fist problem is that clearly we don't want mail to our local
moderated newsgroups to be sent to a backbone site, so our backbone
entry in mailpaths just says "%s".  However, this is not right either
because we don't have any mail aliases for the many local (and regional)
moderated newsgroups in our local aliases file.

The second problem is that we can't use recnews to post mail to our
moderated newsgroups without also allowing people to post to them
directly.

So, 2.11 wizards, what do I do?  How can I make it work like it worked
with 2.10.3?  My first thought is to hack the LIBDIR/moderators stuff
back into postnews and use it to get mail to local and regional moderated
newsgroups sent to the right place, while letting inews do the work using
mailpaths for net-wide moderated newsgroups.  Any thoughts on this?  Any
other suggestions?

					Bill Shannon


P.S.  Does someone have a script that will add the 'm' flag to all net-wide
moderated newsgroups in our active file?

mlandau@Diamond.BBN.COM (Matt Landau) (12/01/86)

In newsgroup news.software.b (article <9732@sun.uucp>), shannon@sun.uucp (Bill 
Shannon) writes:
> [Comments on how news 2.11 deals with moderation and the problems this
>  causes in setting up local moderated groups.]
>So, 2.11 wizards, what do I do?  How can I make it work like it worked
>with 2.10.3?  My first thought is to hack the LIBDIR/moderators stuff
>back into postnews and use it to get mail to local and regional moderated
>newsgroups sent to the right place, while letting inews do the work using
>mailpaths for net-wide moderated newsgroups.  Any thoughts on this?  Any
>other suggestions?

What you really do is install news 2.11 patch #1 posted to the net recently
by Rick Adams.  In the midst of many other fixes there is a fix for local
moderated groups that allows you to specify the moderator's address in
the /usr/lib/news/mailpaths file BEFORE the backbone entry.  We use this for
a couple of moderated "local" groups including X and NeWS mailing lists
and company-wide bulletin boards.  Here's our mailpaths file, by way of
example:

		bboard		bboard@vax.bbn.com
		xpert		xpert@athena.mit.edu
		xport		xport@athena.mit.edu
		news-makers	news-makers@brillig.umd.edu
		backbone	%s@seismo.css.gov
		internet	%s

Seems to work fine for us!
-- 
 Matt Landau      	 		BBN Laboratories, Inc.
    mlandau@diamond.bbn.com		10 Moulton Street, Cambridge MA 02238
 ...seismo!diamond.bbn.com!mlandau      (617) 497-2429

shannon@sun.uucp (Bill Shannon) (12/01/86)

In article <2476@diamond.Diamond.BBN.COM>, mlandau@Diamond.BBN.COM (Matt Landau) writes:
> In newsgroup news.software.b (article <9732@sun.uucp>), shannon@sun.uucp (Bill 
> Shannon) writes:
> > [Comments on how news 2.11 deals with moderation and the problems this
> >  causes in setting up local moderated groups.]
> 
> What you really do is install news 2.11 patch #1 posted to the net recently
> by Rick Adams.  In the midst of many other fixes there is a fix for local
> moderated groups that allows you to specify the moderator's address in
> the /usr/lib/news/mailpaths file BEFORE the backbone entry.

I installed patch #1 as soon as I got it, before installing 2.11.  I guess
I missed the one line in the middle of all those bugs that were fixed that
said:

        There was no way to have moderated local groups.

Of course, that's hardly documentation on how to have moderated local
groups.  Yes, of course I can read the code, by I'd rather not.  Perhaps
future patches could be separated into bug fix patches and enhancement
patches.  Certainly enhancement patches should also patch the documentation
(adding diff marks, if possible).  This is not to knock the fine job done
by all involved with 2.11, but more in the way of suggestions for the
future.

Thanks for your help, Matt.

			Bill

shannon@sun.uucp (Bill Shannon) (12/01/86)

Ok, adding the entries to mailpaths does allow postnews and such
to send to the right address when posting to local moderated groups,
as long as the active file marks the group as moderated.

Now, what about the other part of my problem?  Our local moderated
groups are fed by a mail alias that uses recnews.  There is no real
moderator in the loop.  How do I get recnews to use inews to feed
news into the group (instead of mailing to the moderator) while not
allowing users who use postnews to post directly to the group?  Do
I need to hack up recnews to insert an "Approved-By:" line in the
messages it sends to inews?

					Bill Shannon

mlandau@Diamond.BBN.COM (Matt Landau) (12/02/86)

In news.software.b (article <9780@sun.uucp>), shannon@sun.uucp (Bill Shannon) 
writes:
>> What you really do is install news 2.11 patch #1 posted to the net recently
>> by Rick Adams.  In the midst of many other fixes there is a fix for local
>> moderated groups ....
>
>I installed patch #1 as soon as I got it, before installing 2.11.  I guess
>I missed the one line in the middle of all those bugs that were fixed that
>said:
>
>        There was no way to have moderated local groups.
>
>Of course, that's hardly documentation on how to have moderated local
>groups.  

Well, to tell you the truth, the only way I knew about this is that I
wrote to Rick Adams and asked him how to do local moderated groups, 
and he sent me the patch about a week before it hit the net, along
with instructions.

NOTE: You *also* have to patch recnews (if you're using it to send mail
into a local moderated group) to call inews with the -a flag and an
approved-by address, or inews will reject the submission and try to mail
it back to the moderator, causing terrible loops in your mail system!
This should be fixed "officially" in some future patch, but you'd 
better make the fix yourself before trying to use local moderated
groups!
-- 
 Matt Landau      	 		BBN Laboratories, Inc.
    mlandau@diamond.bbn.com		10 Moulton Street, Cambridge MA 02238
 ...seismo!diamond.bbn.com!mlandau      (617) 497-2429

kre@munnari.oz (Robert Elz) (12/04/86)

In article <9781@sun.uucp>, shannon@sun.uucp (Bill Shannon) writes:
> Our local moderated groups are fed by a mail alias that uses recnews.
> There is no real moderator in the loop.

Huh?  Why?  If there's no moderator, how can this group possibly
be a moderated group.

I guess what you really mean is that you want to force people to
mail things to the group list, rather than just posting them,
but again, why?

The only possible explanation I can think of is that you have
some people who want to treat the group as a mailing list,
getting info from it by mail, and replying by mail, and others
that want to treat it as a newsgroup.

An easy way to do that is ..  (assuming your group is sun.bugs so
I have a concrete name)

In the sys file

SunBugs:world,sun.bugs::mail SunBugsList

In your aliases file

SunBugs: SunBugsList, "|recnews sun.bugs"
SunBugsList: user1, user2, ...

If you do this, people can mail to SunBugs, or post to sun.bugs
and everyone who's supposed to get a mail copy will, and the news
will be available as well.

Please, DON'T "fix" recnews to add approved headers.  "Approved"
should mean "approved by the responsible human", not "mailed
to a magic address".

Robert Elz			kre@munnari.oz

ps: for those who care, precisely this kind of change is going to
happen to the "mod" groups that really aren't moderated (like
mod.computers.vax, and others).

mcb@styx.UUCP (Michael C. Berch) (12/04/86)

In article <1354@munnari.oz> kre@munnari.oz (Robert Elz) writes:
> In article <9781@sun.uucp>, shannon@sun.uucp (Bill Shannon) writes:
> > Our local moderated groups are fed by a mail alias that uses recnews.
> > There is no real moderator in the loop.
> 
> Huh?  Why?  If there's no moderator, how can this group possibly
> be a moderated group.
> . . .
> The only possible explanation I can think of is that you have
> some people who want to treat the group as a mailing list,
> getting info from it by mail, and replying by mail, and others
> that want to treat it as a newsgroup.

Right. In our case, the local mod group is used for action
requests and problems reports and the article goes through a script that
formats some information, adds a report number, etc.

> An easy way to do that is ..
>
> [Add an entry to sys that mails the articles to an alias]
> ...
> Please, DON'T "fix" recnews to add approved headers.  "Approved"
> should mean "approved by the responsible human", not "mailed
> to a magic address".

I don't agree that you should have to have a sys file entry for each
local mod group. "Approved" will have different meanings at different
sites: it might mean approved by a human, approved (as to sender,
etc.) by a program, mailed to a "magic address" (and perhaps prcessed
by a script), or whatever. The software should make it easier for
administrators to accomplish and automate local tasks, not more
difficult.

We have not yet installed 2.11 and I suppose I am going to have to
either do something with recnews or put a hack like Mr. Elz suggests
in the sys file. The former seems less of a pain than the latter.

Michael C. Berch
ARPA: mcb@lll-tis-b.arpa
UUCP: ...!lll-lcc!styx!mcb   ...!lll-crg!styx!mcb  ...!ihnp4!styx!mcb

shannon@sun.uucp (Bill Shannon) (12/14/86)

In article <1354@munnari.oz>, kre@munnari.oz (Robert Elz) writes:
> In article <9781@sun.uucp>, shannon@sun.uucp (Bill Shannon) writes:
> > Our local moderated groups are fed by a mail alias that uses recnews.
> > There is no real moderator in the loop.
> 
> Huh?  Why?  If there's no moderator, how can this group possibly
> be a moderated group.

Because I don't want to allow direct posting to the group.  There is
no human moderator, but there is a program performing the function
of a "moderator".

> I guess what you really mean is that you want to force people to
> mail things to the group list, rather than just posting them,
> but again, why?

Why not?  I used to be able to, and it worked just fine.  Why am I now
restricted in the way I can post to local newsgroups?

I think I've explained this in other messages, but the reasons for not
allowing people to post directly to a newsgroup are more administrative
than technical.

> The only possible explanation I can think of is that you have
> some people who want to treat the group as a mailing list,
> getting info from it by mail, and replying by mail, and others
> that want to treat it as a newsgroup.

Exactly.

> An easy way to do that is ..  (assuming your group is sun.bugs so
> I have a concrete name)
> 
> In the sys file
> 
> SunBugs:world,sun.bugs::mail SunBugsList
> 
> In your aliases file
> 
> SunBugs: SunBugsList, "|recnews sun.bugs"
> SunBugsList: user1, user2, ...
> 
> If you do this, people can mail to SunBugs, or post to sun.bugs
> and everyone who's supposed to get a mail copy will, and the news
> will be available as well.

Yes, I think that will work.  However, we have *a lot* of mailing lists,
many of which I would like to "gateway" into newsgroups.  I have no
control over our aliases file, so I can not simply go in and edit each
such mailing list to reorganize it as you suggest.  What I can do is
request that a new address be added to existing mailing lists, so that
I can siphon off mail to the list and send it to a newsgroup.  If I
could then simply tell news to send postings back to the mailing list,
my gateway would be complete without loops.  This is the technique I've
used for quite a while before 2.11.

> Please, DON'T "fix" recnews to add approved headers.  "Approved"
> should mean "approved by the responsible human", not "mailed
> to a magic address".

Ok, fine, so give me a way to use recnews to post news to a local
moderated newsgroup without it needing to be approved.

> Robert Elz			kre@munnari.oz
> 
> ps: for those who care, precisely this kind of change is going to
> happen to the "mod" groups that really aren't moderated (like
> mod.computers.vax, and others).

Exactly what kind of change?  In addition to the local moderated
newsgroups that I want to make work as before, there are several
non-local moderated groups that are not handled at all well by the
new scheme.  If you ever read mod.computers.apollo you'll see lots
of submissions with a Subject of "Submission for mod.computers.apollo".
Pretty useless.  If the people running mailing lists such as
mod.computers.apollo refuse to accept USENET postings into the mailing
list, then we will need a much better scheme to allow mailings to the
mailing list instead of postings to the newsgroup.  This used to be
handled by the moderated newsgroup support.  If you'd like to add support
for yet another type of newsgroup (a "mail" newsgroup?) that doesn't
require approval to post to it from recnews, but forces all postings
from postnews, followup, etc to be mailed to a certain address (but how
does it know where the posting is coming from?), that's fine with me.
Just give me a way to do what I always used to be able to do.

					Bill Shannon

chris@columbia.UUCP (Chris Maio) (12/15/86)

Bill,

I had the same problems with 2.11's handling of moderated groups, and there are
problems with Robert Elz's suggestion, so I've been using the following setup
instead.  It requires modifying sendmail.cf and two inews source files, but
it's conceptually simpler to use once it's set up.

The changes below get rid of the extra headers inserted into articles (e.g.
"Subject: Submission to ...") posted to local moderated groups, and provide a
simpler alternative to recnews that allows inserting "approved" articles into
local moderated aliases.  Also, with these changes, there's no need to add
entries to /usr/lib/aliases or the sys file to forward messages between
newsgroups and mailing lists.

The sendmail.cf changes will have to be tweaked a bit to match your particular
configuration; but the news source changes and the shell script included are
site-independent.
						Chris

: This is a shar archive.  Extract with sh, not csh.
: The rest of this file will extract: README mail-to-inews news-patches
echo x - README
sed 's/^X//' > README << '//go.sysin dd *'
XFirst off, recnews is an inconvenient way to insert articles into newsgroups,
Xbecause (a) it requires a separate entry in /usr/lib/aliases for each
Xnewsgroup, (b) it only does a half-hearted job at hiding the differences
Xbetween mail and news articles (e.g. inserting a From: header into the body
Xof the message), and (c) it doesn't let you insert messages into moderated
Xgroups.  I got around this by adding a few lines to sendmail.cf, and writing
Xa simple shell script to replace recnews.  The sendmail mechanism below is
Xintended only to be used by "moderators" (be they human or just mail
Xreflectors), but you could duplicate it using a different naming convention
Xto provide something similar which doesn't "approve" articles on their way to
Xinews.  Briefly, when sendmail sees a local recipient address in the form
X"news.x.y" and "x.y" is a local newsgroup, the message is "approved" and
Xpassed to inews with the command "inews -a daemon@thishost -d x -n x.y -h".
X
XIn sendmail.cf, I use the following mailer definition to define an
Xinterface to inews from sendmail:
X
X	# The "inews" mailer provides an interface to netnews from mail.
X	# The "mail-to-inews" shell script provides a "Subject:" header if
X	# necessary and deletes the headers a little to make inews happy.
X	Minews,	P=/usr/lib/news/mail-to-inews, F=nF, S=14, M=50000,
X		A=inews -a daemon@$j -d $h -n $u -h
X
XThis rule says that mail delivered with this mailer is passed to the shell
Xscript "mail-to-inews", with arguments "-a daemon@thishost" to specify that
Xit's been "approved", with the Distribution: and Newsgroups: headers set from
Xthe hostname and username passed to the mailer.  S=14 says to use the TCP
Xruleset to rewrite the sender addresses appropriately.  The shell script just
Xdiddles the headers a little and invokes inews with the same arguments.
X
XThen add a rule to ruleset zero which invokes this "mailer" when an address
Xmatches a certain format, and define a class containing the allowable
Xtop-level groups.  For instance, the following statements:
X
X	# allow posting by mail to cu.all,cs.all (at top of sendmail.cf)
X	CN cu cs
X
X	# check for mail bound for inews (in ruleset zero, right before
X	# the comment "remaining names must be local")
X	Rnews.$=N.$*		$#inews$@$1$:$1.$2	news.cs.bboard
X
Xsay that articles mailed to "news.x.y" get posted to newsgroup "x.y" with
Xdistribution "x" as "approved" articles, iff "x" is one of the local
Xtop-level groups specified in the "CN..." statement (so randoms can't use
Xthis to post articles to non-local moderated groups).  To use this mechanism,
Xa human moderator (or mailing list) sends messages to "news.cs.bboard" to
Xinsert an "approved" article into the moderated "cs.bboard" newsgroup.  You
Xcan change the "$@$1" to "$@sun" to always specify "Distribution: sun" if
Xyour top-level newsgroup names don't correspond to your distributions.
X
XThe mail-to-inews shell script should be installed in /usr/lib/news, or
Xwherever you specified in the sendmail.cf file.  You may want to modify it to
Xchange the set of headers which is deleted, or reject messages with no
XSubject: header, etc.
X
XThe inews changes are relatively simple, and include a couple of bug fixes
Xfor From:/Path: header handling as well the modifications to how postings to
Xlocal moderated groups are handled.  Let me know if you have any questions
Xabout them.
//go.sysin dd *
echo x - mail-to-inews
sed 's/^X//' > mail-to-inews << '//go.sysin dd *'
X#!/bin/sh
Xinews=/usr/lib/news/inews
X
X# this script deletes empty and useless headers and inserts a dummy Subject:
X# header if necessary to clean up a mail message before passing it to inews.
Xawk 'BEGIN		{ subject = 0; body = 0; skipping = 0 }
Xbody == 1		{ print; next }
X/[A-Za-z-]*:[ ]*$/	{ next }
X/^$/		        {
X			    if (!body && !subject)
X				print "Subject: (none)"; 
X			    print; body = 1; next
X			}
X/^Subject: /		{ subject = 1; skipping = 0; print; next }
X/^Apparently-To:|^Received:|^From |^Return-Path:/ {
X				skipping = 1; next }
X/^[ 	]/		{ if (skipping) next }
X			{ print }
X' | $inews $*
Xexit 0
//go.sysin dd *
chmod +x mail-to-inews
echo x - news-patches
sed 's/^X//' > news-patches << '//go.sysin dd *'
XThe following diffs to the news 2.11 source (assuming patch #1 has
Xbeen applied) contain some minor bugfixes and changes to make sure that the
XFrom: headers passed by sendmail are converted into news-format From: and Path:
Xheaders properly.  Also, the handling for moderated groups is changed so that
Xunapproved articles posted to local moderated groups are mailed verbatim to the
Xaddress specified in the mailpaths file, rather than mailing the article with
Xthose funny headers prepended to an address built from the name of the
Xnewsgroup with all "."'s changed to "-"'s.  The behavior for postings to
Xmoderated groups not specifically mentioned in the mailpaths file is unchanged.
X
XRCS file: header.c,v
Xretrieving revision 1.1
Xdiff -c -r1.1 header.c
X*** /tmp/,RCSt1005952	Sun Dec 14 22:02:47 1986
X--- header.c	Sun Dec  7 17:48:54 1986
X***************
X*** 109,114 ****
X--- 109,118 ----
X  			fixfrom(hp);
X  	}
X  
X+ 	/* cm - call fixfrom anyway in case article was mailed, not posted */
X+ 	if (!wholething && hp->from[0] != '\0')
X+ 	    fixfrom(hp);
X+ 
X  	return fp;
X  }
X  
X***************
X*** 312,317 ****
X--- 316,323 ----
X  
X  	skin(pathbuf, fullname, hp->path);	/* remove RFC822-style comments */
X  	if (fullname[0] != '\0') {
X+ 		/* make sure fullname plus " ()" will fit */
X+ 		fullname[sizeof (fullname) - strlen (hp->from) + 3 - 1] = '\0';
X  		strcat(hp->from, " (");
X  		(void) strcat(hp->from, fullname);
X  		strcat(hp->from, ")");
X***************
X*** 336,341 ****
X--- 342,349 ----
X  
X  	skin(frombuf, fullname, hp->from);	/* remove RFC822-style comments */
X  	if (fullname[0] != '\0') {
X+ 		/* make sure fullname plus " ()" will fit */
X+ 		fullname[sizeof (fullname) - strlen (frombuf) + 3 - 1] = '\0';
X  		strcat(frombuf, " (");
X  		strcat(frombuf, fullname);
X  		strcat(frombuf, ")");
X***************
X*** 533,542 ****
X  	if (ptr == NULL)
X  		return FALSE;
X  	if (its("From: "))
X! 		if (index(ptr, '@') || !index(ptr, '!'))
X! 			return FROM;
X! 		else
X! 			return PATH;
X  	if (its("Path: "))
X  		return PATH;
X  	if (its("Newsgroups: "))
X--- 541,547 ----
X  	if (ptr == NULL)
X  		return FALSE;
X  	if (its("From: "))
X! 		return FROM;
X  	if (its("Path: "))
X  		return PATH;
X  	if (its("Newsgroups: "))
X===================================================================
XRCS file: inews.c,v
Xretrieving revision 1.1
Xdiff -c -r1.1 inews.c
X*** /tmp/,RCSt1005952	Sun Dec 14 22:02:58 1986
X--- inews.c	Sun Dec  7 23:49:06 1986
X***************
X*** 373,379 ****
X  			else if (!header.path[0]) {
X  				(void) strcpy(header.path, forgedname);
X  
X! 				if ((p1 = strpbrk(header.path, "@ (<")) != NULL)
X  					*p1 = '\0';
X  			}
X  			if (!Mflag && !strpbrk(forgedname, "@ (<"))
X--- 373,380 ----
X  			else if (!header.path[0]) {
X  				(void) strcpy(header.path, forgedname);
X  
X! 				/* cm - took "@" out of break char set */
X! 				if ((p1 = strpbrk(header.path, " (<")) != NULL)
X  					*p1 = '\0';
X  			}
X  			if (!Mflag && !strpbrk(forgedname, "@ (<"))
X***************
X*** 771,776 ****
X--- 772,798 ----
X  					LIBDIR);
X  		} while (strcmp(bfr, "backbone") != 0 && !ngmatch(is_mod, bfr));
X  		(void) fclose(mfd);
X+ 
X+ 		/* cm - begin addition */
X+ 		/* local moderated groups are handled a bit differently */
X+ 		if (strcmp (bfr, "backbone") != 0) {
X+ 		    FILE *mhopen ();
X+ 		    /* fake a header for mhopen to derive a sender from */
X+ 		    bzero (&mhdr, sizeof mhdr);
X+ 		    sprintf (mhdr.path, modadd, is_mod);
X+ 		    if ((mfd = mhopen (&mhdr)) != NULL) {
X+ 			hwrite (&header, mfd);
X+ 			while ((c = getc(infp)) != EOF)
X+ 			    putc(c, mfd);
X+ 			mclose(mfd);
X+ 			log("Article mailed to %s", mhdr.path);
X+ 			xxit(0);
X+ 		    }
X+ 		    else
X+ 			xerror("Can't send mail to %s", mhdr.path);
X+ 		}
X+ 		/* cm - end addition */
X+ 
X  		/* fake a header for mailhdr */
X  		mhdr.from[0] = '\0';
X  		mhdr.replyto[0] = '\0';
X
//go.sysin dd *
exit