🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.misc
Article #4161

Re: NEWSGROUP MODERATION DEV GUIDE

#4161
From: salahuddin
Date: Sun, 21 Jan 2024 23:47
369 lines
10431 bytes
Hi Julien,

On 1/21/24 21:53, Julien ÉLIE wrote:
> A few remarks below:
> 
>>    create groups
>>    ,----
>>    | $ /usr/sbin/ctlinnd newgroup demo.comments
>>    `----
> 
> I do not understand well in the documentation when you test the 
> moderation.  There's no moderated newsgroup involved.
> Shouldn't demo.comments be a moderated newsgroup?
> 
>      ctlinnd newgroup demo.comments m
> 

Yes.

> Thanks for your work on explaining how to set up moderation.  (It may 
> still be a bit obscure for people who have never installed a news server 
> and a mail server.)
> 
Welcome. Thank you for your feedback.

I also posted update in my blog: 
https://netuse.dynamicmalloc.com/usenet_mod_dev.html

               ____________________________________________

                NEWSGROUP MODERATION TOOL DEVELOPERS GUIDE

                  Salahuddin <salahuddin@member.fsf.org>
               ____________________________________________


                             <2024-01-22 Mon>


Table of Contents
_________________

1. local DNS server
2. Setup USENET server
.. 1. enable incoming
.. 2. Server logs
3. Setup USENET client
.. 1. Install rnews
.. 2. Test rnews
4. Setup local Mail Server
.. 1. Setup procmail
.. 2. Message formatting
.. 3. add custom headers
.. 4. add Approved header(s)
.. 5. Test Post
5. Simulate newsgroup post
6. Develop incoming mail handler





1 local DNS server
==================

   Setup a local DNS server (bind9 or other), and add DNS entries of your
   local virtual servers.

   usenet-server.home.lab - USENET server
   usenet-client.home.lab - client will post news to USENET server via
   rnews

   note: Please make sure your virtual servers are using your DNS server.


2 Setup USENET server
=====================

   usenet-server.home.lab

   setup inn2 from source or in Debian based distribution.
   ,----
   | # apt-get install inn2
   `----

   edit /etc/news/inn.conf
   ,----
   | Organization:                "Demo InterNetNews site"
   | pathhost:                    usenet-server.home.lab
   | domain:                      usenet-server.home.lab
   `----

   create a moderated group
   ,----
   | $ /usr/sbin/ctlinnd newgroup demo.comments m
   `----

   edit /var/lib/news/newsgroups
   ,----
   | demo.comments   Demo comments. (Moderated)
   `----

   edit /etc/news/readers.conf
   ,----
   | auth "demo" {
   |     hosts: "*"
   |     default: "<demo>"
   | }
   |
   | access "demo" {
   |     users: "<demo>"
   |     newsgroups: "demo.comments"
   |     access: RPA
   | }
   `----


2.1 enable incoming
~~~~~~~~~~~~~~~~~~~

   edit /etc/news/incoming.conf
   ,----
   | peer other {
   |   hostname:         "HOST_OR_IP_OF_YOUR_CLIENT_WITH_RNEWS"
   | }
   `----

   Replace HOST_OR_IP_OF_YOUR_CLIENT_WITH_RNEWS with your
   usenet-client.home.lab name or IP.
   It will allow usenet-client.home.lab to post news to
   usenet-server.home.lab via rnews.

   restart
   ,----
   | # systemctl stop inn2
   | # systemctl start inn2
   `----


2.2 Server logs
~~~~~~~~~~~~~~~

   ,----
   | # journalctl -u inn2.service
   `----


3 Setup USENET client
=====================

   usenet-client.home.lab

   You may test your USENET server using a USENET client or telnet.

   ,----
   | telnet usenet-server.home.lab 119
   | MODE READER
   | POST
   | //It will return you a Message-ID.
   | // add Message-ID in your manual post
   | Path: hi!not-for-mail
   | From: Home <demo@demo>
   | Newsgroups: demo.comments
   | Date: Fri, 5 Jan 2024 21:29:04 -0000 (UTC)
   | Subject: test
   | Organization: A poorly-installed InterNetNews site
   | Message-ID: <unb5kg$17e$1@usernet-server.dynamic.lab>
   | MIME-Version: 1.0
   | Content-Type: text/plain; charset=UTF-8
   | Content-Transfer-Encoding: 8bit
   |
   | test
   | .
   | QUIT
   `----
   Now, your message should appear in demo.comments news group.


3.1 Install rnews
~~~~~~~~~~~~~~~~~

   Install rnews from source or in Debian based distribution.
   ,----
   | # apt-get install inn2-inews
   `----


3.2 Test rnews
~~~~~~~~~~~~~~

   create test_message.txt
   ,----
   | Path: hi!not-for-mail
   | From: home <demo@demo>
   | Newsgroups: demo.comments
   | Date: Fri, 5 Jan 2024 21:29:04 -0000 (UTC)
   | Subject: test2
   | Message-ID: <unb5kg$19e$1@usenet-client.dynamic.lab>
   |
   | test2
   `----


   post message
   ,----
   | /usr/bin/rnews -h usenet-server.home.lab -P 119 -S 
usenet-server.home.lab < test_message.txt
   `----

   verify the message post status using your usenet reader.


4 Setup local Mail Server
=========================

   usenet-client.home.lab

   Setup local Mail Server for moderation (Sendmail, Exim, others).

   warning: *by default mail server disable email exchange for local IP
   series.*
   If you have local IP series 192.168.0.x, please make sure you allow
   this series for mail exchange.

   Example: in Exim /etc/exim4/exim4.conf.template
   ,----
   | dnslookup:
   |   debug_print = "R: dnslookup for $local_part@$domain"
   |   driver = dnslookup
   |   domains = ! +local_domains
   |   transport = remote_smtp
   |   same_domain_copy_routing = yes
   |   # ignore private rfc1918 and APIPA addresses
   |   ignore_target_hosts = 0.0.0.0 : 127.0.0.0/8 : 192.168.0.0/16 :\
   | 			172.16.0.0/12 : 10.0.0.0/8 : 169.254.0.0/16 :\
   | 			255.255.255.255
   |   no_more
   | .endif
   `----
   remove 192.168.0.0/16 to allow local mail exchange.


4.1 Setup procmail
~~~~~~~~~~~~~~~~~~

   ,----
   | add $HOME/.procmailrc
   | ------------------------
   | DEFAULT=$HOME/Maildir/
   | MAILDIR=$HOME/Maildir/
   | LOCKFILE=$HOME/.lockmail
   | LOGFILE=$MAILDIR/procmail.log
   | LOGABSTRACT=yes
   | VERBOSE=yes
   |
   | :0c
   | | ../YOUR_INCOMING_MAIL_HANDLER
   `----

   "YOUR_INCOMING_MAIL_HANDLER" will read mail via STDIN and save for
   further processing. You need to notify the sender an acknowledgment of
   the submission (automatically or manually).


4.2 Message formatting
~~~~~~~~~~~~~~~~~~~~~~

   If your comment or any header line is too long, it should be
   reformatted to next line with space(s).
   Example:
   ,----
   | HEADER: your long
   | comment for moderation
   `----

   This will fail while posting in newsgroup.

   You need to either make the comment shorter or add space(s) as prefix
   after header line
   ,----
   | HEADER: your long
   |    comment for moderation
   `----


4.3 add custom headers
~~~~~~~~~~~~~~~~~~~~~~

   add your custom headers with the original submission for approval
   ,----
   | X-SCRM-Policy: https://example.com/
   | X-SCRM-Info-1: Send submissions to             demo@example.com
   | X-SCRM-Info-2: Send technical complaints to    demo-admin@example.com
   | X-SCRM-Info-3: Send complaints about policy to demo-board@example.com
   | X-Comment: moderators do not necessarily agree or disagree with 
this article.
   | X-Robomod: YOUR_MODERATION, demo@example.com
   | X-Moderation-1: YOUR moderation tool
   | X-Moderation-2: See https://example.com/
   `----


4.4 add Approved header(s)
~~~~~~~~~~~~~~~~~~~~~~~~~~

   Remove unnecessary header(s) and add approved header before
   submission.
   ,----
   | formail -f	  -I Path:                                    \
   | 		  -I X-Moderate-For:                          \
   | 		  -I Return-Path:                             \
   | 		  -I X-Mailer:                                \
   | 		  -I "Date:"                                  \
   | 		  -I "X-400-Received:"                        \
   | 		  -I Received:                                \
   | 		  -I "From "                                  \
   | 		  -a "Approved: YOUR_APPROVAL_EMAIL"          \
   | 		  -I Lines:                                   \
   | 		  -I Cc:                                      \
   | 		  -I Status:
   |
   | > post_to_send.txt
   `----


4.5 Test Post
~~~~~~~~~~~~~

   Now you can post to your local newsgroup server via rnews.
   ,----
   | /usr/bin/rnews -h usenet-server.home.lab -P 119 -S 
usenet-server.home.lab < post_to_send.txt
   `----

   After successful posting, move the submitted mail submission in a
   different directory to avoid re-posting. You may automate the process
   by implementing scripts and web-interface.

   If you plan to use it in a production/external USENET server, you need
   to add your login password in /etc/news/passwd.nntp
   ,----
   | EXTERNAL_USENET_SERVER_HOST:YOUR_LOGIN:YOUR_PASSWORD
   `----
   Use port with SSL/TLS (563) instead of insecure port 119.


5 Simulate newsgroup post
=========================

   You may use usenet-client.home.lab for testing.
   Send test message with usenet header (using -a).

   You need to set -r --return-address=ADDRESS explicitly.  Otherwise, it
   will send mail as SENDER_USER@localhost and exim will not deliver
   submission response to this account.

   Destination "USER" is the account with procmail configured for
   moderation.
   ,----
   | $ echo "Test message." | mail -s "Test" -r SENDER_USER@EMAILHOST 
'USENETMOD <USER@YOUR_DOMAIN>' -a 'Newsgroups: YOUR_NEWSGROUP'
   `----


6 Develop incoming mail handler
===============================

   Develop YOUR_INCOMING_MAIL_HANDLER to moderate newsgroup posts.
Technical Details
Message-ID: <uokaff$dmqa$1@dont-email.me>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <uojmpn$ajui$1@dont-email.me> <uok08n$3n4mu$1@news.trigofacile.com>

Show Full Headers
Complete Article Headers
Message-ID: <uokaff$dmqa$1@dont-email.me>
Subject: Re: NEWSGROUP MODERATION DEV GUIDE
Date: Mon, 22 Jan 2024 00:47:58 +0100
From: salahuddin <salahuddin66@bell01.com>
References: <uojmpn$ajui$1@dont-email.me> <uok08n$3n4mu$1@news.trigofacile.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: news.software.nntp,news.software.misc
Organization: A noiseless patient Spider
Lines: 370
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 21 Jan 2024 23:47:59 -0000 (UTC)
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:y6zSlWLobagvfqZ2fzs1jafq03A=
Content-Language: en-US
In-Reply-To: <uok08n$3n4mu$1@news.trigofacile.com>