swarmkit icon indicating copy to clipboard operation
swarmkit copied to clipboard

Encrypting raft logs

Open hichamuntitled opened this issue 8 years ago • 5 comments

I am trying to decrypt docker swarm raft logs, edit them and finally encrypt them.

I found out that I can decrypt raft logs using swarm-rafttool decrypt, now I am wondering how to encrypt them back.

Any ideas?

hichamuntitled avatar Mar 05 '18 15:03 hichamuntitled

@hichamuntitled We do not provide a tool to encrypt them back - swarm-rafttool decrypt is more of a debugging tool so you can see raft history or downgrade. We do not want to encourage editing raft logs manually - however, you can probably write a tool to get the DEK from the TLS key based on the code in https://github.com/docker/swarmkit/blob/master/cmd/swarm-rafttool/dump.go#L32-L39, create an EncryptedRaftLogger, and write the modified entries and snapshots to a new location.

cyli avatar Mar 05 '18 20:03 cyli

@cyli The idea behind this is that I want to be able to restore all swarm managers in new VMs, so different IPs than the ones stored in raft logs.

hichamuntitled avatar Mar 06 '18 08:03 hichamuntitled

@hichamuntitled Would something like https://github.com/docker/swarmkit/pull/2199 fix your issue instead?

cyli avatar Mar 06 '18 17:03 cyli

@hichamuntitled Also, I'm dumb. Before raft encryption was added, the raft logs were stored in wal-v3 and snap-v3 directories. After encryption was added, they were stored in wal-v3-encrypted and snap-v3-encrypted. Possibly, if you wanted them re-encrypted, you could just move the decrypted directories to wal-v3 and snap-v3, and restart swarm - I believe it should be able to read the older format for logs and migrate them to the new, encrypted format.

cyli avatar Jun 21 '18 23:06 cyli

Thanks for opening this issue. We haven’t seen any recent activity, so I’m closing it for now.

If it’s still relevant, feel free to reopen it or open a new issue with additional details. Thanks!

smerkviladze avatar May 04 '26 12:05 smerkviladze