From 78b16c78f3ff79476c541bc690dca30d8bb555bb Mon Sep 17 00:00:00 2001 From: Anton Berezin Date: Mon, 10 May 2004 12:56:22 +0000 Subject: Add security/p5-Authen-Captcha, a Perl module to verify the human element in transactions. --- security/p5-Authen-Captcha/Makefile | 36 ++++++++++++ security/p5-Authen-Captcha/distinfo | 2 + security/p5-Authen-Captcha/files/patch-Captcha.pm | 70 +++++++++++++++++++++++ security/p5-Authen-Captcha/pkg-descr | 13 +++++ security/p5-Authen-Captcha/pkg-plist | 47 +++++++++++++++ 5 files changed, 168 insertions(+) create mode 100644 security/p5-Authen-Captcha/Makefile create mode 100644 security/p5-Authen-Captcha/distinfo create mode 100644 security/p5-Authen-Captcha/files/patch-Captcha.pm create mode 100644 security/p5-Authen-Captcha/pkg-descr create mode 100644 security/p5-Authen-Captcha/pkg-plist (limited to 'security/p5-Authen-Captcha') diff --git a/security/p5-Authen-Captcha/Makefile b/security/p5-Authen-Captcha/Makefile new file mode 100644 index 000000000000..27068e071512 --- /dev/null +++ b/security/p5-Authen-Captcha/Makefile @@ -0,0 +1,36 @@ +# New ports collection makefile for: Authen-Captcha +# Date created: Mon May 10 13:27:28 CEST 2004 +# Whom: tobez@FreeBSD.org +# +# $FreeBSD$ +# + +PORTNAME= Authen-Captcha +PORTVERSION= 1.023 +CATEGORIES= security perl5 +MASTER_SITES= ${MASTER_SITE_PERL_CPAN} +MASTER_SITE_SUBDIR= Authen +PKGNAMEPREFIX= p5- + +MAINTAINER= perl@FreeBSD.org +COMMENT= Perl module to verify the human element in transactions + +BUILD_DEPENDS= ${SITE_PERL}/${PERL_ARCH}/GD.pm:${PORTSDIR}/graphics/p5-GD +RUN_DEPENDS= ${BUILD_DEPENDS} + +PERL_CONFIGURE= yes + +MAN3= Authen::Captcha.3 + +.include + +.if ${PERL_LEVEL} < 500800 +BUILD_DEPENDS+= ${SITE_PERL}/${PERL_ARCH}/Digest/MD5.pm:${PORTSDIR}/security/p5-Digest-MD5 +RUN_DEPENDS+= ${SITE_PERL}/${PERL_ARCH}/Digest/MD5.pm:${PORTSDIR}/security/p5-Digest-MD5 +.endif +.if ${PERL_LEVEL} <= 500600 +BUILD_DEPENDS+= ${SITE_PERL}/File/Spec.pm:${PORTSDIR}/devel/p5-File-Spec +RUN_DEPENDS+= ${SITE_PERL}/File/Spec.pm:${PORTSDIR}/devel/p5-File-Spec +.endif + +.include diff --git a/security/p5-Authen-Captcha/distinfo b/security/p5-Authen-Captcha/distinfo new file mode 100644 index 000000000000..003ced20ae86 --- /dev/null +++ b/security/p5-Authen-Captcha/distinfo @@ -0,0 +1,2 @@ +MD5 (Authen-Captcha-1.023.tar.gz) = 7c20090844dd2406e4ef6a894c66348b +SIZE (Authen-Captcha-1.023.tar.gz) = 98986 diff --git a/security/p5-Authen-Captcha/files/patch-Captcha.pm b/security/p5-Authen-Captcha/files/patch-Captcha.pm new file mode 100644 index 000000000000..def3c22c00a9 --- /dev/null +++ b/security/p5-Authen-Captcha/files/patch-Captcha.pm @@ -0,0 +1,70 @@ +--- Captcha.pm.orig Mon May 10 10:58:05 2004 ++++ Captcha.pm Mon May 10 11:06:24 2004 +@@ -65,6 +65,7 @@ sub new + my $keep_failures = (defined($opts{keep_failures}) && $opts{keep_failures}) + ? 1 : 0; + $self->keep_failures($keep_failures); ++ $self->secret($opts{secret} || ""); + + # create a random seed if perl version less than 5.004 + if ($] < 5.005) +@@ -193,6 +194,18 @@ sub data_folder + } + } + ++sub secret ++{ ++ ref(my $self = shift) or croak "instance variable needed"; ++ if (@_) ++ { # it's a setter ++ $self->{_secret} = $_[0]; ++ return $self->{_secret}; ++ } else { ++ return $self->{_secret}; ++ } ++} ++ + + sub check_code + { +@@ -214,7 +227,7 @@ sub check_code + # they could be confused with (o) and (l), so we swap them in + $code =~ tr/01/ol/; + +- my $md5 = md5_hex($code); ++ my $md5 = md5_hex($code . $self->secret); + + # pull in current database + warn "Open File: $database_file\n" if($self->debug() >= 2); +@@ -490,7 +503,7 @@ sub generate_code + my $length = shift; + + my $code = $self->generate_random_string($length); +- my $md5 = md5_hex($code); ++ my $md5 = md5_hex($code . $self->secret); + + my ($captcha_data_ref,$output_filename); + if ($self->type() eq 'image') +@@ -625,6 +638,7 @@ See the method descriptions for more det + height => 35, # optional. default 35 + images_folder => '/some/folder', # optional. default to lib dir + keep_failures => 0, # optional, defaults to 0(false) ++ secret => "", # optional, defaults to "" + debug => 0, # optional. default 0 + + =back +@@ -694,6 +708,14 @@ Optional. Number of pixels wide for the + =item C<$captcha-Ekeep_failures( [0|1] );> + + Optional. Defaults to zero. This option controls whether or not the captcha will remain valid after a failed attempt. By default, we only allow one attempt to solve it. This greatly reduces the possibility that a bot could brute force a correct answer. Change it at your own risk. ++ ++=item C<$captcha-Esecret( "SuperSecret" );> ++ ++Optional. Defaults to an empty string. This option is meant to prevent ++brute-force captcha circumvention by calculating md5 sum of multiple ++valid codes and comparing them with the image file name. Obviously, the ++secret should be the same for creating and checking the captcha. It is a ++good idea to set it to something else than the default. + + =item C<$captcha-Edebug( [0|1|2] );> + diff --git a/security/p5-Authen-Captcha/pkg-descr b/security/p5-Authen-Captcha/pkg-descr new file mode 100644 index 000000000000..532bf8fb00b2 --- /dev/null +++ b/security/p5-Authen-Captcha/pkg-descr @@ -0,0 +1,13 @@ +Authen::Captcha provides an object oriented interface to captcha file +creations. Captcha stands for Compl etely Automated Public Turning test +to tell Computers and Humans Apart. A Captcha is a program that can +generate and grade tests that: + + - most humans can pass + - current computer programs can't pass + +The most common form is an image file containing distorted text, which +humans are adept at reading, and co mputers (generally) do a poor job. +This module currently implements that method. + +WWW: http://search.cpan.org/search?module=Authen::Captcha diff --git a/security/p5-Authen-Captcha/pkg-plist b/security/p5-Authen-Captcha/pkg-plist new file mode 100644 index 000000000000..32588496fbad --- /dev/null +++ b/security/p5-Authen-Captcha/pkg-plist @@ -0,0 +1,47 @@ +%%SITE_PERL%%/%%PERL_ARCH%%/auto/Authen/Captcha/.packlist +%%SITE_PERL%%/Authen/Captcha.pm +%%SITE_PERL%%/Authen/Captcha/images/8.png +%%SITE_PERL%%/Authen/Captcha/images/s.png +%%SITE_PERL%%/Authen/Captcha/images/a.png +%%SITE_PERL%%/Authen/Captcha/images/l.png +%%SITE_PERL%%/Authen/Captcha/images/z.png +%%SITE_PERL%%/Authen/Captcha/images/5.png +%%SITE_PERL%%/Authen/Captcha/images/b.png +%%SITE_PERL%%/Authen/Captcha/images/9.png +%%SITE_PERL%%/Authen/Captcha/images/4.png +%%SITE_PERL%%/Authen/Captcha/images/6.png +%%SITE_PERL%%/Authen/Captcha/images/background2.png +%%SITE_PERL%%/Authen/Captcha/images/c.png +%%SITE_PERL%%/Authen/Captcha/images/g.png +%%SITE_PERL%%/Authen/Captcha/images/v.png +%%SITE_PERL%%/Authen/Captcha/images/y.png +%%SITE_PERL%%/Authen/Captcha/images/u.png +%%SITE_PERL%%/Authen/Captcha/images/q.png +%%SITE_PERL%%/Authen/Captcha/images/p.png +%%SITE_PERL%%/Authen/Captcha/images/3.png +%%SITE_PERL%%/Authen/Captcha/images/background4.png +%%SITE_PERL%%/Authen/Captcha/images/d.png +%%SITE_PERL%%/Authen/Captcha/images/h.png +%%SITE_PERL%%/Authen/Captcha/images/background3.png +%%SITE_PERL%%/Authen/Captcha/images/n.png +%%SITE_PERL%%/Authen/Captcha/images/o.png +%%SITE_PERL%%/Authen/Captcha/images/f.png +%%SITE_PERL%%/Authen/Captcha/images/Thumbs.db +%%SITE_PERL%%/Authen/Captcha/images/2.png +%%SITE_PERL%%/Authen/Captcha/images/j.png +%%SITE_PERL%%/Authen/Captcha/images/x.png +%%SITE_PERL%%/Authen/Captcha/images/background5.png +%%SITE_PERL%%/Authen/Captcha/images/k.png +%%SITE_PERL%%/Authen/Captcha/images/7.png +%%SITE_PERL%%/Authen/Captcha/images/e.png +%%SITE_PERL%%/Authen/Captcha/images/i.png +%%SITE_PERL%%/Authen/Captcha/images/w.png +%%SITE_PERL%%/Authen/Captcha/images/m.png +%%SITE_PERL%%/Authen/Captcha/images/r.png +%%SITE_PERL%%/Authen/Captcha/images/t.png +%%SITE_PERL%%/Authen/Captcha/images/background1.png +@dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/Authen/Captcha +@dirrm %%SITE_PERL%%/Authen/Captcha/images +@dirrm %%SITE_PERL%%/Authen/Captcha +@unexec rmdir %D/%%SITE_PERL%%/%%PERL_ARCH%%/auto/Authen 2>/dev/null || true +@unexec rmdir %D/%%SITE_PERL%%/Authen 2>/dev/null || true -- cgit v1.2.3