Add mail-in and onion.pl

This commit is contained in:
Deon George 2021-04-23 23:16:36 +10:00
parent f5f527455a
commit 01ab961caa
2 changed files with 90 additions and 0 deletions

76
tools/mail-in.sh Executable file
View File

@ -0,0 +1,76 @@
#!/bin/bash
# This script will toss incoming mail received from binkd (unless ${SEMADIR}/notoss exits) after a 5 second delay.
# Written by deon - Alterant BBS - April 2020
SEMADIR=/fido/semafore
SEMAFORE=${SEMADIR}/tossing
# For QICO calls
if [ $# -gt 0 ]; then
touch ${SEMADIR}/tossmail
fi
# If we are configured not to toss
[ -e ${SEMADIR}/notoss ] && exit
(
# Delay our start so binkd has time to finish and create the semafore
sleep 5
# Force a run anyway, if our semafore is old.
NOW=$(($(date '+%s')-300))
STAT=$(test -e ${SEMAFORE} && stat -c %Y ${SEMAFORE} || echo 0)
IN=/fido/mailer/in
INBAK=/fido/mailer/in.backup
if [ -e ${SEMADIR}/backup ]; then
cp -rl ${IN} ${INBAK}
fi
# Dont toss if already doing it.
if [ ! -e ${SEMAFORE} -o ${NOW} -ge ${STAT} ]; then
touch ${SEMAFORE}
# Inbound mail to toss
if [ -e ${SEMADIR}/tossmail ]; then
rm -f ${SEMADIR}/tossmail
hpt toss
fi
# Debugging - not sure how we use this file
if [ -e /var/log/fido/echotoss.log ]; then
cp /var/log/fido/echotoss.log /tmp/
fi
# If our filter created some messages, we should look for those.
if [ -e ${SEMADIR}/newhtick.now ]; then
rm -f ${SEMADIR}/newhtick.now
htick scan && touch ${SEMADIR}/newnet.now
fi
# If our filter created some messages, we should look for those.
if [ -e ${SEMADIR}/newecho.now ]; then
rm -f ${SEMADIR}/newecho.now
sleep 1
hpt scan
fi
# If our filter created some messages, we should look for those.
if [ -e ${SEMADIR}/newnet.now ]; then
rm -f ${SEMADIR}/newnet.now
sleep 1
hpt pack
hpt pack # For some reason htick messages dont get packed the first time?
fi
# Inbound files to toss
if [ -e ${SEMADIR}/tossfile ]; then
rm -f ${SEMADIR}/tossfile
htick toss
fi
# All done for this run...
rm -f ${SEMAFORE}
fi
) &

14
tools/onion.pl Executable file
View File

@ -0,0 +1,14 @@
sub on_call
{
if ($config{"tor-proxy"}) {
foreach (split(/;/, $hosts)) {
if ($_ =~ /\.onion\z/) {
$hosts = $_;
$socks = $config{"tor-proxy"};
Log(4, "using tor-proxy $socks for .onion address");
}
}
}
return 1;
}