🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #24247

mulling new limiting API and config format for news gizmo

#24247
From: Aidan Cully [Staff]
Date: Thu, 11 Dec 1997 00:00
98 lines
5291 bytes
I'm thinking of drastically changing the format of the spam.limit file for
the News Gizmo (which is basically a per-user news statistics, filtering
and authentication engine), but I'm not really sure that I'm going down the
right track with this, and thought I'd try to drum up feedback from users
(and potential users) of the software..

Here's where I am currently:
Right now, you can define limits for a user at a time, or for groups at a
time, and you can define groups by set operations on individual users and
other groups.  For example, to put a user in a group of people allowed to
post infinitely many times, the following would be applied (edited a bit
for clarity):
unlimiteds = {
	user@panix.com + $other_users
}
$unlimiteds:	Post(unlimited)
$*:	Post(50,50)

Allowing user@panix.com and everyone in the group other_users to post as
many times as they want (everyone else can post a total of 100 times).

That's all the functionality the current config file allows for (of course,
there are other things you can filter on besides number of posts made).
There's nothing to account for several accounts all owned by one user, for
limits that only apply in certain situations, for limits that aren't
related to the current user, it doesn't give you much control over the
message that gets relayed to the user, and it basically only applies to
posted messages (another feature I'd like to add is configuring which
groups a user can read with this software).

I'm thinking of changing it to a real rule-based and object-based (not
object-oriented) language that you build the config file in..  Let users
program the limits and the action that gets taken in the config file (of
course, there would be a lot of default rules provided..).  For example,
to stop all users from posting more than 50 messages, use the following
rules:

if (conn:user) var:limit:post := 50;

if (message) var:user:db:time:numposts :=
    (var:user:db:time:numposts + message:dest:numgroups);
if (var:db:numposts > var:limit:post) {
	conn:error "User exceeded posting limits.";
	message:dispose;
};

To stop users we haven't authenticated from posting (something that's
currently impossible to configure), use the following rule:
if ((! conn:user) & cmd:post) {
	cmd:error "Don't take posts from unidentified users.";
};

To stop crossposting between net.* and the rest of usenet, use:
if ((message:dest in (net.*)) &
   ((message:dest diff (net.*)) != message:dest)) {
	conn:error "Can't crosspost between net.* and anything else.";
};
(it would also be possible to write your own test for this to simplify the
structure (and one will likely be released with the new version), but it's
no longer necessary).

Since this is basically rule-based, we can optimize not to check functions
when relevant circumstances haven't changed.  We can also allow
short-circuiting in the operators API.  What is neat about this is that a
ton of the work that used to be in functions (that people who wanted to
extend this created) is now directly in the config file, allowing
power-users to create rules that the person writing the (current) filters
did not think of, or didn't want to bother having to code directly.

Further to that, gizmo extenders will now no longer even _have_ to write
filters..  They can simply write tests, commands, operators and accessors
(or a reasonable subset :-)), and leave it to the end user to decide the
rest.  (IOW, if you wanted to make sure that the From: line was the same
as the name of the remote user, before you had to write an entire filter
that sucked in the From: header and compared it to the remote username.
Hardcode in the error message if they don't match, also allow the
configuration command to give you any and all the other information you
need to decide if or not to apply the filter.  Now you have to write a
From: accessor and put the compare in the config file.)

Unfortunately, this makes it a lot harder to write a config file, and the
config file that gets written looks nothing like any "config" file I've
seen before (possibly bringing the learning curve crashing down on us),
though admittedly I have less experience than most.  Is the new format
worth it?  Should I make it #ifdef'able?  Would you use the News Gizmo if
it gave you this much control over how you treat errors, and would you
not use the gizmo if it didn't?  Is there a better way to do this?

News Gizmo info is still at <http://www.panix.com/gizmo>.
Thanks,
--aidan
-- 
Aidan Cully       "Umm..  Could you call back?  My house is on fire."
Panix Staff          --Tom Waits
aidan@panix.com

Technical Details
Message-ID: <66nhc4$9r@news1.panix.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <66nhc4$9r@news1.panix.com>
Subject: mulling new limiting API and config format for news gizmo
Date: Thu, 11 Dec 1997 00:00:00 +0000
From: aidan@panix.com (Aidan Cully [Staff])
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 297094075
Distribution: inet
Organization: PANIX Public Access Internet and UNIX, NYC
Newsgroups: news.software.nntp
X-Newsposter: Pnews 4.0-test50 (13 Dec 96)