Mail-SpamAssassin-Plugin-Konfidi

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

etc/init_konfidi.pre
lib/Mail/SpamAssassin/Plugin/Konfidi.pm
LICENSE-Apache.txt
MANIFEST
MANIFEST.SKIP
META.yml			# Will be created by "make dist"
NOTICE.txt
README
rules/10_misc.cf
rules/test_load_plugin.pre
rules/user_prefs.template
t/00-load.t
t/acceptance-base.pl
t/acceptance.t
t/boilerplate.t
t/config
t/config.dist
t/data/gpg_thunderbird.eml
t/data/plain.eml
t/pod.t
t/SATest.pm

SIGNATURE  view on Meta::CPAN

SHA1 d213a0a50e3f89285bee522ad0d989df25b08d57 MANIFEST
SHA1 65a2f85266ba1e00b85fdce8a9a4869b05599ffd MANIFEST.SKIP
SHA1 9649a80692a4ac22f185e315d611ff9e844b2a77 META.yml
SHA1 251d966d2e1f6a2b5532c292d4f43d21ed9d0f07 NOTICE.txt
SHA1 f44518227e846d757fe19684047363719a0f5572 README
SHA1 66cab991454122c337b33243c972dd9f160d8bae etc/61_konfidi.cf
SHA1 d186da6cadc83858519373e4cc6698e21d243c7c etc/init_konfidi.pre
SHA1 bf10d865251dfd738fd9f5197d787823d7ddf52d lib/Mail/SpamAssassin/Plugin/Konfidi.pm
SHA1 8ea48df280439619c7618774150445c2d8d849b2 rules/10_misc.cf
SHA1 f8870f13c6fd068c96dc362f40975c83b94ceca6 rules/test_load_plugin.pre
SHA1 ee9aa2a0c155c661439643b1a60181cf0ba980e0 rules/user_prefs.template
SHA1 de5aed9145016750c625c54438d9da7ba9d6ba4a t/00-load.t
SHA1 20ca644ea438d62736b14927418b3f5a55d8f73a t/SATest.pm
SHA1 692f2771df9bedf7242382ba4801d5eaa0019f8c t/acceptance-base.pl
SHA1 95bb16becfa037ae15ac125aadbaa71d6a19d49b t/acceptance.t
SHA1 789c51bee8e2d3ad5fca5fd84ec27a4fdb9b07d3 t/boilerplate.t
SHA1 4529db8acd258e0c931248890af27035d86ae97b t/config
SHA1 2a6200b4970e6761833432f119ab35ff04a6de42 t/config.dist
SHA1 cea7ebdbf911f34e74a08232db9cd6affb87a95f t/data/gpg_thunderbird.eml
SHA1 09a743a289b64bbfea5d49419d448541e13806fc t/data/plain.eml
SHA1 0190346d7072d458c8a10a45c19f86db641dcc48 t/pod.t

rules/10_misc.cf  view on Meta::CPAN

#
# user_scores_sql_username is the authorized username to connect to DSN
# user_scores_sql_password is the password for the database username

#user_scores_dsn		DBI:mysql:spamassassin:localhost
#user_scores_sql_username	spam
#user_scores_sql_password	spamfilter

##########################################################################
# Headers to be added to mail (can be overriden by users in
# ~/.spamassassin/user_prefs)
# Make sure the header stays entirely on one line here

clear_headers

#X-Spam-Checker-Version: SpamAssassin 2.60-cvs (1.188-2003-05-24-exp)
add_header all Checker-Version SpamAssassin _VERSION_ (_SUBVERSION_) on _HOSTNAME_

#X-Spam-Flag: YES
add_header spam Flag _YESNOCAPS_

rules/10_misc.cf  view on Meta::CPAN

add_header all Level _STARS(*)_

#X-Spam-Status: Yes, score=14.0 required=5.0 tests=BAYES_99,CALL_FREE
#        DATE_IN_PAST_12_24,DCC_CHECK,DRASTIC_REDUCED,FROM_HAS_MIXED_NUMS
#        FROM_HAS_MIXED_NUMS3,HOME_EMPLOYMENT,INVALID_DATE,INVALID_MSGID
#        LINES_OF_YELLING,MSGID_HAS_NO_AT,NO_REAL_NAME,ONCE_IN_LIFETIME
#        UNDISC_RECIPS autolearn=spam version=2.60-cvs
add_header all Status "_YESNO_, score=_SCORE_ required=_REQD_ tests=_TESTS_ autolearn=_AUTOLEARN_ version=_VERSION_"

###########################################################################
# Default prefs values: users can override these in their 
# ~/.spamassassin/user_prefs files.

# How many points before a mail is considered spam.
required_score           5

# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_locales              all

# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.  This is an expensive

rules/10_misc.cf  view on Meta::CPAN

bayes_auto_learn_threshold_spam		12.0
endif # Mail::SpamAssassin::Plugin::AutoLearnThreshold

# Set this to 0 to turn off auto-learning.
bayes_auto_learn			1

# report_safe controls the markup of spam. If you set it to 0, the message
# body of spam messages will not be modified
report_safe           1

# Some common prefs settings can be set here, to take effect site-wide
# unless the user override them. See the user_prefs.template file for
# explanations.


t/SATest.pm  view on Meta::CPAN

  $spamd_localrules_args = " --siteconfigpath log/localrules.tmp";
  $scr_localrules_args =   " --siteconfigpath log/localrules.tmp";
  $salearn_localrules_args =   " --siteconfigpath log/localrules.tmp";

  $scr_cf_args = "-C log/test_rules_copy";
  $scr_pref_args = "-p log/test_default.cf";
  $salearn_cf_args = "-C log/test_rules_copy";
  $salearn_pref_args = "-p log/test_default.cf";
  $scr_test_args = "";
  $salearn_test_args = "";
  $set_test_prefs = 0;
  $default_cf_lines = "
    bayes_path ./log/user_state/bayes
    auto_whitelist_path ./log/user_state/auto-whitelist
  ";

  (-f "t/test_dir") && chdir("t");        # run from ..

  read_config();

  $NO_SPAMC_EXE = ($RUNNING_ON_WINDOWS &&

t/SATest.pm  view on Meta::CPAN


  rmtree ("log/localrules.tmp");
  mkdir ("log/localrules.tmp", 0755);

  for $file (<../rules/*.pre>) {
    $base = basename $file;
    copy ($file, "log/localrules.tmp/$base")
      or warn "cannot copy $file to log/localrules.tmp/$base";
  }

  copy ("../rules/user_prefs.template", "log/test_rules_copy/99_test_default.cf")
    or die "user prefs copy failed";

  open (PREFS, ">>log/test_rules_copy/99_test_default.cf");
  print PREFS $default_cf_lines;
  close PREFS;

  # create an empty .prefs file
  open (PREFS, ">>log/test_default.cf"); close PREFS;

  mkdir("log/user_state",0755);

  $home = $ENV{'HOME'};
  $home ||= $ENV{'WINDIR'} if (defined $ENV{'WINDIR'});
  $cwd = getcwd;

  $ENV{'TEST_DIR'} = $cwd;
  $testname = $tname;

t/SATest.pm  view on Meta::CPAN


sub tstlocalrules {
  my $lines = shift;

  $set_local_rules = 1;

  open (OUT, ">log/localrules.tmp/00test.cf") or die;
  print OUT $lines; close OUT;
}

sub tstprefs {
  my $lines = shift;

  $set_test_prefs = 1;

  # TODO: should we use -p, or modify the test_rules_copy/99_test_default.cf?
  # for now, I'm taking the -p route, since we have to be able to test
  # the operation of user-prefs in general, itself.

  open (OUT, ">log/tst.cf") or die;
  print OUT $lines; close OUT;
  $scr_pref_args = "-p log/tst.cf";
}

# creates a .pre file in the localrules dir to be parsed alongside init.pre
# make it zz_* just to make sure it is parse last

sub tstpre {

t/SATest.pm  view on Meta::CPAN

      $spamd_cf_args,
      $spamd_localrules_args,
    );
  }
  if ($spamd_extra_args !~ /(?:-p\s*[0-9]+|-o|--socketpath)/) {
    push(@spamd_args,
      qq{-p}, $spamdport,
    );
  }

  if ($set_test_prefs) {
    warn "oops! SATest.pm: a test prefs file was created, but spamd isn't reading it\n";
  }

  my $spamd_stdout = "log/$testname-spamd.out";
  my $spamd_stderr = "log/$testname-spamd.err";
  my $spamd_stdlog = "log/$testname-spamd.log";
  my $spamd_forker = $ENV{'SPAMD_FORKER'}   ?
                       $ENV{'SPAMD_FORKER'} :
                     $RUNNING_ON_WINDOWS    ?
                       "start $perl_path"   :
                       $perl_path;

t/SATest.pm  view on Meta::CPAN

  }
}

sub create_saobj {
  my ($args) = shift; # lets you override/add arguments

  # YUCK, these file/dir names should be some sort of variable, at
  # least we keep their definition in the same file for the moment.
  my %setup_args = ( rules_filename => 'log/test_rules_copy',
		     site_rules_filename => 'log/localrules.tmp',
		     userprefs_filename => 'log/test_default.cf',
		     userstate_dir => 'log/user_state',
		     local_tests_only => 1,
                     # debug => 'all',
		   );

  # override default args
  foreach my $arg (keys %$args) {
    $setup_args{$arg} = $args->{$arg};
  }

t/acceptance-base.pl  view on Meta::CPAN

    sa_t_init("konfidi");
}

sub acceptance_setup() {
    # add lines to test-local rules
    tstlocalrules (q{
    ## no 'score' setting since a dynamic score is set from within the plugin
    add_header all Konfidi-Trust-Value _KONFIDITRUSTVALUE_
}   );

    tstprefs (q{
    konfidi_service_url http://test-server.konfidi.org/
    konfidi_my_pgp_fingerprint EAB0FABEDEA81AD4086902FE56F0526F9BB3CE70
}   );

};

acceptance_init();

t/acceptance.t  view on Meta::CPAN

%patterns = (
);
%anti_patterns = (
    q{ KONFIDI_TRUST_VALUE }, 'konfidi trust value',
);

sarun("-t < data/plain.eml", \&patterns_run_cb);
ok_all_patterns(); # one test per pattern & anti-pattern

# make Konfidi::Client throw an exception
tstprefs (q{
    konfidi_service_url http://unreachable.server/
}   );
sarun("-t < data/gpg_thunderbird.eml", \&patterns_run_cb);
ok_all_patterns(); # one test per pattern & anti-pattern



( run in 0.830 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )