Mercurial > repos > other > Puppet
comparison common/logwatch/dovecot @ 0:956e484adc12
Initial public release of Puppet configs
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 16 Aug 2014 19:47:38 +0000 |
parents | |
children | c858ca1e01d0 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:956e484adc12 |
---|---|
1 ######################################################## | |
2 # $Id: dovecot 159 2013-08-19 09:35:30Z stefjakobs $ | |
3 ######################################################## | |
4 # $Log: dovecot,v $ | |
5 # Revision 1.18 2010/09/18 17:41:00 stefan | |
6 # ignore: ssl-build-param | |
7 # | |
8 # Revision 1.17 2009/06/02 14:48:06 mike | |
9 # Removed some periods that were in the Fedora patch and broke the file -mgt | |
10 # | |
11 # Revision 1.16 2009/06/02 14:45:48 mike | |
12 # Patch from Fedora (Ivana Hutarova Varekova) -mgt | |
13 # | |
14 # Revision 1.15 2008/11/18 06:02:49 mike | |
15 # Rolled back..that was wrong. -mgt | |
16 # | |
17 # Revision 1.14 2008/11/18 06:00:34 mike | |
18 # Removed a space should be better -mgt | |
19 # | |
20 # Revision 1.13 2008/11/18 04:32:49 mike | |
21 # Added bytes detected to IMAP disconnect match expect more issues -mgt | |
22 # | |
23 # Revision 1.12 2008/08/11 15:38:02 mike | |
24 # Connection closed patch from Niels Baggesen -mgt | |
25 # | |
26 # Revision 1.11 2008/06/30 23:07:51 kirk | |
27 # fixed copyright holders for files where I know who they should be | |
28 # | |
29 # Revision 1.10 2008/03/24 23:31:26 kirk | |
30 # added copyright/license notice to each script | |
31 # | |
32 # Revision 1.9 2008/02/14 18:19:51 mike | |
33 # Patch from Gilles Detillieux summarize pop3/imap -mgt | |
34 # | |
35 # Revision 1.8 2008/01/16 20:11:04 bjorn | |
36 # Filtering dovecot start-up message, by Gilles Detillieux. | |
37 # | |
38 # Revision 1.7 2007/06/18 03:54:45 bjorn | |
39 # Better printing of IPv6 addresses, by Patrick Vande Walle. | |
40 # | |
41 # Revision 1.6 2007/03/17 19:13:13 bjorn | |
42 # Now handling dovecot starts/kills. | |
43 # | |
44 # Revision 1.5 2006/12/20 15:25:09 bjorn | |
45 # Additional filtering, by Ivana Varekova. | |
46 # | |
47 # Revision 1.4 2006/08/13 22:02:31 bjorn | |
48 # IPv4 addresses displayed in native format, and don't display user totals | |
49 # if user connects from only one IP address; changes by Patrick Vande Walle. | |
50 # | |
51 # Revision 1.3 2006/08/13 21:06:33 bjorn | |
52 # Added support for Dovecot 1.0 based on patches from Mark Nienberg, and | |
53 # IP addresses displayed without brackets for consistency across versions; | |
54 # modifications by Patrick Vande Walle. | |
55 # | |
56 # Revision 1.2 2005/12/07 04:31:44 bjorn | |
57 # Added $dovecot_ignore_host. | |
58 # | |
59 # Revision 1.1 2005/09/18 17:01:05 bjorn | |
60 # Dovecot filters written by Patrick Vande Walle. | |
61 # | |
62 ######################################################## | |
63 # Please send all comments, suggestions, bug reports, | |
64 # etc, to logwatch-devel@lists.sourceforge.net | |
65 ######################################################## | |
66 # The Dovecot script was written by: | |
67 # Patrick Vande Walle <patrick@isoc.lu> | |
68 # Based on previous work by | |
69 # Pawel Golaszewski <blues@gda.pl> | |
70 # | |
71 # TODO: | |
72 # - use printf features to align text in table | |
73 # | |
74 ######################################################## | |
75 | |
76 ######################################################## | |
77 ## Copyright (c) 2008 Patrick Vande Walle | |
78 ## Covered under the included MIT/X-Consortium License: | |
79 ## http://www.opensource.org/licenses/mit-license.php | |
80 ## All modifications and contributions by other persons to | |
81 ## this script are assumed to have been donated to the | |
82 ## Logwatch project and thus assume the above copyright | |
83 ## and licensing terms. If you want to make contributions | |
84 ## under your own copyright or a different license this | |
85 ## must be explicitly stated in the contribution an the | |
86 ## Logwatch project reserves the right to not accept such | |
87 ## contributions. If you have made significant | |
88 ## contributions to this script and want to claim | |
89 ## copyright please contact logwatch-devel@lists.sourceforge.net. | |
90 ######################################################### | |
91 | |
92 my $Debug = $ENV{'LOGWATCH_DEBUG'} || 0; | |
93 my $Detail = $ENV{'dovecot_detail'} || $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0; | |
94 my $IgnoreHost = $ENV{'dovecot_ignore_host'} || ""; | |
95 | |
96 my $Restarts = 0; | |
97 my $End = 0; | |
98 | |
99 if ( $Debug >= 5 ) { | |
100 print STDERR "\n\nDEBUG \n\n"; | |
101 } | |
102 | |
103 use Socket; | |
104 my $rdns = {}; | |
105 sub hostName { | |
106 (my $ipaddr) = @_; | |
107 | |
108 if ($ENV{'LOGWATCH_NUMERIC'} || $ENV{'dovecot_numeric'}) { | |
109 return $ipaddr; | |
110 } | |
111 | |
112 if (exists $rdns{ $ipaddr }) { | |
113 return $rdns{ $ipaddr }; | |
114 } | |
115 $rdns{ $ipaddr } = $ipaddr; | |
116 | |
117 my $iaddr = inet_aton($ipaddr); | |
118 if (defined $iaddr) { | |
119 my $host = gethostbyaddr($iaddr, AF_INET); | |
120 if (defined $host) { | |
121 my $iaddrcheck = gethostbyname($host); | |
122 if (defined $iaddrcheck) { | |
123 if ($iaddr == $iaddrcheck) { | |
124 $rdns{ $ipaddr } = $host; | |
125 } | |
126 } | |
127 } | |
128 } | |
129 return $rdns{ $ipaddr }; | |
130 } | |
131 | |
132 # Handle "dovecot: <svc>" and "dovecot: [ID yyyyy mail.info] <svc" | |
133 # Also handle optional hostname before dovecot tag for syslog format. | |
134 my $dovecottag = qr/(?:[a-z][a-z0-9]+ )?dovecot:(?:\s*\[[^]]+\])?/; | |
135 | |
136 while (defined($ThisLine = <STDIN>)) { | |
137 # remove timestamp. We can't use *RemoveHeaders because we need the | |
138 # service name | |
139 $ThisLine =~ s/^\w{3} .\d \d\d:\d\d:\d\d (?:[^\s:]* |)//; | |
140 | |
141 if ( ($ThisLine =~ /(?:ssl-build-param|ssl-params): SSL parameters regeneration completed/) or | |
142 ($ThisLine =~ /ssl-params: Generating SSL parameters/) or | |
143 ($ThisLine =~ /auth-worker/) or | |
144 ($ThisLine =~ /auth:.*: Connected to/) or | |
145 ($ThisLine =~ /Connection closed/) or | |
146 ($ThisLine =~ /IMAP.*: Connection closed bytes/) or | |
147 ($ThisLine =~ /IMAP.* failed with mbox file/) or | |
148 ($ThisLine =~ /discarded duplicate forward to/) or | |
149 ($ThisLine =~ /discarding vacation response/) | |
150 ) | |
151 { | |
152 # We don't care about these | |
153 } elsif ( $ThisLine =~ /Killed with signal /) { | |
154 $End++; | |
155 } elsif ( $ThisLine =~ /Dovecot (v\d[^ ]* |)starting up( \(core dumps disabled\))?$/) { | |
156 $Restarts++; | |
157 $End = 0; | |
158 } elsif ( ( ($User, $Host) = ( $ThisLine =~ /^$dovecottag pop3-login: Login: (.*?) \[(.*)\]/ ) ) or | |
159 ( ($User, $Host) = ( $ThisLine =~ /^$dovecottag pop3-login: (?:Info: )?Login: user=\<(.*?)\>.*rip=(.*)\, lip=/ ) ) ) { | |
160 if ($Host !~ /$IgnoreHost/) { | |
161 $Host = hostName($Host); | |
162 $Login{$User}{$Host}++; | |
163 $LoginPOP3{$User}++; | |
164 $ConnectionPOP3{$Host}++; | |
165 $Connection{$Host}++; | |
166 } | |
167 } elsif ( ( ($User, $Host) = ( $ThisLine =~ /^$dovecottag imap-login: Login: (.*?) \[(.*)\]/ ) ) or | |
168 ( ($User, $Host) = ( $ThisLine =~ /^$dovecottag imap-login: (?:Info: )?Login: user=\<(.*?)\>.*rip=(.*)\, lip=/ ) ) ) { | |
169 if ($Host !~ /$IgnoreHost/) { | |
170 $Host = hostName($Host); | |
171 $Login{$User}{$Host}++; | |
172 $LoginIMAP{$User}++; | |
173 $ConnectionIMAP{$Host}++; | |
174 $Connection{$Host}++; | |
175 } | |
176 } elsif ( ($User, $Host) = ( $ThisLine =~ /$dovecottag managesieve-login: Login: user=\<(.*?)\>.*rip=(.*)\, lip=/ ) ) { | |
177 if ($Host !~ /$IgnoreHost/) { | |
178 $Host = hostName($Host); | |
179 $SieveLogin{$User}{$Host}++; | |
180 $LoginSieve{$User}++; | |
181 $ConnectionSieve{$Host}++; | |
182 $Connection{$Host}++; | |
183 } | |
184 | |
185 # 'lda' for dovecot 2.0, 'deliver' for earlier versions | |
186 } elsif ( ($User, $Mailbox) = ( $ThisLine =~ /^$dovecottag (?:lda|deliver)\((.*)\): msgid=.*: saved mail to (\S+)/ ) ) { | |
187 $Deliver{$User}{$Mailbox}++; | |
188 | |
189 # For Sieve-based delivery | |
190 } elsif ( ($User, $Mailbox) = ( $ThisLine =~ /^$dovecottag (?:lda\(|deliver\(|lmtp\(\d+, )(.*)\): (?:[^:]+: )?sieve: msgid=.*: stored mail into mailbox '([^']*)'/ ) ) { | |
191 $Deliver{$User}{$Mailbox}++; | |
192 | |
193 # LMTP-based delivery | |
194 } elsif ( ($User, $Mailbox) = ( $ThisLine =~ /^$dovecottag lmtp\(\d+, (.*)\): [^:]+: msgid=.*: saved mail to (\S+)/ ) ) { | |
195 # dovecot: [ID 583609 mail.info] lmtp(12782, cloyce@headgear.org): jBt1EfjCMk3uMQAAm9eMBA: msgid=<4D32DB1F.3080707@c-dot.co.uk>: saved mail to INBOX | |
196 $Deliver{$User}{$Mailbox}++; | |
197 | |
198 # sieve forward | |
199 } elsif (($User, $Recip) = ($ThisLine =~ /^$dovecottag (?:lda|deliver)\((.*)\): sieve: msgid=.* forwarded to \<(.*)\>/)) { | |
200 $Forwarded{$User}{$Recip}++; | |
201 | |
202 # sieve vacation | |
203 } elsif (($User, $Recip) = ($ThisLine =~ /^$dovecottag (?:lda|deliver)\((.*)\): sieve: msgid=.* sent vacation response to \<(.*)\>/)) { | |
204 $VacationResponse{$User}{$Recip}++; | |
205 | |
206 } elsif (($User, $Recip) = ($ThisLine =~ /^$dovecottag (?:lda|deliver)\((.*)\): sieve: msgid=.* discarded duplicate vacation response to \<(.*)\>/ )) { | |
207 $VacationDup{$User}{$Recip}++; | |
208 | |
209 } elsif ( $ThisLine =~ /^$dovecottag (?:lda|deliver)\(.*\): sieve: msgid=.* marked message to be discarded if not explicitly delivered/ ) { | |
210 # dovecot: lda(joe): sieve: msgid=<m$01$@com>: marked message to be discarded if not explicitly delivered (discard action) | |
211 # IGNORE | |
212 } elsif ( $ThisLine =~ /^$dovecottag lmtp\(.*\): Connect from/ ) { | |
213 # dovecot: [ID 583609 mail.info] lmtp(12782): Connect from local: 1 Time(s) | |
214 # IGNORE | |
215 | |
216 } elsif ( $ThisLine =~ /^$dovecottag lmtp\(.*\): Disconnect from/ ) { | |
217 # dovecot: [ID 583609 mail.info] lmtp(12782): Disconnect from local: Client quit: 1 Time(s) | |
218 # IGNORE | |
219 | |
220 | |
221 # This is for Dovecot 1.0 series | |
222 } elsif ( ($User, $Host) = ( $ThisLine =~ /^$dovecottag pop3-login: Login: user=\<(.*?)\>.*rip=(.*)\, lip=/ ) ) { | |
223 if ($Host !~ /$IgnoreHost/) { | |
224 $Host = hostName($Host); | |
225 $Login{$User}{$Host}++; | |
226 $LoginPOP3{$User}++; | |
227 $ConnectionPOP3{$Host}++; | |
228 $Connection{$Host}++; | |
229 } | |
230 } elsif ( ($User, $Host) = ( $ThisLine =~ /^$dovecottag imap-login: Login: user=\<(.*?)\>.*rip=(.*)\, lip=/) ) { | |
231 if ($Host !~ /$IgnoreHost/) { | |
232 $Host = hostName($Host); | |
233 $Login{$User}{$Host}++; | |
234 $LoginIMAP{$User}++; | |
235 $ConnectionIMAP{$Host}++; | |
236 $Connection{$Host}++; | |
237 } | |
238 | |
239 # Dovecot 2.0 proxy | |
240 } elsif ( ($User, $Host) = ( $ThisLine =~ /^$dovecottag pop3-login: proxy\((.*)\): started proxying to .*: user=<.*>, method=.*, rip=(.*), lip=/ ) ) { | |
241 if ($Host !~ /$IgnoreHost/) { | |
242 $ProxyLogin{$User}{$Host}++; | |
243 $ProxyLoginPOP3{$User}++; | |
244 $ProxyConnectionPOP3{$Host}++; | |
245 $ProxyConnection{$Host}++; | |
246 } | |
247 } elsif ( ($User, $Host) = ( $ThisLine =~ /^$dovecottag imap-login: proxy\((.*)\): started proxying to .*: user=<.*>, method=.*, rip=(.*), lip=/ ) ) { | |
248 if ($Host !~ /$IgnoreHost/) { | |
249 $ProxyLogin{$User}{$Host}++; | |
250 $ProxyLoginIMAP{$User}++; | |
251 $ProxyConnectionIMAP{$Host}++; | |
252 $ProxyConnection{$Host}++; | |
253 } | |
254 } elsif ( ($Reason) = ( $ThisLine =~ /proxy\(.*\): disconnecting .* \(Disconnected (.*)\)/ ) ) { | |
255 $ProxyDisconnected{$Reason}++; | |
256 | |
257 } elsif ($ThisLine =~ /Disconnected (\[|top)/) { | |
258 $Disconnected{"no reason"}++; | |
259 } elsif (($Reason) = ($ThisLine =~ /Disconnected: (.*) \[/) ) { | |
260 $Disconnected{$Reason}++; | |
261 } elsif (($Reason) = ($ThisLine =~ /Disconnected: (.*) (bytes|top)=.*/) ) { | |
262 $Disconnected{$Reason}++; | |
263 } elsif (($Reason) = ($ThisLine =~ /Disconnected \((.*)\):/) ) { | |
264 $Disconnected{$Reason}++; | |
265 } elsif ($ThisLine =~ /Disconnected (bytes|top)=.*/) { | |
266 $Disconnected{"No reason"}++; | |
267 } elsif (($Reason, $Host) = ($ThisLine =~ /TLS initialization failed/) ) { | |
268 $TLSInitFail++; | |
269 } elsif (($Host) = ($ThisLine =~ /Aborted login:.* rip=(.*),/) ) { | |
270 $Host = hostName($Host); | |
271 $Aborted{$Host}++; | |
272 } elsif (($Host) = ($ThisLine =~ /Aborted login \[(.*)\]/) ) { | |
273 $Host = hostName($Host); | |
274 $Aborted{$Host}++; | |
275 } elsif (($Reason) = ($ThisLine =~ /Aborted login \((.*)\):/)) { | |
276 $Aborted{$Reason}++; | |
277 } elsif (($user, $rip, $lip) = ($ThisLine =~ /Maximum number of connections.* exceeded.* user=<([^>]+)>.*rip=([^,]+), lip=([^,]+)/)) { | |
278 # dovecot: [ID 583609 mail.info] imap-login: Maximum number of connections from user+IP exceeded (mail_max_userip_connections=10): user=<cloyce@headgear.org>, method=CRAM-MD5, rip=102.225.17.52, lip=14.105.322.67, TLS | |
279 $LimitExceeded{"max_userip_connections: $user from $rip to $lip"}++; | |
280 | |
281 # This is for Dovecot 1.0 series | |
282 # Overly general matches in this section -mgt | |
283 | |
284 } elsif ($ThisLine =~ /Disconnected for inactivity/) { | |
285 $Disconnected{"Inactivity"}++; | |
286 } elsif ($ThisLine =~ /Disconnected in IDLE/) { | |
287 $Disconnected{"in IDLE"}++; | |
288 } elsif ($ThisLine =~ /Disconnected in APPEND/) { | |
289 $Disconnected{"in APPEND"}++; | |
290 } elsif (($ThisLine =~ /Disconnected$/) or | |
291 ($ThisLine =~ /(IMAP|POP3)\(.+\): Disconnected (bytes|top|rip|user|method)=/) or | |
292 ($ThisLine =~ /(imap\-login|pop3\-login): Disconnected: (bytes|top|rip|user|method)=/) ) { | |
293 $Disconnected{"no reason"}++; | |
294 } elsif ( (($Reason) = ($ThisLine =~ /(?:IMAP|POP3).+: Disconnected: (.+) (bytes|top)=/i)) or | |
295 (($Reason) = ($ThisLine =~ /(?:imap\-login|pop3\-login): Disconnected: \(?(.+)\)?: /)) or | |
296 #This one should go away also -mgt | |
297 (($Reason) = ($ThisLine =~ /IMAP.+: Disconnected: (.+)/i)) ) { | |
298 $Disconnected{$Reason}++; | |
299 } elsif ($ThisLine =~ /(IMAP|POP3).+: Connection closed (top|bytes)=/i) { | |
300 $ConnectionCl{"no reason"}++; | |
301 } elsif ( ($Reason) = ($ThisLine =~ /(?:IMAP|POP3).+: Connection closed: (.*) (?:bytes|method|top|rip|user)=/i) ) { | |
302 $ConnectionCl{$Reason}++; | |
303 } elsif ($ThisLine =~ /(IMAP|POP3).+: (Connection closed.*)/) { | |
304 $Disconnected{$2}++; | |
305 } elsif (($Host) = ($ThisLine =~ /(?:imap\-login|pop3\-login): Aborted login: .*rip=(?:::ffff:)?(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/) ) { | |
306 $Aborted{$Host}++; | |
307 } elsif (($Error) = ($ThisLine =~ /child \d* (?:\(login\) )?returned error (.*)/)) { | |
308 # dovecot: child 23747 (login) returned error 89 | |
309 # dovecot: log: Error: service(auth): child 19654 returned error 89 (Fatal failure) | |
310 $ChildErr{$Error}++; | |
311 } elsif (($Name) = ($ThisLine =~ /$dovecottag IMAP\((.*)\): .*(.*) failed: Disk quota exceeded/i)) { | |
312 # dovecot: IMAP(podracka): mkdir(/home/LF/KLINIKY/podracka/mail/.imap/saved-messages) failed: Disk quota exceeded | |
313 $DiskQuotaExceed{$Name}++; | |
314 } else { | |
315 # Report any unmatched entries... | |
316 chomp($ThisLine); | |
317 $OtherList{$ThisLine}++; | |
318 } | |
319 } | |
320 | |
321 ################################################ | |
322 | |
323 if ( $End ) { | |
324 print "\nDovecot was killed, and not restarted afterwards.\n"; | |
325 } | |
326 | |
327 if ( ( $Detail >=5 ) and $Restarts ) { | |
328 print "\nDovecot restarted $Restarts time(s).\n"; | |
329 } | |
330 | |
331 if ( ( $Detail >= 5 ) and (keys %Connection)) { | |
332 print "\n[Dovecot IMAP and POP3] Connections:". | |
333 "\n====================================". | |
334 "\nPOP3 IMAP Total Host". | |
335 "\n" . "-" x 72; | |
336 | |
337 $TLSInitFail = 0; | |
338 foreach $Host (sort { $Connection{$b} <=> $Connection{$a} } | |
339 keys %Connection) { | |
340 $Total = $Connection{$Host}; | |
341 if (defined ($ConnectionPOP3{$Host})) { | |
342 $Conns = $ConnectionPOP3{$Host}; | |
343 } else { | |
344 $Conns = 0; | |
345 } | |
346 if (defined ($ConnectionIMAP{$Host})) { | |
347 $IMAP = $ConnectionIMAP{$Host}; | |
348 } else { | |
349 $IMAP = 0; | |
350 } | |
351 # Cleanly display IPv4 addresses | |
352 $Host=~ s/::ffff://; | |
353 printf "\n%4s %4s %5s %s", $Conns, $IMAP, $Total, $Host; | |
354 $POP3Count += $Conns; | |
355 $IMAPCount += $IMAP; | |
356 $TotalCount += $Total; | |
357 } | |
358 print "\n" . "-" x 72; | |
359 printf "\n%4s %4s %5s %s", $POP3Count, $IMAPCount, $TotalCount, "Total"; | |
360 } | |
361 | |
362 if (keys %Deliver) { | |
363 my $DeliverCount = 0; | |
364 my $DeliverUserCount = {}; | |
365 foreach my $User (keys %Deliver) { | |
366 foreach my $Mailbox (keys %{$Deliver{$User}}) { | |
367 $DeliverUserCount{$User} += $Deliver{$User}{$Mailbox}; | |
368 } | |
369 $DeliverCount += $DeliverUserCount{$User}; | |
370 } | |
371 printf "\n" if ($Detail >= 5); | |
372 printf "\nDovecot Deliveries: %s", $DeliverCount; | |
373 if ($Detail >= 5) { | |
374 foreach my $User (sort { $DeliverUserCount{$b} <=> $DeliverUserCount{$a} } | |
375 keys %DeliverUserCount) { | |
376 printf "\n %4s %s", $DeliverUserCount{$User}, $User; | |
377 if ($Detail >= 10) { | |
378 foreach my $Mailbox (sort { | |
379 $Deliver{$User}{$b} <=> $Deliver{$User}{$a} | |
380 } keys %{$Deliver{$User}}) { | |
381 printf "\n %4s %s", $Deliver{$User}{$Mailbox}, $Mailbox; | |
382 } | |
383 } | |
384 } | |
385 } | |
386 } | |
387 | |
388 if (($Detail >= 10) and (keys %Forwarded)) { | |
389 $TotalForwarded = 0; | |
390 | |
391 print "\n\nDovecot LDA sieve forwards:"; | |
392 foreach $User (sort keys %Forwarded) { | |
393 print "\n\n User $User"; | |
394 foreach my $Recip (sort keys %{$Forwarded{$User}}) { | |
395 print "\n To $Recip: $Forwarded{$User}{$Recip} time(s)"; | |
396 $TotalForwarded += $Forwarded{$User}{$Recip}; | |
397 } | |
398 } | |
399 print "\n\n Total: $TotalForwarded Time(s)"; | |
400 } | |
401 | |
402 if (($Detail >= 10) and (keys %VacationResponse)) { | |
403 $TotalVacResp = 0; | |
404 print "\n\nDovecot LDA sieve vacation responses:"; | |
405 foreach my $User (sort keys %VacationResponse) { | |
406 print "\n\n User $User"; | |
407 foreach my $Recip (sort keys %{$VacationResponse{$User}}) { | |
408 print "\n To $Recip: $VacationResponse{$User}{$Recip} time(s)"; | |
409 $TotalVacResp += $VacationResponse{$User}{$Recip}; | |
410 } | |
411 } | |
412 print "\n\n Total: $TotalVacResp Time(s)"; | |
413 } | |
414 | |
415 if (($Detail >= 10) and (keys %VacationDup)) { | |
416 $TotalVacDup = 0; | |
417 print "\n\nDovecot LDA sieve duplicate vacation responses not sent:"; | |
418 foreach my $User (sort keys %VacationDup) { | |
419 print "\n User $User"; | |
420 foreach my $Recip (sort keys %{$VacationDup{$User}}) { | |
421 print "\n To $Recip: $VacationDup{$User}{$Recip} time(s)"; | |
422 $TotalVacDup += $VacationDup{$User}{$Recip}; | |
423 } | |
424 } | |
425 print "\n\n Total: $TotalVacDup Time(s)"; | |
426 } | |
427 | |
428 | |
429 if (keys %Login) { | |
430 my $LoginCount = 0; | |
431 my $LoginUserCount = {}; | |
432 foreach my $User (keys %Login) { | |
433 foreach my $Host (keys %{$Login{$User}}) { | |
434 $LoginUserCount{$User} += $Login{$User}{$Host}; | |
435 } | |
436 $LoginCount += $LoginUserCount{$User}; | |
437 $LoginPOP3{$User} = 0 if $LoginPOP3{$User} <= 0; | |
438 $LoginIMAP{$User} = 0 if $LoginIMAP{$User} <= 0; | |
439 } | |
440 printf "\n" if ($Detail >= 5); | |
441 printf "\nDovecot IMAP and POP3 Successful Logins: %s", $LoginCount; | |
442 if ($Detail >= 5) { | |
443 foreach my $User (sort { $LoginUserCount{$b} <=> $LoginUserCount{$a} } | |
444 keys %LoginUserCount) { | |
445 printf("\n %4s %s", $LoginUserCount{$User}, $User); | |
446 if ($Detail >= 10) { | |
447 printf(" (%s POP3, %s IMAP)", $LoginPOP3{$User}, $LoginIMAP{$User}); | |
448 foreach my $Host (sort { $Login{$User}{$b} <=> $Login{$User}{$a} } | |
449 keys %{$Login{$User}}) { | |
450 $HostCount = $Login{$User}{$Host}; | |
451 # Cleanly display IPv4 addresses | |
452 $Host=~ s/::ffff://; | |
453 printf "\n %4s %s", $Login{$User}{$Host}, $Host; | |
454 } | |
455 } | |
456 } | |
457 } | |
458 } | |
459 | |
460 if ( ( $Detail >= 10 ) and (keys %SieveLogin)) { | |
461 print "\n\nDovecot ManageSieve Successful Logins:"; | |
462 $LoginCount = 0; | |
463 foreach my $User (sort keys %SieveLogin) { | |
464 print "\n\n User $User:"; | |
465 $UserCount = 0; | |
466 $NumHosts = 0; | |
467 foreach $Host (sort keys %{$SieveLogin{$User}}) { | |
468 $NumHosts++; | |
469 $HostCount = $SieveLogin{$User}{$Host}; | |
470 # Cleanly display IPv4 addresses | |
471 $Host=~ s/::ffff://; | |
472 print "\n From $Host: $HostCount Time(s)"; | |
473 $UserCount += $HostCount; | |
474 } | |
475 $LoginCount += $UserCount; | |
476 if ($NumHosts > 1) { | |
477 print "\n Total: $UserCount Time(s)"; | |
478 } | |
479 } | |
480 print "\n\nTotal: $LoginCount successful ManageSieve logins"; | |
481 } | |
482 | |
483 if (keys %LimitExceeded) { | |
484 print "\n\nDovecot limits exceeded:"; | |
485 foreach my $Reason (sort keys %LimitExceeded) { | |
486 print "\n $Reason: $LimitExceeded{$Reason} Time(s)"; | |
487 } | |
488 } | |
489 | |
490 if (keys %Disconnected) { | |
491 my $Disconnects = 0; | |
492 foreach my $Reason (%Disconnected) { | |
493 $Disconnects += $Disconnected{$Reason}; | |
494 } | |
495 printf "\n" if ($Detail >= 5); | |
496 printf "\nDovecot disconnects: %s", $Disconnects; | |
497 if ($Detail >= 5) { | |
498 foreach my $Reason (sort { $Disconnected{$b} <=> $Disconnected{$a} } | |
499 keys %Disconnected) { | |
500 printf "\n %4s %s", $Disconnected{$Reason}, $Reason; | |
501 } | |
502 } | |
503 } | |
504 | |
505 if (keys %ConnectionCl) { | |
506 print "\n\nDovecot connections closed:"; | |
507 foreach my $Reason (sort keys %ConnectionCl) { | |
508 print "\n $Reason: $ConnectionCl{$Reason} Time(s)"; | |
509 } | |
510 } | |
511 | |
512 if (keys %ChildErr) { | |
513 print "\n\nDovecot child error:"; | |
514 foreach my $Error (sort keys %ChildErr) { | |
515 print "\n error number ". $Error . ": ". $ChildErr{$Error} ." Time(s)"; | |
516 } | |
517 } | |
518 | |
519 if ((keys %Aborted) && ($Detail >= 10)) { | |
520 print "\n\nLogout/aborts:"; | |
521 foreach my $Host (sort keys %Aborted) { | |
522 print "\n $Host: $Aborted{$Host} Time(s)"; | |
523 } | |
524 } | |
525 | |
526 if ($TLSInitFail > 0) { | |
527 print "\n\nTLS Initialization failed $TLSInitFail Time(s)"; | |
528 } | |
529 | |
530 if (keys %DiskQuotaExceed) { | |
531 print "\n\nDisk quota exceeded:"; | |
532 foreach my $Name (sort keys %DiskQuotaExceed) { | |
533 print "\n disk quota for user '". $Name . "' exceeded: ". $DiskQuotaExceed{$Name} ." Time(s)"; | |
534 } | |
535 } | |
536 | |
537 if ( ( $Detail >= 5 ) and (keys %ProxyLogin)) { | |
538 print "\n\nDovecot Proxy IMAP and POP3 Successful Logins:"; | |
539 $LoginCount = 0; | |
540 foreach my $User (sort keys %ProxyLogin) { | |
541 print "\n User $User:"; | |
542 if ( ($Detail >= 10) and ($ProxyLoginPOP3{$User} > 0 || $ProxyLoginIMAP{$User} > 0) ) { | |
543 print " ("; | |
544 if ($ProxyLoginPOP3{$User} > 0) { print "$ProxyLoginPOP3{$User} POP3"; }; | |
545 if ($ProxyLoginPOP3{$User} > 0 && $ProxyLoginIMAP{$User} > 0) { print "/"; }; | |
546 if ($ProxyLoginIMAP{$User} > 0) { print "$ProxyLoginIMAP{$User} IMAP"; }; | |
547 print ")"; | |
548 } | |
549 $UserCount = 0; | |
550 $NumHosts = 0; | |
551 foreach $Host (sort keys %{$ProxyLogin{$User}}) { | |
552 $NumHosts++; | |
553 $HostCount = $ProxyLogin{$User}{$Host}; | |
554 # Cleanly display IPv4 addresses | |
555 $Host=~ s/::ffff://; | |
556 print "\n From $Host: $HostCount Time(s)" if ($Detail >= 10); | |
557 $UserCount += $HostCount; | |
558 } | |
559 $LoginCount += $UserCount; | |
560 if ($Detail >= 10) { | |
561 if ($NumHosts > 1) { | |
562 print "\n Total: $UserCount Time(s)\n"; | |
563 } else { | |
564 print "\n"; | |
565 } | |
566 } elsif ($Detail >= 5) { | |
567 print " $UserCount Time(s)"; | |
568 } | |
569 } | |
570 print "\nTotal: $LoginCount successful logins"; | |
571 } | |
572 | |
573 if (keys %ProxyDisconnected) { | |
574 print "\n\nDovecot Proxy disconnects:\n"; | |
575 foreach my $Reason (sort keys %ProxyDisconnected) { | |
576 print " $Reason: $ProxyDisconnected{$Reason} Time(s)\n"; | |
577 } | |
578 } | |
579 | |
580 if (keys %OtherList) { | |
581 print "\n\n**Unmatched Entries**\n"; | |
582 foreach $line (sort {$a cmp $b} keys %OtherList) { | |
583 print " $line: $OtherList{$line} Time(s)\n"; | |
584 } | |
585 } | |
586 | |
587 exit(0); | |
588 | |
589 | |
590 # vi: shiftwidth=3 tabstop=3 syntax=perl et | |
591 # Local Variables: | |
592 # mode: perl | |
593 # perl-indent-level: 3 | |
594 # indent-tabs-mode: nil | |
595 # End: |