1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
NetUseMod is a program to moderate Usenet posts via web interface.
Copyright (C) 2024 Salahuddin <salahuddin@member.fsf.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
INSTALL
--------
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.
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
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';
also make sure these directories have proper permissions.
8. Test server.
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.
9. If you want to use apache
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.
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'
|