[MXS-793] Secured Binlog Server Created: 2016-07-07  Updated: 2016-12-13  Resolved: 2016-12-13

Status: Closed
Project: MariaDB MaxScale
Component/s: binlogrouter
Affects Version/s: None
Fix Version/s: 2.1.0

Type: New Feature Priority: Major
Reporter: Johan Wikman Assignee: Massimiliano Pinto (Inactive)
Resolution: Fixed Votes: 0
Labels: 2.1-Requirement

Sub-Tasks:
Key
Summary
Type
Status
Assignee
MXS-867 File based Key Management for binlog ... Sub-Task Closed Massimiliano Pinto  
MXS-868 Add encrcyption/decryption to read/wr... Sub-Task Closed Massimiliano Pinto  
MXS-869 Create START_ENCRYPTION_EVENT in binl... Sub-Task Closed Massimiliano Pinto  
MXS-1029 Add 16MB support to binlog encryption Sub-Task Closed Massimiliano Pinto  
Sprint: 2016-14, 2016-15, 2016-16, 2016-17, 2016-18, 2016-19, 2016-22, 2016-23

 Comments   
Comment by Massimiliano Pinto (Inactive) [ 2016-07-27 ]

After adding semi-sync to develop we can start checking which part of the code would be affected.

Notification to slaves, instead of live distribution, will also simplify the task.

WAIT_DATA slave state instead of FOLLOW will be added.

Comment by Massimiliano Pinto (Inactive) [ 2016-08-09 ]

Added WAIT_DATA in "binlog_server_wait_data"

After proper tests, binlog encryption estimate work could start

Comment by Massimiliano Pinto (Inactive) [ 2016-08-11 ]

Started adding START_ENCRYPTION_EVENT detection in blr_read_events_all_events()

2016-08-11 18:02:35 debug : - START_ENCRYPTION event @ 249, size 36, next pos is @ 285, flags 0
2016-08-11 18:02:35 debug : Encryption scheme: 1, key_version: 1, nonce: 89968FBC5C3D16B00D7D81EE

Comment by Massimiliano Pinto (Inactive) [ 2016-08-12 ]

START_ENCRYPTION_EVENT event must not be sent to slave.

Next event, after Format Description Event, will the decrypted event.

Being the START_ENCRYPTION_EVENT a 36 byte packet and say the FDE event next pos in the header 249 the first event to be sent will be the one at pos:

249 (next pos in FDE header) + 36 = 285

So FDE next pos is 249 but the event sent is the one at 285

The slave routine that reads data from binlog file should first skip this event.

Comment by Massimiliano Pinto (Inactive) [ 2016-08-30 ]

the IV for event encryption/decryption is 12 bytes from 'nonce' read START_ENCRYPTION_EVENT + current_event_pos (4) bytes = 16 bytes

Comment by Massimiliano Pinto (Inactive) [ 2016-08-30 ]

encrypted events are encrypted with key and IV (12 nonce + event_pos) and they have same size as "plain" events.

That's possible via XOR and later data truncation

The saved encrypted event is event_size-4 long and that size is written, clear data, at event_pos +9

In order to enc/dec first 4 bytes of event have to be moved into event_pos +9 and then encrypt/decrypt sarting from buff+4

Comment by Massimiliano Pinto (Inactive) [ 2016-09-14 ]

Added "start_encryption_event" into blr_write_binlog_record(), just after writing of FDE event

Comment by Massimiliano Pinto (Inactive) [ 2016-09-14 ]

blr_slave_catchup() now skips MARIADB10_START_ENCRYPTION_EVENT, IGNORABLE_EVENT or any event with flag LOG_EVENT_IGNORABLE_F

Slave pos pointer is set to next event pos

Comment by Massimiliano Pinto (Inactive) [ 2016-09-23 ]

blr_read_events_all_events() now detects START_ENCRYPTION and follows event position (events are encrypted but position is in clear)

blr.c:createInstance() detects whether START_ENCRYPTION is in current binlog file but binlog encryption is Off. In this case replication is stopped.

Generated at Thu Feb 08 04:01:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.