Forum Moderators: coopster & phranque

Message Too Old, No Replies

help with formmail!

how do i stop it checking the referer?

         

soapystar

5:14 am on Jun 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi!
i am using nms formmail for my forms.Or at least im trying to.This is how it looks in the top part of the form

$DEBUGGING = 1;
$emulate_matts_code= 0;
$secure = 1;
$allow_empty_ref = 1;
$max_recipients = 5;
$mailprog = '/usr/lib/sendmail -oi -t';
@referers = qw(dave.org.uk 209.207.222.64 localhost);
@allow_mail_to = qw(you@your.domain some.one.else@your.domain localhost);
@recipients = ();
%recipient_alias = ();
@valid_ENV = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
$locale = '';
$date_fmt = '%A, %B %d, %Y at %H:%M:%S';
$style = '/css/nms.css';
$send_confirmation_mail = 0;
$confirmation_text = <<'END_OF_CONFIRMATION';

Now what i want to do is stop the check for refererers.Since if a firewall is blocking the check it doesnt work.I tried simply deleting the line..

@referers = qw(dave.org.uk 209.207.222.64 localhost);

but it doesnt stop the check,which i dont understand!.do i need to set it as ..

@referers = qw(o);?

or what?

DrDoc

6:40 am on Jun 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Further down in the script you have the following line:

&check_url;

Just comment the line like this ..

# &check_url;

That's all you have to do :)

soapystar

10:26 am on Jun 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



many thanks!

Crazy_Fool

10:29 am on Jun 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



referers is there to prevent people remotely accessing the formmail script and relaying spam mail through it. the idea is to set referer to your server IP address or domain or the URL of the form calling formmail so that formmail can only be used from the web form on your site, and can therefore only be used for the purpose you installed it for. i would guess that this isn't a firewall problem, more likely you haven't set referer properly to allow the correct referring URL or IP. what makes you think it's the firewall causing the problem?

soapystar

12:02 pm on Jun 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



referers is set to my webpage.But running the script brings up the error that my firewall..which it calls by name has blocked the referer.Turning off the firewall has the script running fine.No point in having people who wish to leave there security intact unable to use the form.

soapystar

12:10 pm on Jun 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



dont see the line u refered to..what i see is:

sub check_url {
my $check_referer = check_referer(referer());

error('bad_referer') unless $check_referer;
}

sub check_referer
{
my $check_referer;
my ($referer) = @_;

unless ($referer) {
return 1 if $allow_empty_ref or !$secure;
}

if ($referer && ($referer =~ m!^https?://([^/]*\@)?([\w\-\.]+)!i)) {
my $refHost;

$refHost = $2;

foreach my $test_ref (@referers) {
if ($refHost =~ m¦\Q$test_ref\E$¦i) {
$check_referer = 1;
last;
}
elsif ( $secure && $test_ref =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ ) {
if ( my $ref_host = inet_aton($refHost) ) {
$ref_host = unpack "l", $ref_host;
if ( my $test_ref_ip = inet_aton($test_ref) ) {
$test_ref_ip = unpack "l", $test_ref_ip;
if ( $test_ref_ip == $ref_host ) {
$check_referer = 1;
last;
}
}
}
}
}
} else {
return 0;
}

return $check_referer;
};

soapystar

12:27 pm on Jun 30, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ok..finaly found the check url you meant...and it worked..thanks very much for your help drdoc!!!!!