Refactor SSH connection to make adding passwords easier. #602
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Previously, an SSH private key was written to disk on a file (the public key is added to
~/.ssh/authorized_keys
on the central server). We want to give the option to encrypt the rclone config file, for AWS and Google Drive. We could similarly add a password to the SSH key on disk, and then add it to RClone, which holds it in the config and obfuscates it. However, as the approach for AWS and GDrive will be to place a password on the rclone config file, the approach taken here is to store the private key inside the config file, and then add a password to the config file if the user desires. Therefore, there is no longer a private key stored in a separate file.This PR also performs some general refactoring of the SSH module as it was a bit messy.
This PR also removes the public function
write_public_key
(which would write the public version of the private key to disk). I'm pretty sure no one would ever use this, I'm not even sure why it would even be necessary unless you wanted to reuse the SSH key that datashuttle is using. But, we can keep it juts for internal use.Tests are adjusted for the refactoring, its a backend change so no other tests or documentation is needed.
TODO: