-
-
Notifications
You must be signed in to change notification settings - Fork 130
feat: Simplify the SFTP configuration #961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- auto add server to known_hosts - define custom identity file - define custom sftp port
|
Hi -- thanks for the interest in contributing. I really like the idea of this feature-- I think SFTP configuration is one of the more significant pain points for new users setting up backrest. Reading through your impl -- I think a lot is quite reasonable, but something I want to avoid is the new repo properties that are special cased to sftp. The philosophy here being that things being that any new properties need to be handled (i.e. in this case merged into flags or env vars) correctly in perpituity, which makes them expensive for me to maintain. But changes either to AddRepo, CheckRepoExists, or the UI are relatively cheap-- so I'm wondering if we can make this a UI / CheckRepoExists only change and rely entirely on existing fields of the repo struct. My initial design ideas are
The UI change then can be to update the flags management UI to make it easy to add a known_host file or a ssh key to the flags section defaulting to that directory. For an initial impl I think it'd be fine to assume this path is wdyt? |
|
Hi @garethgeorge |
|
Just chiming in here. Tried to get sftp setup with backrest. It's a major pain and just ended up giving up. This PR sounds awesome if it simplifies that process. |
|
Hi @garethgeorge, have you had the time to take a look at the changes? |
|
Sorry about the late review, I've been distracted from backrest for a while with the holidays in the states. This change looks great. I'm happy to go ahead and merge. One thing I'm noticing you dropped but felt was a cool feature was the ability to automatically generate a key. If you're interested to chase that down, happy to take a followup on that and merge this now. Elsewise it's something I'll consider building on your change down the line. |
|
Hi, I am new to
or, having configured the user and the server in the
However, from the Are the errors due to the fact that Are the errors I am having related to this thread? Thanks, |
|
@garethgeorge, I’ve been working on some UX improvements, such as adding confirmation prompts.
Regarding automatic SSH-key generation, I plan to implement it using a flow similar to this confirmation modal. On the first connection, it would ask the user to trust the host. On the second connection attempt, it would prompt for a username and password; we would then use those credentials to generate an SSH key, save it to the .ssh folder, and add a flag to use that specific key. I'll follow up with these changes as soon as I have more time to finish them. |
|
@garethgeorge, here is the PoC with both features implemented.
Workflow Demo: Enter Credentials: Add the standard information (using Hetzner storage in this example), open the bootstrap options, and enter the SSH credentials.
Test Configuration: Run "Test Config". (might need to do 2 times to confirm host key too) Confirm Installation: Confirm the installation of the new SSH key.
Completion: The SSH key is installed on the server, saved locally to the .ssh folder, and automatically added to the configuration (using sftp args).
Final Result: This is how the final configuration looks.
|
@BLu85 you should check the logs, usually it's just a missing SSH key or a "host key verification" issue because .ssh is not mounted inside the docker container. You can look it up in the docs: https://garethgeorge.github.io/backrest/cookbooks/ssh-remote |
|
Hi @Kirari04, Thanks for your answer :) I am not using the docker I am running the executable in Linux. Any idea? |
|
@BLu85 What are you passing as flags? |
|
I'm passing When I explicit them. I don't add any flags if I use the host name in the .ssh/config where the key and the port are defined. In both cases it doesn't work. I don't have access to my laptop at the moment and can't report the error, sorry. |
|
This is what I get if I put Note that in a shell the command I get a SSH key error message when I explicit the user, the server IP, and the args as: Repository URI: sftp:[email protected]:/folderA The What am I doing wrong? |





For my personal use I implemented the features to automatically add a repo to known_hosts file and also define an identity file and custom sftp port.
I know that you could just create a ssh config file but when adding multiple repos this becomes an hassle and that's why I preferred to have a simple option inside the ui.
I'm creating this pr in case there is any interest to merge this feature :)
I'm open for any suggestions for improvements.