diff --git a/tools/mail-in.sh b/tools/mail-in.sh new file mode 100755 index 0000000..b969f89 --- /dev/null +++ b/tools/mail-in.sh @@ -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 +) & diff --git a/tools/onion.pl b/tools/onion.pl new file mode 100755 index 0000000..d7d8dc3 --- /dev/null +++ b/tools/onion.pl @@ -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; +}