1#!/usr/bin/perl -T 2# $File: //depot/libOurNet/BBS/script/bbsmail $ $Author: autrijus $ 3# $Revision: #1 $ $Change: 3790 $ $DateTime: 2003/01/24 19:08:46 $ 4 5$VERSION = '0.04'; 6$REVISION = "rev$1\[\@$2\]" 7 if ('$Revision: #1 $ $Change: 3790 $' =~ /(\d+)[^\d]+(\d+)/); 8 9use strict; 10 11=head1 NAME 12 13bbsmail - Internet to BBS email-gateway handler 14 15=head1 SYNOPSIS 16 17In F</usr/local/etc/bbs.rc> or F</etc/bbs.rc>; 18 19 # $DUMP = '/tmp/msgdump.tmp'; # Dump message to disk; halt 20 $MAIL_LOG = '/var/log/bbsmail.log'; # Log of bbsmail 21 $BOARD_LOG = '/var/log/bsboard.log'; # Log of bbsboard 22 $SIZE_LIMIT = 204800; # size limit of attachments 23 24 # Set virutal hosts; The C<bbs.> prefix of keys should be omitted. 25 %DOMAINS = ( 26 'elixus.org' => { 27 BASEURL => 'http://elixus.org', 28 WWWHOME => '/srv/www/elixir', 29 PARAM => ['MELIX', '/home/melix'], 30 OWNER => 'melix', 31 GROUP => 'melix', 32 }, 33 'cvic.org' => { 34 BASEURL => 'http://cvic.org', 35 WWWHOME => '/srv/www/cvic', 36 PARAM => ['CVIC', '/srv/bbs/cvic', 37 1003, 2500, 1005, 250, 1004, 50000], # needs utmp 38 OWNER => 'cvic', 39 GROUP => 'bbs', 40 }, 41 'm543.com' => { 42 BASEURL => 'http://m543.com', 43 WWWHOME => '/srv/www/m543', 44 PARAM => ['CVIC', '/srv/bbs/m543', 45 1103, 2500, 1105, 250, 1104, 50000], # needs utmp 46 OWNER => 'cvic', 47 GROUP => 'bbs', 48 }, 49 ); 50 51 # multiple domains, same IP 52 $DOMAINS{'m543.org'} = $DOMAINS{'music543.org'} = 53 $DOMAINS{'music543.com'} = $DOMAINS{'m543.com'}; 54 55 # fallback using the 'true' hostname 56 $DOMAINS{'geb.elixus.org'} = $DOMAINS{'elixus.org'}; 57 58 # default domain for in-site mails 59 $DEFAULT_DOMAIN = 'elixus.org' 60 61To configure it with sendmail, modify F<sendmail.cf> like this: 62 63 ###################################### 64 ### Ruleset 0 -- Parse Address ### 65 ###################################### 66 67 R$+.bbs < @ $=w .> $#bbsmail $: $1 bbs mail gateway 68 R$+.board < @ $=w .> $#bbsboard $: $1 bbs board gateway 69 70 # handle locally delivered names 71 72 R$+.bbs $#bbsmail $:$1 bbs mail gateway 73 R$+.board $#bbsboard $:$1 bbs board gateway 74 75 ################################################## 76 ### Local and Program Mailer specification ### 77 ################################################## 78 79 Mbbsmail, P=/usr/local/bin/bbsmail, F=lsSDFMuhP, S=10, R=20, 80 A=bbsmail $u 81 Mbbsboard, P=/usr/local/bin/bbsboard, F=lsSDFMuhP, S=10, R=20, 82 A=bbsboard $u 83 84To feed it a MIME mail directly at the command line: 85 86 % bbsmail < message.txt 87 88=head1 DESCRIPTION 89 90This script relays e-mails sent to C<*.bbs@domain> as mails to 91BBS user mailboxes; it is designed to be a drop-in replacement for 92the MAPLE BBS utility of the same name. 93 94This program could be used serve multiple BBS sites, each distinguished 95by its domain name. MIME encodings, multipart messages, quoted words 96are all handled correctly. 97 98If supplied with a web directory, attachments could be saved for 99later download. You could restrict the max. allowed size of each 100attachments. 101 102If the optional C<HTML::Parse> and C<HTML::FromText> modules were 103installed, HTML-only mails and simple HTML attachments could be 104rendered as plain text. 105 106=head1 CAVEATS 107 108Currently this script does not check proper permissions; you could 109use the C<OurNet> backend to achieve restricted permission. See 110L<bbscomd> for how to run an OurNet node. 111 112However, authentication is currently not implemented; while sending 113password via e-mail is easy, the author finds it distasteful. A 114proper way to parse PGP-signed mail might be the only viable route, 115and any contributions on that front will be most welcomed. 116 117=cut 118 119our ($Postfix, $Element, $Container) = qw/.bbs users mailbox/; 120 121my $exec = 'bbsboard'; 122my $path = $1 if $0 =~ m|^(.+)/|; 123 124do "$path/$exec" or die "can't execute $path/$exec: $@"; 125 1261; 127 128__END__ 129 130=head1 SEE ALSO 131 132L<OurNet::BBS>, L<bbsboard>. 133 134=head1 AUTHORS 135 136Autrijus Tang E<lt>autrijus@autrijus.orgE<gt> 137 138=head1 COPYRIGHT 139 140Copyright 2001-2002 by Autrijus Tang E<lt>autrijus@autrijus.orgE<gt>. 141 142This program is free software; you can redistribute it and/or 143modify it under the same terms as Perl itself. 144 145See L<http://www.perl.com/perl/misc/Artistic.html> 146 147=cut 148