[Spambayes-checkins] spambayes/spambayes ImapUI.py, 1.15, 1.16 Options.py, 1.61, 1.62 OptionsClass.py, 1.7, 1.8 ProxyUI.py, 1.15, 1.16 UserInterface.py, 1.15, 1.16

Tony Meyer anadelonbrin at users.sourceforge.net
Tue Aug 19 02:52:06 EDT 2003


Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv20231/spambayes

Modified Files:
	ImapUI.py Options.py OptionsClass.py ProxyUI.py 
	UserInterface.py 
Log Message:
Implement (only minor changes):
[ 790615 ] Allowed remote connections management

This also addresses (sufficiently, I believe):
[ 698036 ] pop3proxy security

Index: ImapUI.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/ImapUI.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ImapUI.py	18 Aug 2003 00:53:11 -0000	1.15
--- ImapUI.py	19 Aug 2003 08:52:04 -0000	1.16
***************
*** 65,70 ****
      ('imap',                  'password'),
      ('imap',                  'use_ssl'),
      ('Header Options',        None),
!     ('pop3proxy',               'notate_to'),
      ('pop3proxy',             'notate_subject'),
      ('Headers',               'include_score'),
--- 65,72 ----
      ('imap',                  'password'),
      ('imap',                  'use_ssl'),
+     ('Interface Options',     None),
+     ('html_ui',               'allow_remote_connections'),
      ('Header Options',        None),
!     ('pop3proxy',             'notate_to'),
      ('pop3proxy',             'notate_subject'),
      ('Headers',               'include_score'),
***************
*** 73,83 ****
      ('pop3proxy',             'add_mailid_to'),
      ('pop3proxy',             'strip_incoming_mailids'),
!     ('Storage Options',  None),
!     ('Storage',             'persistent_storage_file'),
!     ('Storage',             'messageinfo_storage_file'),
!     ('Statistics Options',  None),
!     ('Categorization',      'ham_cutoff'),
!     ('Categorization',      'spam_cutoff'),
!     ('Classifier',          'experimental_ham_spam_imbalance_adjustment'),
  )
  
--- 75,85 ----
      ('pop3proxy',             'add_mailid_to'),
      ('pop3proxy',             'strip_incoming_mailids'),
!     ('Storage Options',       None),
!     ('Storage',               'persistent_storage_file'),
!     ('Storage',               'messageinfo_storage_file'),
!     ('Statistics Options',    None),
!     ('Categorization',        'ham_cutoff'),
!     ('Categorization',        'spam_cutoff'),
!     ('Classifier',            'experimental_ham_spam_imbalance_adjustment'),
  )
  

Index: Options.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Options.py,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** Options.py	7 Aug 2003 00:11:01 -0000	1.61
--- Options.py	19 Aug 2003 08:52:04 -0000	1.62
***************
*** 803,809 ****
       BOOLEAN, RESTORE),
  
!     ("allow_remote_connections", "Allow remote connections", False,
!      """""",
!      BOOLEAN, RESTORE),
  
      ("display_to", "Display To: in message review", False,
--- 803,814 ----
       BOOLEAN, RESTORE),
  
!     ("allow_remote_connections", "Allowed remote connections", "localhost",
!      """Enter a list of trusted IPs, separated by commas. Remote
!      connections from any of them will be allowed. You can trust any
!      IP using a single '*' as field value. You can also trust ranges of
!      IPs using the '*' character as a wildcard (for instance 192.168.0.*).
!      The localhost IP will always be trusted. Type 'localhost' in the
!      field to trust this only address.""",
!      IP_LIST, RESTORE),
  
      ("display_to", "Display To: in message review", False,

Index: OptionsClass.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/OptionsClass.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** OptionsClass.py	19 Aug 2003 08:44:28 -0000	1.7
--- OptionsClass.py	19 Aug 2003 08:52:04 -0000	1.8
***************
*** 92,96 ****
             'PATH', 'VARIABLE_PATH', 'FILE', 'FILE_WITH_PATH',
             'IMAP_FOLDER', 'IMAP_ASTRING',
!            'RESTORE', 'DO_NOT_RESTORE',
            ]
  
--- 92,96 ----
             'PATH', 'VARIABLE_PATH', 'FILE', 'FILE_WITH_PATH',
             'IMAP_FOLDER', 'IMAP_ASTRING',
!            'RESTORE', 'DO_NOT_RESTORE', 'IP_LIST',
            ]
  
***************
*** 689,696 ****
  PORT = r"[\d]+"
  EMAIL_ADDRESS = r"[\w\-\.]+@[\w\-\.]+"
! PATH = r"[\w \$\.\-~:\\/\*\@\=]+"
  VARIABLE_PATH = PATH + r"%"
  FILE = r"[\S]+"
  FILE_WITH_PATH = PATH
  # IMAP seems to allow any character at all in a folder name,
  # but we want to use the comma as a delimiter for lists, so
--- 689,697 ----
  PORT = r"[\d]+"
  EMAIL_ADDRESS = r"[\w\-\.]+@[\w\-\.]+"
! PATH = r"[\w \$\.\-~:\\/\*]+"
  VARIABLE_PATH = PATH + r"%"
  FILE = r"[\S]+"
  FILE_WITH_PATH = PATH
+ IP_LIST = r"\*|localhost|((\*|[01]?\d\d?|2[04]\d|25[0-5])\.(\*|[01]?\d\d?|2[04]\d|25[0-5])\.(\*|[01]?\d\d?|2[04]\d|25[0-5])\.(\*|[01]?\d\d?|2[04]\d|25[0-5]),?)+"
  # IMAP seems to allow any character at all in a folder name,
  # but we want to use the comma as a delimiter for lists, so

Index: ProxyUI.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/ProxyUI.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** ProxyUI.py	18 Aug 2003 00:53:11 -0000	1.15
--- ProxyUI.py	19 Aug 2003 08:52:04 -0000	1.16
***************
*** 86,89 ****
--- 86,90 ----
      ('pop3proxy',           'no_cache_bulk_ham'),
      ('html_ui',             'display_to'),
+     ('html_ui',             'allow_remote_connections'),
      ('Header Options',      None),
      ('pop3proxy',           'notate_to'),

Index: UserInterface.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/UserInterface.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** UserInterface.py	18 Aug 2003 00:53:11 -0000	1.15
--- UserInterface.py	19 Aug 2003 08:52:04 -0000	1.16
***************
*** 101,106 ****
      def onIncomingConnection(self, clientSocket):
          """Checks the security settings."""
!         return options["html_ui", "allow_remote_connections"] or \
!                clientSocket.getpeername()[0] == clientSocket.getsockname()[0]
  
      def _getHTMLClone(self):
--- 101,116 ----
      def onIncomingConnection(self, clientSocket):
          """Checks the security settings."""
!         remoteIP = clientSocket.getpeername()[0]
!         trustedIPs = options["html_ui", "allow_remote_connections"]
! 
!         if trustedIPs == "*" or remoteIP == clientSocket.getsockname()[0]:
!            return True
! 
!         trustedIPs = trustedIPs.replace('.', '\.').replace('*', '([01]?\d\d?|2[04]\d|25[0-5])')
!         for trusted in trustedIPs.split(','):
!           if re.search("^" + trusted + "$", remoteIP):
!              return True
! 
!         return False
  
      def _getHTMLClone(self):





More information about the Spambayes-checkins mailing list