1 |
commit: 0a9241bfb4f3a6c78a570b1fec92c78bbe21ad2b |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Dec 26 00:53:49 2020 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Dec 26 00:53:56 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0a9241bf |
7 |
|
8 |
mail-filter/postgrey: remove old patch |
9 |
|
10 |
Package-Manager: Portage-3.0.12-prefix, Repoman-3.0.2 |
11 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
12 |
|
13 |
.../files/targrey-0.31-postgrey-1.34.patch | 202 --------------------- |
14 |
1 file changed, 202 deletions(-) |
15 |
|
16 |
diff --git a/mail-filter/postgrey/files/targrey-0.31-postgrey-1.34.patch b/mail-filter/postgrey/files/targrey-0.31-postgrey-1.34.patch |
17 |
deleted file mode 100644 |
18 |
index a17b6457d39..00000000000 |
19 |
--- a/mail-filter/postgrey/files/targrey-0.31-postgrey-1.34.patch |
20 |
+++ /dev/null |
21 |
@@ -1,202 +0,0 @@ |
22 |
---- postgrey.orig 2011-05-04 22:54:15.000000000 +0200 |
23 |
-+++ postgrey 2011-10-17 10:10:21.000000000 +0200 |
24 |
-@@ -309,6 +309,22 @@ |
25 |
- $self->mylog(1, "cleaning clients database finished. before: $nr_keys_before, after: $nr_keys_after"); |
26 |
- } |
27 |
- |
28 |
-+ if($self->{postgrey}{targrey}) { |
29 |
-+ # cleanup tarpit blacklist database |
30 |
-+ my $tarpit_db = $self->{postgrey}{db_tarpit}; |
31 |
-+ ($nr_keys_before, $nr_keys_after) = (0, 0); |
32 |
-+ while (my ($key, $tarpit_last_seen) = each %$tarpit_db) { |
33 |
-+ $nr_keys_before++; |
34 |
-+ if($now - $tarpit_last_seen > $retry_window) { |
35 |
-+ delete $tarpit_db->{$key}; |
36 |
-+ } |
37 |
-+ else { |
38 |
-+ $nr_keys_after++; |
39 |
-+ } |
40 |
-+ } |
41 |
-+ $self->mylog(1, "cleaning tarpit blacklist database finished. before: $nr_keys_before, after: $nr_keys_after"); |
42 |
-+ } |
43 |
-+ |
44 |
- $self->{postgrey}{last_maint_keys}=$now; |
45 |
- } |
46 |
- } |
47 |
-@@ -383,7 +399,7 @@ |
48 |
- # whitelist if count is enough |
49 |
- if(defined $cawl_count and $cawl_count >= $self->{postgrey}{awl_clients}) |
50 |
- { |
51 |
-- if(($now >= $cawl_last+3600) or ($cawl_last > $now)) { |
52 |
-+ if(($now >= $cawl_last + $self->{postgrey}{awl_delay}) or ($cawl_last > $now)) { |
53 |
- $cawl_count++; # for statistics |
54 |
- $cawl_db->{$cawl_key}=$cawl_count.','.$now; |
55 |
- } |
56 |
-@@ -392,6 +408,28 @@ |
57 |
- } |
58 |
- } |
59 |
- |
60 |
-+ # check tarpit passed if targrey mode |
61 |
-+ if ($self->{postgrey}{targrey} && $attr->{protocol_state} eq 'DATA') { # passed tarpit |
62 |
-+ # remove tarpit blacklist |
63 |
-+ my $tarpit_db = $self->{postgrey}{db_tarpit}; |
64 |
-+ my $tarpit_key = $attr->{client_address}; |
65 |
-+ delete $tarpit_db->{$tarpit_key}; |
66 |
-+ |
67 |
-+ # auto whitelist clients by tarpit |
68 |
-+ if ($self->{postgrey}{awl_clients}) { |
69 |
-+ # enough time has passed (record only one attempt per hour) |
70 |
-+ if (! defined $cawl_last or $now >= $cawl_last + $self->{postgrey}{awl_delay}) { |
71 |
-+ # ok, increase count |
72 |
-+ $cawl_count++; |
73 |
-+ $cawl_db->{$cawl_key}=$cawl_count.','.$now; |
74 |
-+ $self->mylog(1, "tarpit whitelisted: $attr->{client_name}"."[".$attr->{client_address}."]") |
75 |
-+ if $cawl_count==$self->{postgrey}{awl_clients}; |
76 |
-+ } |
77 |
-+ } |
78 |
-+ |
79 |
-+ return 'DUNNO'; |
80 |
-+ } |
81 |
-+ |
82 |
- # lookup |
83 |
- my $sender = $self->do_sender_substitutions($attr->{sender}); |
84 |
- my ($client_net, $client_host) = |
85 |
-@@ -402,10 +440,11 @@ |
86 |
- } |
87 |
- my $val = $db->{$key}; |
88 |
- my $first; |
89 |
-+ my $retry_count=0; |
90 |
- my $last_was_successful=0; |
91 |
- if(defined $val) { |
92 |
- my $last; |
93 |
-- ($first, $last) = split(/,/,$val); |
94 |
-+ ($first, $last, $retry_count) = split(/,/,$val); |
95 |
- # find out if the last time was unsuccessful, so that we can add a header |
96 |
- # to say how much had to be waited |
97 |
- if($last - $first >= $self->{postgrey}{delay}) { |
98 |
-@@ -426,16 +465,19 @@ |
99 |
- $first = $now; |
100 |
- } |
101 |
- |
102 |
-+ my $diff = $self->{postgrey}{delay} - ($now - $first); |
103 |
-+ |
104 |
-+ # enough waited? -> increase retry_count |
105 |
-+ $retry_count++ if($diff <= 0); |
106 |
-+ |
107 |
- # update (put as last element stripped host-part if it was stripped) |
108 |
- if(defined $client_host) { |
109 |
-- $db->{$key}="$first,$now,$client_host"; |
110 |
-+ $db->{$key}="$first,$now,$retry_count,$client_host"; |
111 |
- } |
112 |
- else { |
113 |
-- $db->{$key}="$first,$now"; |
114 |
-+ $db->{$key}="$first,$now,$retry_count"; |
115 |
- } |
116 |
- |
117 |
-- my $diff = $self->{postgrey}{delay} - ($now - $first); |
118 |
-- |
119 |
- # auto whitelist clients |
120 |
- # algorithm: |
121 |
- # - on successful entry in the greylist db of a triplet: |
122 |
-@@ -443,23 +485,41 @@ |
123 |
- # - client whitelisted already? -> update last-seen timestamp |
124 |
- if($self->{postgrey}{awl_clients}) { |
125 |
- # greylisting succeeded |
126 |
-- if($diff <= 0 and !$last_was_successful) { |
127 |
-+ if($retry_count >= $self->{postgrey}{retry_count} and !$last_was_successful) { |
128 |
- # enough time has passed (record only one attempt per hour) |
129 |
-- if(! defined $cawl_last or $now >= $cawl_last + 3600) { |
130 |
-+ if(! defined $cawl_last or $now >= $cawl_last + $self->{postgrey}{awl_delay}) { |
131 |
- # ok, increase count |
132 |
- $cawl_count++; |
133 |
- $cawl_db->{$cawl_key}=$cawl_count.','.$now; |
134 |
- my $client = $attr->{client_name} ? |
135 |
- $attr->{client_name}.'['.$attr->{client_address}.']' : |
136 |
- $attr->{client_address}; |
137 |
-- $self->mylog(1, "whitelisted: $client") |
138 |
-+ $self->mylog(1, "whitelisted: $attr->{client_name}"."[".$attr->{client_address}."]") |
139 |
- if $cawl_count==$self->{postgrey}{awl_clients}; |
140 |
- } |
141 |
- } |
142 |
- } |
143 |
- |
144 |
-- # not enough waited? -> greylist |
145 |
-- if ($diff > 0 ) { |
146 |
-+ # not enough retry? -> greylist |
147 |
-+ if ($retry_count < $self->{postgrey}{retry_count}) { |
148 |
-+ if($self->{postgrey}{tarpit} && ! $self->{postgrey}{targrey}) { |
149 |
-+ # do tarpit and greylist if tarpit option only |
150 |
-+ # don't add message after greylist_action |
151 |
-+ return "SLEEP $self->{postgrey}{tarpit}, $self->{postgrey}{greylist_action}"; |
152 |
-+ } |
153 |
-+ if($self->{postgrey}{targrey}) { |
154 |
-+ # do tarpit if targrey option |
155 |
-+ # add tarpit blacklist |
156 |
-+ my $tarpit_db = $self->{postgrey}{db_tarpit}; |
157 |
-+ my $tarpit_key = $attr->{client_address}; |
158 |
-+ my $tarpit_last = $tarpit_db->{$tarpit_key}; |
159 |
-+ $tarpit_last = 0 unless (defined $tarpit_last); |
160 |
-+ $tarpit_db->{$tarpit_key} = "$now" if ($now >= $tarpit_last+300); # update if 5min ago |
161 |
-+ |
162 |
-+ # return sleep if not tarpit blacklisted |
163 |
-+ return "SLEEP $self->{postgrey}{tarpit}" if ($tarpit_last == 0); |
164 |
-+ # greylist if tarpit blacklisted |
165 |
-+ } |
166 |
- my $msg = $self->{postgrey}{greylist_text}; |
167 |
- # Workaround for an Exchange bug related to Greylisting: |
168 |
- # use DSN 4.2.0 instead of the default 4.7.1. This works |
169 |
-@@ -517,6 +577,7 @@ |
170 |
- 'syslogfacility|syslog-facility|facility=s', |
171 |
- 'retry-window=s', 'greylist-action=s', 'greylist-text=s', 'privacy', |
172 |
- 'hostname=s', 'exim', 'listen-queue-size=i', 'x-greylist-header=s', |
173 |
-+ 'tarpit:s', 'targrey', 'retry-count=i', 'auto-whitelist-delay=i', |
174 |
- ) or exit(1); |
175 |
- # note: lookup-by-subnet can be given for compatibility, but it is default |
176 |
- # so do not do nothing with it... |
177 |
-@@ -606,7 +667,9 @@ |
178 |
- awl_clients => defined $opt{'auto-whitelist-clients'} ? |
179 |
- ($opt{'auto-whitelist-clients'} ne '' ? |
180 |
- $opt{'auto-whitelist-clients'} : 5) : 5, |
181 |
-+ awl_delay => $opt{'auto-whitelist-delay'} || 3600, |
182 |
- retry_window => $retry_window, |
183 |
-+ retry_count => $opt{'retry-count'} || 1, |
184 |
- greylist_action => $opt{'greylist-action'} || 'DEFER_IF_PERMIT', |
185 |
- greylist_text => $opt{'greylist-text'} || 'Greylisted, see http://postgrey.schweikert.ch/help/%r.html', |
186 |
- whitelist_clients_files => $opt{'whitelist-clients'} || |
187 |
-@@ -618,6 +681,10 @@ |
188 |
- hostname => defined $opt{hostname} ? $opt{hostname} : hostname, |
189 |
- exim => defined $opt{'exim'}, |
190 |
- x_greylist_header => $opt{'x-greylist-header'} || 'X-Greylist: delayed %t seconds by postgrey-%v at %h; %d', |
191 |
-+ tarpit => defined $opt{'tarpit'} ? |
192 |
-+ ($opt{'tarpit'} ne '' ? |
193 |
-+ $opt{'tarpit'} : 65) : undef, |
194 |
-+ targrey => defined $opt{'targrey'}, |
195 |
- }, |
196 |
- }, 'postgrey'; |
197 |
- |
198 |
-@@ -633,6 +700,11 @@ |
199 |
- require Digest::SHA; |
200 |
- } |
201 |
- |
202 |
-+ # --targrey needs tarpit sec |
203 |
-+ if(defined $opt{'targrey'} && ! defined $opt{'tarpit'}) { |
204 |
-+ $server->{postgrey}{tarpit} = 125; |
205 |
-+ } |
206 |
-+ |
207 |
- $0 = join(' ', @{$server->{server}{commandline}}); |
208 |
- $server->run; |
209 |
- |
210 |
-@@ -711,6 +783,13 @@ |
211 |
- -Env => $self->{postgrey}{db_env} |
212 |
- ) or die "ERROR: can't create database $self->{server}{dbdir}/postgrey_clients.db: $!\n"; |
213 |
- } |
214 |
-+ if($self->{postgrey}{targrey}) { # use targrey |
215 |
-+ tie(%{$self->{postgrey}{db_tarpit}}, 'BerkeleyDB::Btree', |
216 |
-+ -Filename => 'tarpit_clients.db', |
217 |
-+ -Flags => DB_CREATE, |
218 |
-+ -Env => $self->{postgrey}{db_env} |
219 |
-+ ) or die "ERROR: can't create database $self->{server}{dbdir}/tarpit_clients.db: $!\n"; |
220 |
-+ } |
221 |
- } |
222 |
- |
223 |
- sub mux_input() |