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

restrict and no-user-rc in authorized_keys cause error in dropbear(openwrt). #21383

Open
mokeyish opened this issue Oct 9, 2022 · 7 comments
Labels

Comments

@mokeyish
Copy link
Contributor

mokeyish commented Oct 9, 2022

Description

I can't use git clone git@xxxx in openwrt after PR #17772. It would be ok after I delete no-user-rc,restrict manully.

The error output


✘ root@Me  ~/abc  git clone git@xxxx:yyy/abc.git
Cloning into 'abc'...
git@xxxx: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights


The system log

Sun Oct  9 11:12:51 2022 authpriv.info dropbear[16361]: Child connection from 10.10.0.10:51874
Sun Oct  9 11:12:51 2022 authpriv.warn dropbear[16361]: Port forwarding disabled.
Sun Oct  9 11:12:51 2022 authpriv.warn dropbear[16361]: Agent forwarding disabled.
Sun Oct  9 11:12:51 2022 authpriv.warn dropbear[16361]: Pty allocation disabled.
Sun Oct  9 11:12:51 2022 authpriv.warn dropbear[16361]: Bad public key options at /home/git/.ssh/authorized_keys:2
Sun Oct  9 11:12:51 2022 authpriv.info dropbear[16361]: Exit before auth from <10.10.0.10:51874>: (user 'git', 0 fails): Exited normally
Sun Oct  9 11:12:52 2022 authpriv.info dropbear[16362]: Child connection from 10.10.0.10:51877

Gitea Version

After PR #17772

Screenshots

Dropbear version:

图片

Git Version

2.34.3

Operating System

OpenWrt(22). x86-64

@mokeyish
Copy link
Contributor Author

mokeyish commented Oct 9, 2022

@zacheryph @techknowlogick @mscherer
Hi, Is there a way to change the sshpublickey template? dropbear not support restrict and no-user-rc

@zeripath
Copy link
Contributor

zeripath commented Oct 9, 2022

We did not expect that anyone would want/need to change these options.

The likely problem is related to the version of the SSH in openWRT.

Now... we could make this configurable

@mokeyish
Copy link
Contributor Author

mokeyish commented Oct 9, 2022

Since it's hard to find the probelm when throw error like Permission denied (publickey)., so

Maybe we can detect automaticlly. if port 22 is listened by dropbear, then ignore restrict and no-user-rc

@shionphan
Copy link

@mokeyish Thanks a lot, i have the same issue. git clone work after I delete no-user-rc,restrict manully.

Gitea 1.17.3 on Synology NAS (no docker)

@fomojola
Copy link

@mokeyish Echoing this issue: running on an old Ubuntu version, upgraded from 1.15.4 to 1.17.4 and this error occurred. Manually went in and removed the ,restrict text and restored full working functionality.

Looking at the release logs, this functionality appears to have been added in 1.16.0. Looking at the OpenSSH release notes from https://www.openssh.com/releasenotes.html, it appears that support for the restrict authorized_keys flag was added in OpenSSH 7.1p2. The specific template that controls those lines appears to be at https://github.com/go-gitea/gitea/blob/main/models/asymkey/ssh_key_authorized_keys.go#L42

I've never made any changes to the gitea source, so wasn't sure if there is existing support for passing in one of those templates as a configuration or environmental variable, but support for overriding that template would be extremely helpful for systems running earlier OpenSSH versions, or a prominent note in the release logs that upgrades to OpenSSH will be required for future releases.

Thanks!

@Tlepel
Copy link

Tlepel commented Jan 4, 2023

Thanks for making this issue, I've been looking through gitea logs, git logs, ssh logs and openbear logs before I found out what the issue was.
I don't really want to switch over to openssh to fix this issue on my side, so hopefully it'll be changed or adapted in gitea soon :)

@mokeyish
Copy link
Contributor Author

mokeyish commented Oct 13, 2023

It's a bit troublesome,I have to manually delete those two items every time gitea upgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants