Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pymilter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
misc
pymilter
Commits
2bea6ad7
Commit
2bea6ad7
authored
Dec 19, 2006
by
Stuart Gathman
Browse files
Options
Downloads
Patches
Plain Diff
Add archive option to wiretap.
parent
c9f0c94b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
TODO
+8
-0
8 additions, 0 deletions
TODO
bms.py
+26
-2
26 additions, 2 deletions
bms.py
milter.cfg
+4
-2
4 additions, 2 deletions
milter.cfg
with
38 additions
and
4 deletions
TODO
+
8
−
0
View file @
2bea6ad7
When bms.py can't find templates, it passes None to dsn.create_msg(),
which uses local variable as backup, which no longer exist.
Purge old GOSSiP records nightly.
Find and use X-GOSSiP: header for SPAM: and FP: submissions. Would need to
keep tags longer.
Generate DSNs according to RFC 3464
Generate DSNs according to RFC 3464
Parse incoming 3464 DSNs for "Action: failed" to recognize delayed
Parse incoming 3464 DSNs for "Action: failed" to recognize delayed
...
...
This diff is collapsed.
Click to expand it.
bms.py
+
26
−
2
View file @
2bea6ad7
#!/usr/bin/env python
#!/usr/bin/env python
# A simple milter that has grown quite a bit.
# A simple milter that has grown quite a bit.
# $Log$
# $Log$
# Revision 1.73 2006/12/04 18:47:03 customdesigned
# Reject multiple recipients to DSN.
# Auto-disable gossip on DB error.
#
# Revision 1.72 2006/11/22 16:31:22 customdesigned
# Revision 1.72 2006/11/22 16:31:22 customdesigned
# SRS domains were missing srs_reject check when SES was active.
# SRS domains were missing srs_reject check when SES was active.
#
#
...
@@ -28,6 +32,7 @@ import time
...
@@ -28,6 +32,7 @@ import time
import
socket
import
socket
import
struct
import
struct
import
re
import
re
import
shutil
import
gc
import
gc
import
anydbm
import
anydbm
import
Milter.dsn
as
dsn
import
Milter.dsn
as
dsn
...
@@ -85,6 +90,8 @@ reject_virus_from = ()
...
@@ -85,6 +90,8 @@ reject_virus_from = ()
wiretap_users
=
{}
wiretap_users
=
{}
discard_users
=
{}
discard_users
=
{}
wiretap_dest
=
None
wiretap_dest
=
None
mail_archive
=
None
_archive_lock
=
None
blind_wiretap
=
True
blind_wiretap
=
True
check_user
=
{}
check_user
=
{}
block_forward
=
{}
block_forward
=
{}
...
@@ -258,12 +265,13 @@ def read_config(list):
...
@@ -258,12 +265,13 @@ def read_config(list):
reject_virus_from
=
cp
.
getlist
(
'
scrub
'
,
'
reject_virus_from
'
)
reject_virus_from
=
cp
.
getlist
(
'
scrub
'
,
'
reject_virus_from
'
)
# wiretap section
# wiretap section
global
blind_wiretap
,
wiretap_users
,
wiretap_dest
,
discard_users
global
blind_wiretap
,
wiretap_users
,
wiretap_dest
,
discard_users
,
mail_archive
blind_wiretap
=
cp
.
getboolean
(
'
wiretap
'
,
'
blind
'
)
blind_wiretap
=
cp
.
getboolean
(
'
wiretap
'
,
'
blind
'
)
wiretap_users
=
cp
.
getaddrset
(
'
wiretap
'
,
'
users
'
)
wiretap_users
=
cp
.
getaddrset
(
'
wiretap
'
,
'
users
'
)
discard_users
=
cp
.
getaddrset
(
'
wiretap
'
,
'
discard
'
)
discard_users
=
cp
.
getaddrset
(
'
wiretap
'
,
'
discard
'
)
wiretap_dest
=
cp
.
getdefault
(
'
wiretap
'
,
'
dest
'
)
wiretap_dest
=
cp
.
getdefault
(
'
wiretap
'
,
'
dest
'
)
if
wiretap_dest
:
wiretap_dest
=
'
<%s>
'
%
wiretap_dest
if
wiretap_dest
:
wiretap_dest
=
'
<%s>
'
%
wiretap_dest
mail_archive
=
cp
.
getdefault
(
'
wiretap
'
,
'
archive
'
)
global
smart_alias
global
smart_alias
for
sa
,
v
in
[
for
sa
,
v
in
[
...
@@ -811,7 +819,8 @@ class bmsMilter(Milter.Milter):
...
@@ -811,7 +819,8 @@ class bmsMilter(Milter.Milter):
self
.
blacklist
=
True
self
.
blacklist
=
True
self
.
log
(
"
BLACKLIST
"
,
self
.
canon_from
)
self
.
log
(
"
BLACKLIST
"
,
self
.
canon_from
)
global
gossip
global
gossip
if
gossip
and
domain
and
rc
==
Milter
.
CONTINUE
:
if
gossip
and
domain
and
rc
==
Milter
.
CONTINUE
\
and
not
self
.
internal_connection
:
if
self
.
spf
and
self
.
spf
.
result
==
'
pass
'
:
if
self
.
spf
and
self
.
spf
.
result
==
'
pass
'
:
qual
=
'
SPF
'
qual
=
'
SPF
'
else
:
else
:
...
@@ -1579,6 +1588,21 @@ class bmsMilter(Milter.Milter):
...
@@ -1579,6 +1588,21 @@ class bmsMilter(Milter.Milter):
if
rc
!=
Milter
.
CONTINUE
:
if
rc
!=
Milter
.
CONTINUE
:
return
rc
return
rc
if
mail_archive
:
global
_archive_lock
if
not
_archive_lock
:
import
thread
_archive_lock
=
thread
.
allocate_lock
()
_archive_lock
.
acquire
()
try
:
fin
=
open
(
self
.
tempname
,
'
r
'
)
fout
=
open
(
mail_archive
,
'
a
'
)
shutil
.
copyfileobj
(
fin
,
fout
,
8192
)
finally
:
_archive_lock
.
release
()
fin
.
close
()
fout
.
close
()
if
not
defanged
and
not
spam_checked
:
if
not
defanged
and
not
spam_checked
:
os
.
remove
(
self
.
tempname
)
os
.
remove
(
self
.
tempname
)
self
.
tempname
=
None
# prevent re-removal
self
.
tempname
=
None
# prevent re-removal
...
...
This diff is collapsed.
Click to expand it.
milter.cfg
+
4
−
2
View file @
2bea6ad7
...
@@ -38,13 +38,13 @@ case_sensitive_localpart = true
...
@@ -38,13 +38,13 @@ case_sensitive_localpart = true
[defang]
[defang]
# do virus scanning on attached messages also
# do virus scanning on attached messages also
scan_rfc822
=
1
scan_rfc822
=
0
# do virus scanning on attached zipfiles also
# do virus scanning on attached zipfiles also
scan_zip
=
0
scan_zip
=
0
# Comment out scripts in HTML attachments. Can be CPU intensive.
# Comment out scripts in HTML attachments. Can be CPU intensive.
scan_html
=
0
scan_html
=
0
# reject messages with asian fonts because we can't read them
# reject messages with asian fonts because we can't read them
block_chinese
=
1
block_chinese
=
0
# list users who hate forwarded mail
# list users who hate forwarded mail
;block_forward = egghead@mycorp.com, busybee@mycorp.com
;block_forward = egghead@mycorp.com, busybee@mycorp.com
# reject mail with these case insensitive strings in the subject
# reject mail with these case insensitive strings in the subject
...
@@ -128,6 +128,8 @@ blind = 1
...
@@ -128,6 +128,8 @@ blind = 1
# discard outgoing mail without alerting sender
# discard outgoing mail without alerting sender
# can be used in conjunction with wiretap to censor outgoing mail
# can be used in conjunction with wiretap to censor outgoing mail
;discard_users = canned@bigcorp.com
;discard_users = canned@bigcorp.com
# archive copies all delivered mail to a file
;mail_archive = /var/log/mail_archive
#
#
# smart aliases trigger on both sender and recipient
# smart aliases trigger on both sender and recipient
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment