updated: 2024-01-20 Sat 00:00

NetUseMod


NetUseMod - web-based USENET newsgroup moderation tool.

$ git clone https://dynamicmalloc.com/cgit/netusemod.git

Install news packages

1. copy NetUseMod to your $HOME.

2. Install rnews (part of inn2-inews package)
   Debian:
   # apt-get install inn2-inews

3. setup rnews username, password in /etc/news/passwd.nntp
   edit /etc/news/inn.conf host, port, etc.

4. You need to ask your USENET_SERVER_HOST provider to allow you to post with "Approved:" header for the newsgroup you are moderating.
   You also might need to set reverse DNS for your domain.

procmail configuration

5. After you configured incoming mail for your user account.

   $ cp NetUseMod/procmailfilter/procmailrc $HOME/.procmailrc

   adjust your "process_incoming.pl" location in .procmailrc

   after testing you may change the values to no in .procmailrc
   LOGABSTRACT=yes
   VERBOSE=yes

4. edit and adjust the following files as needed.

   "NetUseMod/scripts/mail_format.sh" - adjust email, domain, etc.

   "NetUseMod/scripts/process_incoming.pl"
   ---------------------------------------
   my $message_dir = 'YOUR_HOME_DIR/incoming_news/';
   my $noreply_mail = 'no-reply@YOUR_DOMAIN';


5. create necessary directories
   $ cd $HOME
   $ mkdir incoming_news processed_news rejected_news

setup web-framework and configure

6. Web interface setup.
   Install https://metacpan.org/pod/Dancer2 or in Debian based distro
   # apt-get install libdancer2-perl


7. edit NetUseMod/web/NetUseAdminWeb/lib/NetUseAdminWeb.pm
   adjust the following variables.

   my $usenet_host = 'YOUR_USENET_PROVIDER';
   my $usenet_port = '119';    # production 536 ssl
   my $rnews_location = '/usr/bin/rnews';

   my $noreply_mail = 'no-reply@YOUR_DOMAIN';

   my $mail_format = 'YOUR_HOME_DIR/NetUseMod/script/mail_format.sh';
   my $admin_user = 'XXXXXXXX';
   my $admin_pass = 'XXXXXXXX';

   my $dir_base = 'YOUR_HOME_DIR';
   my $dir_incoming = 'incoming_news';
   my $dir_processed = 'processed_news';
   my $dir_rejected = 'rejected_news';

Test server

8. note: rnews might need root priviledges by default.
   # plackup NetUseMod/web/NetUseAdminWeb/bin/app.psgi

   You try to browse:
   http://HOST_OR_IP:5000/

   You can login using your $admin_user and $admin_pass.

Configure apache2

9. If you want to use apache2

   Install apache perl module
   # apt-get install libapache2-mod-perl2

   enable rewrite module
   # /usr/sbin/a2enmod rewrite

   move NetUseAdminWeb/ to /opt/
   # chown -R www-data:www-data /opt/NetUseAdminWeb/

   create entry in apache configruation
   example: /etc/apache2/sites-enabled/default-ssl.conf

   <Location "/netusemod">
      SetHandler perl-script
      PerlResponseHandler Plack::Handler::Apache2
      SetEnv DANCER_ENVIRONMENT "production"
      PerlSetVar psgi_app /opt/NetUseAdminWeb/bin/app.psgi
      RewriteEngine On
      RewriteBase /
   </Location>

   restart apache
   # systemctl restart apache2


10. make sure "/usr/bin/rnews" can be executed from perl web framework. (www-data user in case of apache2)
    If needed add user to proper group.
    Another option, run plackup as super user, listen in localhost, and use apache2 proxy to allow access form outside with ssl.

Generate test mail

11. Test - You may send test message with usenet header (using -a) to test your system.
    please edit NetUseMod/web/NetUseAdminWeb/lib/NetUseAdminWeb.pm to avoid posting in usenet server.
    my $post_to_usenet = 0;

    $ echo "Test message." | mail -s "Test" -r SENDER_USER@EMAILHOST 'USENETMOD <USER@YOUR_DOMAIN>' -a 'Newsgroups: YOUR_NEWSGROUP'