#!/usr/local/bin/perl -T ## ## COTSE Pseudo-Anonymous Usenet. ## Version 2.02 ## July 11, 2000 ## ## This is copyright 2000 Stephen K. Gielda. ## http://www.cotse.com ## steve@cotse.com ## ## This script is set up to be a pseudo-anonymous gateway to usenet, but it can just ## as easily be used for a regular e-mail interface. When we offered psuedo-anon ## e-mail I used this script. All that was required was the addition of a field on ## the form for To. Then comment out the $to variable setting in the user customizable ## section and you have an e-mail interface. ## ## This is made available to use freely. It may not be rereleased without including ## this header in its entirety. ## ## Cotse maintains no liability over anything that may result from your use of this. ## You are fully responsible for understanding all possible implications of running it. ## ## Setup: ## ## This script requires the following Perl Modules ## ## CGI.pm ## Form.pm ## URI.pm ## ## Create a directory to store ban databases (ie. /home/blockit). This directory must ## be read/write by the user ID of the web server (typically user nobody). ## ## Create a directory to store session keys (ie. /home/anonnewskeys). This must also ## be read/write by the user ID of the web server. ## ## Change appropriate user configuration variables listed below. ## ########################################################################################## ## Set the path for security and taint checking. $ENV{'PATH'} = "/usr/bin:/bin"; use CGI::Carp; use CGI::Form; use strict; ## Variable initializations (for use strict). my ($to,$mheader,$refs,$BLK,$IBLK,$admin,$from,$mult1,$mult2); my ($test1,$from1,$addr,$xtra1,$xtra2,$subject,$body,$sendmail,$query); my ($file_name,$number_to_ban,$max_time,$group,$total_max_time); my ($HEADER, $FOOTER, $blockpath, $scriptpage, $pagename, $xabuse, $org, $randfile); my ($FST,$SND,$TRD,$FTH,$classa,$classb,$classc,$ISBLK,$FBLK, $runline); my ($outfile, $key, $scriptname, $abusepage, $sessdir, $sessexp, $offline); ## Seed random number generator. srand(time() ^ ($$ + ($$<<15)) ); ## Randomize filename for server key. $randfile = randname(); ################### Begin user customizable entries ##################### ## Take service down - Reason set automatically takes service offline with that ## reason. Uncomment to activate. # $offline = "Temporarily down. Please check back later."; ## Name of the service. $pagename = "COTSE Pseudo-Anonymous News"; ## scriptpage is for use when calling cgi from your own html form. ## I do this on cotse with an exec cgi SSI tag. ## If doing that then the scriptpage is set to the html form. ## If not using an html form, set scriptpage to be the same as scriptname. $scriptpage = "http://anon.cotse.com/anonnews.htm"; ## Name of the script. $scriptname = "http://anon.cotse.com/cgi-bin/anonnews.cgi"; ## Path to policies page $abusepage = "http://anon.cotse.com/cgi-bin/blockit.cgi"; ## Please adjust the following to point to your domain and addresses. I do not want ## abuse mail from a service someone else runs, I'll chase you down :) $from = "anonymous\@cotse.com"; $to = "mail2news\@zedz.net"; $xabuse = "abuse\@cotse.com"; $org = "Cotse"; $admin = "steve\@cotse.com"; ## Path to sendmail $sendmail = "/usr/lib/sendmail"; ## Path to files storing blocked newsgroups and IP's. ## This directory must be writable by the user ID that the web ## server operates under (typically nobody). $blockpath="/usr/local/blockit"; ## These files are simple text files of newsgroups or IPs in a column format. ## Unlike other files within that directory, these are manually administered. ## files must be readable by user nobody or the user which web daemon runs under. ## They do not need to be writeable by this user, it is probably better if they aren't. ## ## Functional Files: ## ## blockit.txt - for blocking posts to specified newsgroups ## ipblock.txt - for blocking an IP from using the interface ## classcblock.txt - for blocking a class c range from using the interface. ## classbblock.txt - for blocking a class b range from using the interface. ## classablock.txt - for blocking a class a range from using the interface. ## forgeblock.txt - to force from line of Anon in specified newsgroups. ## Set header for pages. $HEADER = "
Form exited with error: $!, please go back in your\n"; print "browser and resubmit the email form or report the error\n"; print "to the administrator $admin<\/a>\n"; print "
\n"; print $query->end_html(), "\n"; ## CGI::Carp makes semi-useful error entries in the httpd error log. die "Anon News exited with error: $!\n"; }; ## Print message to sendmail print MAIL <<"EOHF"; To: $to From: "$from1" <$from> Subject: $subject Newsgroups: $mheader References: $refs Organization: $org X-Anon-1: This is a pseudo-anonymous message, the sender cannot be verified. X-Anon-2: It did not originate from any address listed in the message. X-Abuse-to: $xabuse X-Comments: Anonymous mail2news gate web interface - $scriptpage. X-Comments-2: Our policies about abuse - $abusepage $xtra1 $body EOHF close(MAIL); ## Check exit status. if($?) { print $query->header(); print $query->start_html(-title => "Error Posting", -author => $admin); print "Error: $!, please go back in your\n"; print "browser and correct the form or report the error\n"; print "to the administrator $admin<\/a>\n"; print "
\n"; print $query->end_html(), "\n"; ## Make entry for error in httpd log. croak "Sendmail exited with error: $!\n"; ## Page to display if successful. } else { print $query->header(); print $query->start_html(-title => "Your Post has been sent.", -author => $admin); print "