Mail-SpamCannibal
view release on metacpan or search on metacpan
Edit the file executableTestPath.conf. The contents of the file looks
like this:
#
# put the path to the pgp executable
# in this file in "quotes"
#
# i.e.
# /usr/local/bin/pgp
# /usr/local/bin/gpg
sub privacyexecutables {
return qw (
/usr/local/bin/gpg
/usr/local/bin/pgp
);
}
1;
Include only the executables you have installed on your system.
Now you can proceed with a standard perl module installation by typing:
perl Makefile.PL
The details of the procedure vary slightly depending on whether you
select GPG or PGP, but the basic steps are the same.
create a private/public key pair for the spamcannibal user
export the public key to a file
install the public key file in your mail client
key generation for GPG
Login as the spamcannibal user and type:
gpg --gen-key
Please select what kind of key you want:
(1) DSA and ElGamal (default)
(2) DSA (sign only)
(5) RSA (sign only)
Your selection? 1
DSA keypair will have 1024 bits.
About to generate a new ELG-E keypair.
minimum keysize is 768 bits
default keysize is 1024 bits
"SpamCannibal (eats spammers for lunch) <spam@myhost.com>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.
Enter password: myspampassword
Reenter password: myspampassword
(gng generates the keys...++..++++...)
gpg: /usr/local/spamcannibal .gnupg/trustdb.gpg: trustdb created
public and secret key created and signed.
key marked as ultimately trusted.
pub 1024D/EA000A1B 2003-08-28 SpamCannibal (eats spammers for lunch) <spam@myhost.com>
Key fingerprint = EBBD 0A8A 1AB4 B6E8 38B6 FFA1 E9A3 E4C8 EA00 0A1B
sub 1024g/37858C46 2003-08-28
Done!, the keys can now be found in:
ls -1 .gnupg/
gpg.conf
pubring.gpg
random_seed
secring.gpg
trustdb.gpg
Export the public key and transport it to your mail client.
gpg --armor --export SpamCannibal
gpg: please see http://www.gnupg.org/faq.html for more information
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.2 (GNU/Linux)
mQGiBD9ON2gRBACLXEuYYtz/wIjwGKsgcIDIz8KySCjgM8/XamKjqv+Ir7IpO2jA
o7oH3+vpvse6xvVA4yNTLAsnozojc2D9gS9U2ZwtFq3mnvP3VLOLa4CkgixoO+ET
/JkPAF+RG7lRCFVg733IxSkQE4eyuhSuu/6DIrREUNt/z6Mr4p4U1DApWwCg6Pba
uLDAeumG2XyYSsXpVAEIn4cD/03z0FPHBxpCFnZ82IykQoNH6PMtRrFjNW/0FrjK
lGa4Wger1bGwaQ846/lpYBeqVZEk7BhX7kg0uRmizZf2LRujl0uu2onbpAyvSY3u
O1DZRm+o4r3gihO9x3LrsCp0H2osSLyv0PT3s6w+2EAeQ7F/nGs9W/zQAUkTnEJi
K+w8A/9qln10T+FzF/tQHdNilEVLu9/c/pnlkQk/AXRXygvpjD4rDchaWcXDWODK
Changes
MANIFEST
MANIFEST.SKIP
INSTALL
GPL
Makefile.PL
README.pgp_gpg
SpamCannibal.pm
public_html/favicon.ico
config/sc_BlackList.conf.sample
config/sc_dbwatch.conf.sample
config/sc_mailfilter.conf.sample
config/sc_web.conf.sample
executableTestPath.conf
rc.sc_dbwatch
rc.sc_lbdaemon.sample
fixuplinks.pl
cdata/sc_sesswrap.c
fixup/perl2html.pl
inst/dialog.pl
inst/make_Config.pl
keyrings/pubring.gpg
keyrings/pubring.pgp
keyrings/pubring.pkr
keyrings/secring.gpg
keyrings/secring.pgp
keyrings/secring.skr
contrib/dnsbl_stats.shtml
contrib/nav.incl
contrib/robots.txt
contrib/mimedefang-filter
contrib/rc_debian_spamcannibal
contrib/zonedump.pl
contrib/zone_cron.pl
contrib/zone_cron.sh
README.pgp_gpg view on Meta::CPAN
passphrase for secret key is 'TEST'
Keyrings are RSA, created by pgp-2.6.2g
install pgp or gpg on your system and edit the
executableTestPath.conf file to include the
path to the executable.
config/sc_mailfilter.conf.sample view on Meta::CPAN
# Verify that a message has PGP encrypted content prior to decryption so
# that plain text messages are not inadvertently passed to the to the
# tarpit. Prevent unauthorized access/addition to the tarpit.
#
# See: man Mail::SpamCannibal::GoodPrivacy 'decrypt' for details
#
# [ RECOMMENDED ]
PGP => {
# ExeFile => '/usr/local/bin/pgp',
ExeFile => '/usr/local/bin/gpg',
# KeyPath => '/usr/local/spamcannibal/.pgp',
KeyPath => '/usr/local/spamcannibal/.gnupg',
Password => 'mySPAMpasswd',
UserID => 'Spam',
Version => '', # might be 2.62
# Exceptions => 0,
},
# If "REPORT" is set above, and "Exceptions" is true. Non-PGP messages
# will be forwarded to the REPORT target for evaluation.
executableTestPath.conf view on Meta::CPAN
#
# put the path to the pgp executable
# in this file in "quotes"
#
# i.e.
# /usr/local/bin/pgp
# /usr/local/bin/gpg
sub privacyexecutables {
return qw (
/usr/local/bin/gpg
/usr/local/bin/pgp
);
}
1;
lib/Mail/SpamCannibal/GoodPrivacy.pm view on Meta::CPAN
$outstrng = whiteclean($instring);
=head1 DESCRIPTION
Mail::SpamCannibal::GoodPrivacy is a standardized
wrapper around 'pgp2x', 'pgp6x', or 'gnupg'
that provides encryption and decryption for
IPTable::IPv4::DBTables::SpamCannibal.
Mail::SpamCannibal::GoodPrivacy has been tested using pgp-2.6.2g, pgp-6.5.8,
and gpg-1.2.2 on RSA keys generated by pgp-2.6.2g which are included with
this distribution.
Utilities to verify that a message has PGP encrypted content prior to
decryption so that plain text messages are not inadvertently passed to the
decrypt program;
=over 4
=item $plaintext = decrypt(\$hash);
Decrypt an encoded message.
input: a hash or hash pointer
return: plaintext or '' on error
%hash = (
Data => $data,
ExeFile => '/usr/local/bin/gpg',
KeyPath => './',
Password => 'sometext',
UserID => '',
Version => '',
);
Data: data to decrypt
ExeFile: location of executable
i.e. /usr/local/bin/pgp
/usr/local/bin/gpg
WARNING: use appropriate default
keyring names.
KeyPath: directory for keyrings
Password: password for decryption
UserID: Optional default user for decryption.
The user 'name' or keyID
i.e. 'test' or
E56C91B9 as displayed by
pgp -kv ./keyrings/secring.pgp
or
ENVGPGHOME=./keyrings gpg --list-secret-keys
Version: Version compliance (gpg only)
(none) for standard gpg,
2.6x and 6.x for pgp support
=cut
## test the input array
sub _testme {
my $me = shift;
# Data
die "No data present\n"
lib/Mail/SpamCannibal/GoodPrivacy.pm view on Meta::CPAN
my $data = '';
my $pgpcmd = '|'. $me->{ExeFile};
$pgpcmd .= ' -u '. $me->{UserID} if $me->{UserID};
if ($pgpcmd =~ m|/pgp[^/]*$|) {
$pgpcmd .= ' -f +batchmode +force 2>/dev/null';
$ENV{PGPPATH} = $me->{KeyPath};
$ENV{PGPPASS} = $me->{Password};
}
elsif( $pgpcmd =~ m|/gpg[^/]*$|) {
$data .= $me->{Password}."\n";
$pgpcmd .= ' --pgp2' if $me->{Version} =~ /^2\./;
$pgpcmd .= ' --pgp6' if $me->{Version} =~ /^6\./;
$pgpcmd .= ' --decrypt --batch --passphrase-fd 0 2>/dev/null';
$ENV{GNUPGHOME} = $me->{KeyPath};
}
else {
die "could not find pgp or gpg executable\n";
}
$data .= $me->{Data};
my $rv = '';
my $pid = open(FROMCHILD, '-|');
if($pid) {
local $/;
$rv = <FROMCHILD>;
close FROMCHILD || ($rv = ''); # kid exited
lib/Mail/SpamCannibal/GoodPrivacy.pm view on Meta::CPAN
download:
ftp://ftp.gnupg.dk/pub/contrib-dk/idea.c.gz
and place it in the SRC/gnupg-1.x.x/cipher directory.
=item NOTE: in all cases the default key file required.
PGP 2.6.x pubring.pgp, secring.pgp
PGP 6.5.8 pubring.pkr, secring.skr
GnuPG pubring.gpg, secring.gpg
=back
=head1 EXPORT_OK
decrypt
is_pgp
whiteclean
=head1 AUTHOR
pods/INSTALL.pod view on Meta::CPAN
Edit the file B<executableTestPath.conf>. The contents of the file looks
like this:
#
# put the path to the pgp executable
# in this file in "quotes"
#
# i.e.
# /usr/local/bin/pgp
# /usr/local/bin/gpg
sub privacyexecutables {
return qw (
/usr/local/bin/gpg
/usr/local/bin/pgp
);
}
1;
Include only the executables you have installed on your system.
Now you can proceed with a standard perl module installation by typing:
perl Makefile.PL
pods/INSTALL.pod view on Meta::CPAN
=item export the public key to a file
=item install the public key file in your mail client
=back
=head3 key generation for GPG
Login as the spamcannibal user and type:
gpg --gen-key
Please select what kind of key you want:
(1) DSA and ElGamal (default)
(2) DSA (sign only)
(5) RSA (sign only)
Your selection? 1
DSA keypair will have 1024 bits.
About to generate a new ELG-E keypair.
minimum keysize is 768 bits
default keysize is 1024 bits
pods/INSTALL.pod view on Meta::CPAN
"SpamCannibal (eats spammers for lunch) <spam@myhost.com>"
Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? O
You need a Passphrase to protect your secret key.
Enter password: myspampassword
Reenter password: myspampassword
(gng generates the keys...++..++++...)
gpg: /usr/local/spamcannibal .gnupg/trustdb.gpg: trustdb created
public and secret key created and signed.
key marked as ultimately trusted.
pub 1024D/EA000A1B 2003-08-28 SpamCannibal (eats spammers for lunch) <spam@myhost.com>
Key fingerprint = EBBD 0A8A 1AB4 B6E8 38B6 FFA1 E9A3 E4C8 EA00 0A1B
sub 1024g/37858C46 2003-08-28
Done!, the keys can now be found in:
ls -1 .gnupg/
gpg.conf
pubring.gpg
random_seed
secring.gpg
trustdb.gpg
Export the public key and transport it to your mail client.
gpg --armor --export SpamCannibal
gpg: please see http://www.gnupg.org/faq.html for more information
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.2 (GNU/Linux)
mQGiBD9ON2gRBACLXEuYYtz/wIjwGKsgcIDIz8KySCjgM8/XamKjqv+Ir7IpO2jA
o7oH3+vpvse6xvVA4yNTLAsnozojc2D9gS9U2ZwtFq3mnvP3VLOLa4CkgixoO+ET
/JkPAF+RG7lRCFVg733IxSkQE4eyuhSuu/6DIrREUNt/z6Mr4p4U1DApWwCg6Pba
uLDAeumG2XyYSsXpVAEIn4cD/03z0FPHBxpCFnZ82IykQoNH6PMtRrFjNW/0FrjK
lGa4Wger1bGwaQ846/lpYBeqVZEk7BhX7kg0uRmizZf2LRujl0uu2onbpAyvSY3u
O1DZRm+o4r3gihO9x3LrsCp0H2osSLyv0PT3s6w+2EAeQ7F/nGs9W/zQAUkTnEJi
K+w8A/9qln10T+FzF/tQHdNilEVLu9/c/pnlkQk/AXRXygvpjD4rDchaWcXDWODK
t/gp_decrypt.t view on Meta::CPAN
}
##########################################################
####### The test really begin here #######################
do './executableTestPath.conf';
my @pgpexe = &privacyexecutables;
my $pgpexe;
foreach my $try (qw(pgp gpg)) {
$pgpexe = $try;
foreach(@pgpexe) {
if ($_ =~ m|/${try}[^/]*$|) {
$pgpexe = $_;
last;
}
}
if ($pgpexe =~ m|/| && -e $pgpexe && -x $pgpexe) {
if ($pgpexe =~ m|/gpg|) {
local $/;
open(VERSION,"$pgpexe --version|");
$_ = <VERSION>;
close VERSION;
if ($_ =~ /IDEA/) {
&dotests($pgpexe);
} else {
&skip(5);
print STDERR qq
| Tests for '$pgpexe' have been skipped. The
( run in 1.078 second using v1.01-cache-2.11-cpan-df04353d9ac )