Skip to content

Implement encrypted devices (continued) - #6727

Closed
imsodin wants to merge 104 commits into
mainfrom
encryption
Closed

imsodin wants to merge 104 commits into
mainfrom
encryption

Conversation

@imsodin

@imsodin imsodin commented Jun 9, 2020

Copy link
Copy Markdown
Member

This PR is the continuation/equivalent of #6214 on a branch in the syncthing/syncthing repo. Everything on there still applies.

For a list of ongoing/outstanding tasks and more notes, please refer to this wiki page (and extend/update as appropriate): https://github.com/syncthing/syncthing/wiki/Untrusted-devices-(encryption)-status

Companion docs PR: syncthing/docs#480

@AudriusButkevicius

Copy link
Copy Markdown
Member

Sorry, I got a busy week ahead of me, so not sure how quickly I'll turn around resolving them.

@motiejus

motiejus commented Sep 9, 2020

Copy link
Copy Markdown

Can you (original reviewer/commenter) please mark review comments as resolved if you feel they are. The PR is already huge and it's hard to keep track of what still needs addressing/discussion and anything to make that easier would be appreciated. Thanks!

I believe this applies to me too, but github doesn't allow me to mark my comments as such. I am happy to comment "LGTM" on things I believe are resolved.

@imsodin

imsodin commented Sep 9, 2020

Copy link
Copy Markdown
Member Author

That's weird. Anyway, to not generate more comments/notifications just to mark them as done, you could also put a reaction/emoji on those comments which are done :)

@motiejus

motiejus commented Sep 9, 2020

Copy link
Copy Markdown

That's weird.

I guess that's only to members/maintainers of syncthing, but I agree everyone who left a review should be able to mark their comments as done. Can this be configurable in project settings?

Anyway, to not generate more comments/notifications just to mark them as done, you could also put a reaction/emoji on those comments which are done :)

I'll use 🚀 for "done".

Comment thread gui/default/assets/lang/lang-en.json Outdated
"Introduced By": "Introduced By",
"Introducer": "Introducer",
"Inversion of the given condition (i.e. do not exclude)": "Inversion of the given condition (i.e. do not exclude)",
"Items have been added to this folder which are not encrypted.": "Items have been added to this folder which are not encrypted.",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected items found in folder as we don't know for sure if they are encrypted or not.

I guess some numpty might copy files encrypted with different passwords and expect that to work.

"Start Browser": "Start Browser",
"Statistics": "Statistics",
"Stopped": "Stopped",
"Stores and syncs only encrypted data. Folders on all connected devices need to be set up with the same password or be of type \"{%receiveEncrypted%}\" too.": "Stores and syncs only encrypted data. Folders on all connected devices need to be set up with the same password or be of type \"{{receiveEncrypted}}\" too.",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stores part is a false statement. My local data is not encrypted.

I guess the right term is encrypts outgoing, decrypts incoming data

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This describes the receive-only folder type. It does receive encrypted data, not decrypt, and stores encrypted data.

Comment thread gui/default/assets/lang/lang-en.json Outdated
"Unavailable": "Unavailable",
"Unavailable/Disabled by administrator or maintainer": "Unavailable/Disabled by administrator or maintainer",
"Undecided (will prompt)": "Undecided (will prompt)",
"Unencrypted Items": "Unencrypted Items",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, we don't know if they are encrypted or not, might just be the wrong password.

Comment thread gui/default/assets/lang/lang-en.json Outdated
"You should never add or change anything locally in a \"{%receiveEncrypted%}\" folder.": "You should never add or change anything locally in a \"{{receiveEncrypted}}\" folder.",
"days": "days",
"directories": "directories",
"enter password to encrypt data to be sent": "enter password to encrypt data to be sent",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strange that this starts with a lowercase.
Also, this password is used for decryption as well, so "encrypt data to be sent" is just part of the story?

"Enter encryption password" ?

Comment thread gui/default/assets/lang/lang-en.json Outdated
"full documentation": "full documentation",
"items": "items",
"not shared": "not shared",
"received data is already encrypted": "received data is already encrypted",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, lowercase for both of these?

Comment thread lib/model/model.go Outdated
}
} else {
if len(ccDeviceRemote.EncryptionPasswordToken) > 0 || len(ccDeviceLocal.EncryptionPasswordToken) > 0 {
l.Infof("Failed to auto-accept folder %s from %s as the remote wants to send us encrypted data, but we are not encrypted", folder.Description(), deviceID)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "we are not encrypted" mean?

Comment thread lib/model/model.go
l.Infof("Auto-accepted %s folder %s at path %s", deviceCfg.DeviceID, folder.Description(), fcfg.Path)
if len(ccDevice.EncPwToken) > 0 || len(ccDeviceUs.EncPwToken) > 0 {
fcfg.Type = config.FolderTypeReceiveEncrypted
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't I have:

<untrusted> <-> <untrusted> but both know/use the password, effectively adding an extra encryption layer on top of the transport?

In that case you'd have tokens from both sides, and that would be fine, as long as they match.

Comment thread lib/model/model.go Resolved
Comment thread lib/model/model.go Outdated
isEncRemote := folderDevice.EncryptionPassword != ""
isEncLocal := fcfg.Type == config.FolderTypeReceiveEncrypted

if !isEncRemote && !isEncLocal && deviceUntrusted {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I need to think more about this, but something smells to me here.

Comment thread lib/model/model.go Outdated
}

func encTokenPath(cfg config.FolderConfiguration) string {
return filepath.Join(cfg.MarkerName, "syncthing-enc_pw_token")

@AudriusButkevicius AudriusButkevicius Sep 10, 2020 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this sort of reduces the usefulness of per-device-per-folder passwords, as for two plaintext devices to sync to a third encrypted device, they would have to use the same password.

Sure for a 4th encrypted device they could use a different one, which I guess is why we have this, but I wonder if it's worth it.

@AudriusButkevicius AudriusButkevicius left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More naming moaning. The most important stuff. Resolved stuff that was not relevant, and things that are still relevant and became outdated and hidden, recommented on them. There are still a few old outdated comment threads that are still relevant and not resolved.

Comment thread lib/protocol/encryption.go Outdated
}

func (e encryptedModel) ClusterConfig(deviceID DeviceID, config ClusterConfig) error {
// TODO: Filter/clean the incoming ClusterConfig?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The todo should go if we're not todoing anything?

Comment thread lib/model/model.go
} else {
m.folderEncryptionFailures[folder.ID] = make(map[protocol.DeviceID]error)
}
m.folderEncryptionFailures[folder.ID][deviceID] = err

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this live in the folder rather than the model somehow?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are connection/cluster config level errors. And folders do not handle that let allow know anything about it. Changing that would be entirely out of scope of this PR.

@calmh

calmh commented Nov 9, 2020

Copy link
Copy Markdown
Member

#7055

@calmh calmh closed this Nov 9, 2020
@calmh
calmh deleted the encryption branch November 11, 2020 18:39
@st-review st-review added the frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion label Nov 10, 2021
@syncthing syncthing locked and limited conversation to collaborators Nov 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frozen-due-to-age Issues closed and untouched for a long time, together with being locked for discussion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants