Initial checkin.

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2022-01-29 10:22:11 +01:00
commit 30132626b8
68 changed files with 5497 additions and 0 deletions

4
etc/skel/.bashrc Normal file
View file

@ -0,0 +1,4 @@
#!/bin/bash
export HUHU_DIR="@HUHU_DIR@"
export PERL5LIB="${PERL5LIB:+$PERL5LIB:}${HUHU_DIR}"
export PATH="${PATH}:${HUHU_DIR}/bin"

10
etc/skel/.cshrc Normal file
View file

@ -0,0 +1,10 @@
#!/bin/csh -x
setenv EDITOR /usr/bin/vim
setenv GREP_OPTIONS '--color=auto'
setenv LC_CTYPE C
setenv LANGUAGE en_US
setenv LANG "${LANGUAGE}.iso885915"
setenv HUHU_DIR "@HUHU_DIR@"
setenv PERL5LIB "${HUHU_DIR}"

4
etc/skel/.forward Normal file
View file

@ -0,0 +1,4 @@
#
# Save this file as $HOME/.forward to enable $HOME/.procmailrc
#
"|exec /usr/bin/procmail"

3
etc/skel/.my.cnf Normal file
View file

@ -0,0 +1,3 @@
[client]
user=@MYSQL_USERNAME@
password=@MYSQL_PASSWORD@

18
etc/skel/.procmailrc Normal file
View file

@ -0,0 +1,18 @@
HUHU_DIR="@HUHU_DIR@"
CONFIG="${HOME}/etc/public.conf"
LOGFILE="${HOME}/var/procmail.log"
PATH="/usr/bin:/bin:${HUHU_DIR}/bin"
PERL5LIB="${HUHU_DIR}"
VERBOSE=yes
# save mails in backup directory
:0 c
backup
# trim backup directory
:0 ic
| cd backup && rm -f dummy `ls -t msg.* | sed -e 1,32d`
:0
| "${HUHU_DIR}/bin/read-mail.pl" "-config=${CONFIG}" -stdin

0
etc/skel/backup/EMPTY Normal file
View file

16
etc/skel/bin/poster.sh Normal file
View file

@ -0,0 +1,16 @@
#!/bin/sh
#
# This script tries to send all messages of status 'moderated' to the
# news server. This should be a safe operation, i.e. it is not possible
# to produce duplicates.
#
# Use this script for testing or after a configuration error.
#
export "LANG=C"
export "LC_CTYPE=C"
set -o nounset
set -o errexit
export HUHU_DIR="@HUHU_DIR@"
export PERL5LIB="${PERL5LIB:+$PERL5LIB:}${HUHU_DIR}"
"${HUHU_DIR}/bin/poster.pl" "$HOME/etc/public.conf"

16
etc/skel/bin/read-mail.sh Normal file
View file

@ -0,0 +1,16 @@
#!/bin/sh
#
# This script tries to load all messages in the backup directory into the
# database. Because of the md5sum check this should be a safe operation,
# i.e. it is not possible to produce duplicates.
#
# Use this script for testing or in case the procmail rules were defunct.
#
export "LANG=C"
export "LC_CTYPE=C"
set -o nounset
set -o errexit
export HUHU_DIR="@HUHU_DIR@"
export PERL5LIB="${PERL5LIB:+$PERL5LIB:}${HUHU_DIR}"
"${HUHU_DIR}/bin/read-mail.pl" "-config=$HOME/etc/public.conf" "$HOME/backup"/*

View file

@ -0,0 +1,10 @@
#!/bin/sh
export "LANG=C"
export "LC_CTYPE=C"
set -o nounset
set -o errexit
export HUHU_DIR="@HUHU_DIR@"
export PERL5LIB="${PERL5LIB:+$PERL5LIB:}${HUHU_DIR}"
HTMLDIR=@HUHU_WWW_BASE_DIR@/@WWW_DIR@
"${HUHU_DIR}/bin/statistics.pl" "${HOME}/etc/public.conf" > "${HTMLDIR}/stats/stats.txt"

0
etc/skel/etc/htdigest Normal file
View file

2
etc/skel/etc/htdigest.sh Normal file
View file

@ -0,0 +1,2 @@
#!/bin/sh
htdigest "@USER_HOME@/etc/htdigest" "@USER_NAME@" "$@"

67
etc/skel/etc/private.conf Normal file
View file

@ -0,0 +1,67 @@
# Private configuration file. Contains sensitive data.
# Should be readable only by to the owner, i.e. by cronjobs
# and the procmail-scripts.
# for removeold.pl
delete_spam_after=7
delete_error_after=3
delete_posting_after=90
# Duplicates older than this number of days are OK,
# Note: value must be less equal delete_posting_after.
check_duplicates_age=7
# If the public configuration file does not have mysql_password
# then list it here.
mysql_password=@MYSQL_PASSWORD@
# for poster.pl
nntp_user=
nntp_pass=
nntp_server=localhost
# For poster.pl. Note that both passphrase and keyid must be defined
# to sign posts.
pgp_passphrase=@MODERATED_GROUP_ABBR@@YEAR@
pgp_keyid=Moderation of @MODERATED_GROUP@ <@SUBMISSION_EMAIL@>
# mailget.pl reads mails from this POP account. (Not used by read-mail.pl)
mod_pop_server=
mod_pop_username=
mod_pop_pass=
# Use spamassassin: 1 -> Yes, 0 -> No.
spamassassin=1
# Compare subject with subjects of classified spam posts?
# subjectcheck: 1 -> Yes, 0 -> No.
subjectcheck=1
subjectscore=7
# Check for binaries and HTML attachments?
# attachmentcheck: 1 -> Yes, 0 -> No.
attachmentcheck=1
attachmentscore=7
# Language of target group (de, en)
lang=
# Check submissions whether they match the language of the target group
# (works only with German).
# langcheck: 1 -> Yes, 0 -> No.
langcheck=0
langscore=3
# autoreply.pl
# Hours until author of pending post is notified by mail.
min_time_until_autoreply=
# Hours until pending posts are ignored by autoreply.pl
max_time_until_autoreply=
# ircbot.pl
ircbot_nick=@MODERATED_GROUP_ABBR@-bot
ircbot_realname=ircbot.pl
ircbot_username=@USER_NAME@
ircbot_server=irc.freenode.net
ircbot_port=6667
ircbot_channel=#@USER_NAME@

50
etc/skel/etc/public.conf Normal file
View file

@ -0,0 +1,50 @@
# This is the public config file.
# It must be readable by the CGI scripts, i.e. by the web server.
# No sensitive data should be included here.
# path to the private config file
priv_config_file=@USER_HOME@/etc/private.conf
# UID required to read private data
UID=@USER_ID@
# Approved posts are posted to this group
moderated_group=@MODERATED_GROUP@
# Note: Specifying mysql_password here is a security risk since every
# script running in the context of the web server can read it. The
# alternative is the set environment variable 'mysql_password' through
# the Apache configuration.
mysql_host=localhost
mysql_port=3306
mysql_username=@MYSQL_USERNAME@
mysql_table=@MYSQL_TABLE@
mysql_db=@MYSQL_DB@
# posts listed per page
display_per_page=20
# Value of header "Approved:" in posts
approve_string=@SUBMISSION_EMAIL@
# Right hand side of message IDs in in posts.
# Empty value means that the news server generates the ID.
mid_fqdn=
# Value of header "From:" in rejection notices.
mailfrom=@SUBMISSION_EMAIL@
html_content_type=iso-8859-15
html_stylesheet_href=/huhu.css
html_language=en-us
http_negotiate_language=0
# Available methods
# Digest ... Password are checked by Apache, password file is maintained
# by 'htdigest', see samples/apache-digest.conf
# None ... No password, IP address is taken for username
http_authentication_method=Digest
# ircbot.pl
ircbot_notify_sock=@USER_HOME@/var/ircbot.socket

View file

@ -0,0 +1,11 @@
<Directory "@HUHU_WWW_BASE_DIR@/@WWW_DIR@">
SetEnv HUHU_PUB_CONFIG "@USER_HOME@/etc/public.conf"
SetEnv mysql_password "@MYSQL_PASSWORD@"
<Files "modtable.pl">
AuthType Digest
AuthName "@USER_NAME@"
AuthDigestProvider file
AuthUserFile "@USER_HOME@/etc/htdigest"
Require valid-user
</Files>
</Directory>

View file

@ -0,0 +1,29 @@
#
# Note: the right hand side of assignments is a literal string, i.e.
# variable references like "$HOME" are not expanded.
#
# MAILTO=administrator@webinterface.site
HUHU_DIR="@HUHU_DIR@"
PERL5LIB="@HUHU_DIR@"
CONFIG="@USER_HOME@/etc/public.conf"
BINDIR="@HUHU_DIR@/bin"
# HTMLDIR=/srv/www/html
# mailget.pl reads incoming mail via POP3, stores them in database.
# If you use procmailrc then you don't need this.
# */5 * * * * "$BINDIR/mailget.pl" "$CONFIG"
# Reads database, sends outgoing messages via NNTP.
*/5 * * * * "$BINDIR/poster.pl" "$CONFIG"
# Show number of posts and reaction time.
# 3 * * * * "$BINDIR/statistics.pl" "$CONFIG" > "$HTMLDIR/stats/stats.txt"
# Remove old records from database
5 3 * * * "$BINDIR/removeold.pl" "$CONFIG"
# Reads database, sends reply to authors of pending messages.
# 10 * * * * "$BINDIR/autoreply.pl" "$CONFIG"
# Reads database, announces incoming mail in IRC channel.
# @reboot "$BINDIR/ircbot.sh" start

View file

@ -0,0 +1,17 @@
<table class="huhuPostList">
<tr>
<th>Group</th>
<th>Language</th>
<th colspan="2">Web Interface</th>
<th>Statistics</th>
<th>Established</th>
</tr>
<tr>
<td>@MODERATED_GROUP@</td>
<td>en-us</td>
<td><a href="@HUHU_WWW_BASE_URL@/@WWW_DIR@/public.pl">public</a></td>
<td><a href="@HUHU_WWW_BASE_URL@/@WWW_DIR@/modtable.pl">private</a></td>
<td><a href="@HUHU_WWW_BASE_URL@/@WWW_DIR@/stats/stats.txt">reaction time</a></td>
<td>@TODAY@</td>
</tr>
</table>

View file

@ -0,0 +1,68 @@
== Email ==
The submission address is <@SUBMISSION_EMAIL@>.
Messages are directly processed by procmail, so you cannot access it
with POP or IMAP. (Messages are saved in a backup directory as plain
files, though.)
You can test Huhu by sending posts directly to this address.
When tests are finished you should send a message stating that
<@SUBMISSION_EMAIL@> is the new submission address of
@MODERATED_GROUP@ to <moderators-request@isc.org>.
== Web Interface ==
The web interface consists of two parts. The public part is accessible
to everybody. It just displays the approved posts.
@HUHU_WWW_BASE_URL@/@WWW_DIR@/public.pl
And then there is the private part. This is protected with a login.
using the HTTP digest system.
@HUHU_WWW_BASE_URL@/@WWW_DIR@/modtable.pl
HTTP digest is safe to use on unencrypted connections, but for additional
paranoia above URLs are also available through https (with a self signed
certificate).
There is currently no way to handle user management through the web
interface. I created one account for you:
Username:
Password:
== Test Mode ==
At the moment this instance of Huhu is in test mode. Approved messages
are sent to albasani.test.moderated. This is an internal group, i.e.
it is not sent to peers. You need an albasani-account to read it.
When you are satisfied with your tests please give me a note.
I will then switch to @MODERATED_GROUP@.
== Configurable Options ==
The following settings are set to default values.
Please give me a note if you want to have them changed.
# Value of header "Approved:" in posts
approve_string=@SUBMISSION_EMAIL@
# Right hand side of message IDs in in posts.
# Empty value means that the news server generates the ID.
mid_fqdn=
# Value of header "From:" in rejection notices.
mailfrom=@SUBMISSION_EMAIL@
== Usenet Account ==
Username: @SUBMISSION_EMAIL@
Password:
Server : news.albasani.net
It has permissions to send approved posts to albasani.test.moderated
and @MODERATED_GROUP@. Use it to bypass the moderation (e.g. send FAQs
or cancel messages) or to read the internal albasani.* groups.

0
etc/skel/var/EMPTY Normal file
View file