Fidonet / Exim / Newsd
I find Fidogate a somewhat hairy package to setup and work with, so I have
made a series of simpler scripts to bind parts of Fidogate together with
Exim, Newsd nntp server, binkd and procmail.first step is to add a new user fidoman, and add the following to his .procmailrc
:0:*|/usr/bin/rfc2ftn -t# converts printed quotable and stripe mime first, might be needed#| printquoted.pl | stripmime.pl | /web/fido/rfc2ftn -t
Any mail send to the user fidoman will now be converted to fidomailNow we need to tell exim how it should handle ftn style mails
# rfc2ftn routing# routing fidomail address through fidopipe as user fidoman# maches on ftn_host file#fidoroute:debug_print = "R: ftn_hosts_up for $local_part@$domain"driver = manualroutedomains = !+local_domains : partial-lsearch;/etc/exim/ftn_host#no_moreroute_data = ${lookup{$domain}partial-lsearch{/etc/exim/ftn_host}}user = fidomantransport = procmail_fidopipe## transporter for email to fidonet# actual delivery handled in fidoman procmail#procmail_fidopipe:driver=pipecommand = /usr/bin/procmailuser = fidomangroup = users
ftn_host file, handles the mapping of fidonet address so everything is send to fidoman
*.z1.fidonet.org fidoman@your domain*.z2.fidonet.org fidoman@your domain*.z3.fidonet.org fidoman@your domain*.z4.fidonet.org fidoman@your domain*.z5.fidonet.org fidoman@your domain*.z6.fidonet.org fidoman@your domain*.z1.binkp.net fidoman@your domain*.z2.binkp.net fidoman@your domain*.z3.binkp.net fidoman@your domain*.z4.binkp.net fidoman@your domain*.z5.binkp.net fidoman@your domain*.z6.binkp.net fidoman@your domain
Next up is newsd config, only two things needs to be changed from the default settings
## SendMail: specifies the mail command to use when sending email.#SendMail /usr/sbin/sendmail -odb -oee -oi -f fidoman -pFIDOGATE:gateway -t## SpamFilter: specifies a filter program which will receive a copy of the# submitted message and should return 0 if the message is OK and non-zero# if it is spam.## Example (for SpamAssassin):## SpamFilter spamc -c#SpamFilter /usr/local/fidogate/lib/rfc2ftn -n
Script to call up binkd and download your fidomail
#/bin/shBOSS="x:xxx/xx"CONFIG="/etc/binkd.cfg"binkd -p -P $BOSS $CONFIG
fidopoll.shunpacks fidomail packets, converte everything to rfc and forward the emails.
#!/bin/bash# take the rfc mail files generated by ftn2rfc and proc themRFCPATH="/web/fido/fidogate/var/spool/fidogate/outrfc/mail/"PKTPATH="/web/fido/out"# move pkg pulled by fidopoll.sh#unpack filesunzip '$PKTPATH/*.mo*' -d $PKTPATHunzip '$PKTPATH/*.tu*' -d $PKTPATHunzip '$PKTPATH/*.we*' -d $PKTPATHunzip '$PKTPATH/*.th*' -d $PKTPATHunzip '$PKTPATH/*.fr*' -d $PKTPATHunzip '$PKTPATH/*.sa*' -d $PKTPATHunzip '$PKTPATH/*.su*' -d $PKTPATH# convert files to mails# -1 for single posts/usr/local/fidogate/lib/ftn2rfc -1# post any mails to usDIR="$(ls ${RFCPATH})"for filename in ${DIR} ; do/usr/sbin/sendmail -odb -oee -oi -pFIDOGATE:gateway -t < $RFCPATH$filename rm $RFCPATH$filenamedone# remove packages after done with themrm $PKTPATH/*.mo*rm $PKTPATH/*.tu*rm $PKTPATH/*.we*rm $PKTPATH/*.th*rm $PKTPATH/*.fr*rm $PKTPATH/*.sa*rm $PKTPATH/*.su*
ftninpost.shMoves echomails into the newsd structure, add new groups if needed.
#!/bin/bash## parserfc.sh## convert rfc news file from ftn2rfc to newsd# styled structured directories#nntpdir=/web/fido/spool/newsdoutrfc=/web/fido/fidogate/var/spool/fidogate/outrfc/newsdomain="telefisk.org"owner=fidomangroup=users## scan all files looking for new echomail groups# Build directory structure and populate the directories# with the .info, .config. .name files#findnewgroup(){cd $outrfclist=(`head -n10 * | egrep -i "X-FTN-Area|Newsgroups:" |\ cut -d " " -f 2 |awk '{ split($0,a,"."); print a[1]"/"a[2] } ' |\ sort | uniq`)for name in "${list[@]}"do# build hirahiif [ -x $nntpdir/$name ];then echo "$name already there"else echo "$name missing" cd $nntpdir mkdir -p $name echo "start 1" > $name/.info echo "end 1" >> $name/.info echo "total 1" >> $name/.info echo "$name" > $name/.name echo "$name" > $name/.config echo "postok 1" >> $name/.config echo "replyto $name@t$domain" >> $name/.config echo "0" > $name/.indexfidone}## move single news posts to the right directory# and update .index file accordingly#movenews(){# scan and movenum=0cd $outrfclist=(`ls $outrfc/*.rfc`)# for each file in the data runfor filename in "${list[@]}"doarea=(`head -n10 $filename | egrep -i "X-FTN-Area|Newsgroups:" | \cut -d " " -f 2 |awk '{ split($0,a,"."); print a[1]"/"a[2] } ' | \sort | uniq`) if [ $nntpdir/$area/.index ];then read NUM < $nntpdir/$area/.index let NUM+=1# only copy for now, later mv them mv $filename $nntpdir/$area/$NUM echo $NUM > $nntpdir/$area/.index else # new index file echo "1" > $nntpdir/$area/.index chown $owner:$group $nntpdir/$area/.index fidone}## update .info file for newsd , with the total numbers# posts in each directory.#updateconfig(){cd $nntpdirlist=(`du -a $nntpdir | grep .index | cut -f 2 | \awk '{ split($0,a,".in"); print a[1] }'`)# for each file in the data runfor filename in "${list[@]}"do read total < $filename/.index echo "start 1" > $filename/.info echo "end $total" >> $filename/.info echo "total $total" >> $filename/.infodone}#main partfindnewgroupmovenewsupdateconfig
parserfc.sh