duesee / imap-proxy

5 stars 0 forks source link

chore: Improve TLS logging #1

Closed duesee closed 4 months ago

duesee commented 5 months ago

It appears to me that we trace! all read TLS bytes but don't emit write events. I only see ...

io/read/raw data="\\x17\\x03\\x03\\x01\\n\\x9f ..."
duesee commented 4 months ago

@jakoschiko This could be related to your current work.

jakoschiko commented 4 months ago

Relates to duesee/imap-proxy#2

duesee commented 4 months ago

Scenario: Insecure to TLS

<- Greeting
io/read/raw data="6\\x1fM\\xe8\\x04\\x8e\\  ...   xdb\\x9c\\x13G\\xef?"
io/write/raw data="* OK [CAPABILITY ...] ...\\r\\n"

Noop ->
io/read/raw data="a noop\\r\\n"
io/write/raw data="\\x17\\x03\\x0   ...   x06\\xa7"

<- Status
io/read/raw data="\\x17\\x03\\x03\\x   ...   xa0\\xffU\\xf1\\x9cm"
io/write/raw data="a OK NOOP completed\\r\\n"

We get an encrypted greeting, we forward a plain greeting. We get a plain noop, we forward an encrypted noop. We get an encrypted ok, we forward a plain ok. Looks perfect to me.

Scenario: TLS to TLS

io/read/raw data="c\\xd2e\\x84\\x9   ...   9|\\x00\\x11"    
io/write/raw data="\\x17\\x03\\x03\   ...   5\\x85N\\x12"                                    
io/read/raw data="\\x17\\x03\\x03\\x00\\x19\\xfe>\\xfd\\x8fhg\\x9e&\\xeb\\xa1;\\x16\\xfd'\\x17\\x88\\x06\\xb0\\xf0\\x18i\\x8cZ!\\r"    
io/write/raw data="\\x17\\x03\\x03\\x00\\x19\\x9cJf\\xed\\x8b\\x14\\x88\\xe3k\\xb7\\xddu\\xb4$J\\x8c\\x15\\x95\\xa6\\xcc\\xc5\\x9a\\x87\\x89\\x96"    
io/read/raw data="\\x17\\x03\\x03\\x00&\\x91AB\\x19(V\\xa7\\xb6(\\xf7\\xaf\\x0b\\xdb\\x8bW.\\xa8\\xf0;Z\\xe0\\x1b\\x14\\x99\\x0b\\x14\\xc11\\xdfb\\xc7\\xf5}"    
io/read/raw data="\\xa6\\xca\\x03\\x13\\xe9"                                                                                                                                                  io/write/raw data="\\x17\\x03\\x03\\x00&\\x13%\\x123\\xa6-yh!\\xfb\\xb0\\xc7+J\\x81\\xf57\\x07+uB\\xe0\\x86x\\xdb\\xc9\\x9a\\x97\\t\\xd5\\x02R\\xc21\\xfe\\xefYS"                                 

-> This will re solved by fragment logging (#2)