Skip to content
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

Refactor SSH init code, fix directory creation for TrustedUserCAKeys file (#20299) #20306

Merged
merged 2 commits into from
Jul 11, 2022

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Jul 10, 2022

Backport #20299

Follow #20298 (for 1.17)

In #20298, the ~/.ssh is not created automatically, but that PR is not ideal: indeed, only the GlobalInitInstalled function should prepare the SSH files for external server or starts the builtin server.

This PR should make the logic clear and reduce some dependencies between modules.

Major changes:

  1. trustedUserCaKeys is removed, use SSH.TrustedUserCAKeys directly, it has been parsed by ini module correctly
  2. introduce ssh.Init, move the SSH init code from routers/init.go to it
  3. ssh.Init will start builtin SSH server or prepare external SSH server files

This PR could also to be considered as a bug fix for #20298, otherwise the os.WriteFile(fname/*ca file*/, might fail.

…file (go-gitea#20299)

* Refactor SSH init code, fix directory creation for TrustedUserCAKeys file

* Update modules/ssh/init.go

Co-authored-by: zeripath <art27@cantab.net>

* fix lint copyright

* Update modules/ssh/init.go

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@wxiaoguang wxiaoguang added type/bug type/refactoring Existing code has been cleaned up. There should be no new functionality. labels Jul 10, 2022
@wxiaoguang wxiaoguang added this to the 1.17.0 milestone Jul 10, 2022
@GiteaBot GiteaBot added the lgtm/need 1 This PR needs approval from one additional maintainer to be merged. label Jul 10, 2022
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 11, 2022
@wxiaoguang wxiaoguang merged commit 54ef658 into go-gitea:release/v1.17 Jul 11, 2022
@wxiaoguang wxiaoguang deleted the backport-ssh-init branch July 11, 2022 15:27
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug type/refactoring Existing code has been cleaned up. There should be no new functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants