Gossip configuration options: client or standalone with optional peers.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
# A simple milter that has grown quite a bit.
|
||||
# $Log$
|
||||
# Revision 1.96 2007/03/17 21:22:48 customdesigned
|
||||
# New delayed DSN pattern. Retab (expandtab).
|
||||
#
|
||||
# Revision 1.95 2007/03/03 19:18:57 customdesigned
|
||||
# Fix continuing findsrs when srs.reverse fails.
|
||||
#
|
||||
@@ -117,7 +120,8 @@ from email.Utils import getaddresses,parseaddr
|
||||
# Import gossip if available
|
||||
try:
|
||||
import gossip
|
||||
from gossip.server import Gossip,Peer
|
||||
import gossip.client
|
||||
import gossip.server
|
||||
except: gossip = None
|
||||
|
||||
# Import pysrs if available
|
||||
@@ -228,9 +232,6 @@ logging.basicConfig(
|
||||
)
|
||||
milter_log = logging.getLogger('milter')
|
||||
|
||||
if gossip:
|
||||
gossip_node = Gossip('gossip4.db',1000)
|
||||
|
||||
def read_config(list):
|
||||
cp = MilterConfigParser({
|
||||
'tempdir': "/var/log/milter/save",
|
||||
@@ -374,6 +375,18 @@ def read_config(list):
|
||||
srs_domain.add(cp.getdefault('srs','fwdomain'))
|
||||
banned_users = cp.getlist('srs','banned_users')
|
||||
|
||||
if gossip:
|
||||
global gossip_node
|
||||
if cp.has_option('gossip','server'):
|
||||
server = cp.get('gossip','server')
|
||||
host,port = gossip.splitaddr(server)
|
||||
gossip_node = gossip.client.Gossip(host,port)
|
||||
else:
|
||||
gossip_node = gossip.server.Gossip('gossip4.db',1000)
|
||||
for p in cp.getlist('gossip','peers'):
|
||||
host,port = gossip.splitaddr(p)
|
||||
gossip_node.peers.append(gossip.server.Peer(host,port))
|
||||
|
||||
def findsrs(fp):
|
||||
lastln = None
|
||||
for ln in fp:
|
||||
|
||||
+15
@@ -200,3 +200,18 @@ blind = 1
|
||||
# delivered.
|
||||
;dspam_screener=david,goliath
|
||||
# The dspam CGI can also be used: logins must match dspam users
|
||||
|
||||
# Optional pygossip interface
|
||||
#
|
||||
# GOSSiP tracks reputation of domain:qualifier pairs. For instance,
|
||||
# the reputation of example.com:SPF is tracked separately from
|
||||
# example.com:neutral. Currently qualifiers are
|
||||
# SPF,neutral,softfail,fail,permerror,GUESS,HELO
|
||||
[gossip]
|
||||
# Use a dedicated GOSSiP server. If not specified, a local database
|
||||
# will be used.
|
||||
;server=host:11900
|
||||
# If a local database is used, also consult these GOSSiP servers about
|
||||
# domains. Peer reputation is also tracked as to how often they
|
||||
# agree with us, and weighted accordingly.
|
||||
;peers=host1:port,host2
|
||||
|
||||
Reference in New Issue
Block a user