/[smeserver]/rpms/smeserver-qpsmtpd/sme8/smeserver-qpsmtpd-1.2.1-dkim.patch
ViewVC logotype

Annotation of /rpms/smeserver-qpsmtpd/sme8/smeserver-qpsmtpd-1.2.1-dkim.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Tue Oct 7 15:06:54 2008 UTC (16 years, 1 month ago) by slords
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
New streams

1 slords 1.1 diff -Nur -x '*.orig' -x '*.rej' smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/dkim_sign mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/dkim_sign
2     --- smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/dkim_sign 1969-12-31 17:00:00.000000000 -0700
3     +++ mezzanine_patched_smeserver-qpsmtpd-1.2.1/root/usr/share/qpsmtpd/plugins/dkim_sign 2007-01-23 21:55:08.000000000 -0700
4     @@ -0,0 +1,77 @@
5     +=head1 NAME
6     +
7     +dkim_sigh: attach a DKIM or DomainKeys signature to incoming mail before it is queued.
8     +Currently we sign all authenticated and allowed relay email.
9     +
10     +written by Shad L. Lords
11     +
12     +=cut
13     +
14     +require Mail::DKIM::Signer;
15     +require Mail::DKIM::DkSignature;
16     +
17     +sub register {
18     + my ($self, $qp, @args) = @_;
19     + %{$self->{_dkim}} = @args;
20     +}
21     +
22     +sub hook_data_post {
23     + my $self = shift;
24     + my $trns = shift;
25     +
26     + return DECLINED unless $self->qp->connection->relay_client() || ( $self->qp->auth_mechanism() && $self->qp->auth_user() );
27     +
28     + my $sender = (Qpsmtpd::Address->parse($trns->sender))[0];
29     + return DECLINED unless $sender;
30     +
31     + my $dkim = new Mail::DKIM::Signer(
32     + Policy => sub {
33     + my $dkim = shift;
34     +
35     + my $headers = $self->{_dkim}->{dkim_headers} || "received:from:subject:date:message-id";
36     + $headers = $dkim->headers if $headers eq 'all';
37     +
38     + my $keys = $self->{_dkim}->{keys} || 'both';
39     +
40     + $dkim->add_signature(new Mail::DKIM::DkSignature(
41     + Algorithm => $self->{_dkim}->{algorithm} || "rsa-sha1",
42     + Method => $self->{_dkim}->{dk_method} || "nofws",
43     + Selector => $self->{_dkim}->{selector} || "default",
44     + Domain => $dkim->message_sender->host,
45     + Headers => $headers,
46     + )) if $keys eq 'both' || $keys eq 'dk' || $keys eq 'domainkeys';
47     +
48     + $dkim->add_signature(new Mail::DKIM::Signature(
49     + Algorithm => $self->{_dkim}->{algorithm} || "rsa-sha1",
50     + Method => $self->{_dkim}->{dkim_method} || "relaxed",
51     + Selector => $self->{_dkim}->{selector} || "default",
52     + Domain => $dkim->message_sender->host,
53     + Headers => $headers,
54     + )) if $keys eq 'both' || $keys eq 'dkim';
55     +
56     + return 1;
57     + },
58     + KeyFile => "config/dkimkeys/".$sender->host.".private"
59     + );
60     + return DECLINED unless $dkim;
61     +
62     + $trns->body_resetpos;
63     + foreach my $line (split /\n/, $trns->header->as_string) {
64     + chomp $line;
65     + $dkim->PRINT("$line\015\012");
66     + }
67     + while (my $line = $trns->body_getline) {
68     + chomp $line;
69     + $dkim->PRINT("$line\015\012");
70     + }
71     + $dkim->CLOSE;
72     +
73     + foreach my $sig ($dkim->signatures) {
74     + if ( (my $sig_string = $sig->as_string) =~ /^([^:]+):\s*(.*)$/) {
75     + $self->log(LOGINFO, "Added $1 for domain ".$sender->host);
76     + $trns->header->add("$1:", $2, 0);
77     + }
78     + }
79     +
80     + return DECLINED;
81     +}

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed