Skip to content

Commit

Permalink
Update readme with experimental new plugins feature (see branch)
Browse files Browse the repository at this point in the history
Also remove unnecessarily duplicated logging
  • Loading branch information
simonrob committed Jun 2, 2022
1 parent 3379ece commit b26c7b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ A similar issue may occur on Windows with the [pythonnet](https://github.com/pyt
Please feel free to [open an issue](https://github.com/simonrob/email-oauth2-proxy/issues) reporting any bugs you find, or [submit a pull request](https://github.com/simonrob/email-oauth2-proxy/pulls) to help improve this tool.


## Advanced / experimental features
The [plugins branch](https://github.com/simonrob/email-oauth2-proxy/tree/plugins) has a semi-experimental new feature that enables the use of separate scripts to modify IMAP/SMTP commands when they are received from the client or server before passing through to the other side of the connection. This allows a wide range of additional capabilities or triggers to be added the proxy. For example, the [IMAPIgnoreSentMessageUpload plugin](https://github.com/simonrob/email-oauth2-proxy/blob/plugins/plugins/IMAPIgnoreSentMessageUpload.py) intercepts any client commands to add emails to the IMAP sent messages mailbox, which resolves message duplication issues for servers that automatically do this when emails are received via SMTP (e.g., Office 365, Gmail, etc). See the documentation and examples in this branch for further details and setup instructions.


## Potential improvements (pull requests welcome)
- Switch to asyncio (asyncore is currently deprecated, but [PEP 594](https://peps.python.org/pep-0594/) will remove it completely in Python 3.12)
- Full feature parity on different platforms (e.g., live menu updating; monitoring network status)
Expand Down
5 changes: 1 addition & 4 deletions emailproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,8 +621,7 @@ def process_data(self, byte_data, censor_server_log=False):
self.server_connection.send(byte_data, censor_log=censor_server_log) # just send everything straight to server

def send(self, byte_data):
if not self.authenticated: # after authentication these are identical to server-side logs (in process_data)
Log.debug(self.proxy_type, self.connection_info, '<--', byte_data)
Log.debug(self.proxy_type, self.connection_info, '<--', byte_data)
try:
super().send(byte_data)
except (ssl.SSLWantReadError, ssl.SSLWantWriteError) as e: # only relevant when using local certificates
Expand Down Expand Up @@ -877,8 +876,6 @@ def handle_read(self):

def process_data(self, byte_data):
self.client_connection.send(byte_data) # by default we just send everything straight to the client
if self.client_connection.authenticated:
Log.debug(self.proxy_type, self.connection_info, '<--', byte_data) # command after any editing/interception

def send(self, byte_data, censor_log=False):
if not self.client_connection.authenticated: # after authentication these are identical to server-side logs
Expand Down

0 comments on commit b26c7b4

Please sign in to comment.