Change displayed SSH_USER to logged in user #13906

Closed
opened 2025-11-02 10:56:50 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @prologic on GitHub (Jan 2, 2025).

Feature Description

I think it would be great if Gitea would allow me to customize the display of the SSH_USER in any ssh clone urls displayed.

Why? I've setup an SSH reverse proxy that checks against my Gitea instance to see if there is a valid user with a matching key, before reverse proxying them through to my Gitea instance with the built in git@ user and their public key credentials passed through an agent forwarder.

This way I can add an additional layer of protection in front of my Gitea instance.

Screenshots

N/A

Originally created by @prologic on GitHub (Jan 2, 2025). ### Feature Description I think it would be great if Gitea would allow me to customize the display of the `SSH_USER` in any ssh clone urls displayed. Why? I've setup an SSH reverse proxy that checks against my Gitea instance to see if there is a valid user with a matching key, before reverse proxying them through to my Gitea instance with the built in `git@` user and their public key credentials passed through an agent forwarder. This way I can add an additional layer of protection in front of my Gitea instance. ### Screenshots N/A
GiteaMirror added the type/proposal label 2025-11-02 10:56:50 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Jan 2, 2025):

But in SSH world, the "username" isn't that important, you could always identify a user by their public key, even in your "SSH reverse proxy"

@wxiaoguang commented on GitHub (Jan 2, 2025): But in SSH world, the "username" isn't that important, you could always identify a user by their public key, even in your "SSH reverse proxy"
Author
Owner

@prologic commented on GitHub (Jan 3, 2025):

But in SSH world, the "username" isn't that important, you could always identify a user by their public key, even in your "SSH reverse proxy"

Do you mind collaborating on this a little bit? I actually do this the other way around where I lookup the presented user to see if it exists in the first place,then match the presented public key.

@prologic commented on GitHub (Jan 3, 2025): > But in SSH world, the "username" isn't that important, you could always identify a user by their public key, even in your "SSH reverse proxy" Do you mind collaborating on this a little bit? I actually do this the other way around where I lookup the presented user to see if it exists in the first place,then match the presented public key.
Author
Owner

@wxiaoguang commented on GitHub (Jan 3, 2025):

Do you mind collaborating on this a little bit? I actually do this the other way around where I lookup the presented user to see if it exists in the first place,then match the presented public key.

Hmm, I guess I know what you are doing ......

I could help to propose a demo to show the current user name on the UI for the SSH clone URL, but I am not sure whether it is suitable to merge into Gitea, since it doesn't seem to be a need of a majority.

@wxiaoguang commented on GitHub (Jan 3, 2025): > > > > Do you mind collaborating on this a little bit? I actually do this the other way around where I lookup the presented user to see if it exists in the first place,then match the presented public key. Hmm, I guess I know what you are doing ...... I could help to propose a demo to show the current user name on the UI for the SSH clone URL, but I am not sure whether it is suitable to merge into Gitea, since it doesn't seem to be a need of a majority.
Author
Owner

@wxiaoguang commented on GitHub (Jan 3, 2025):

OK, I think I get some ideas about how to make it neat and merge it into Gitea.

@wxiaoguang commented on GitHub (Jan 3, 2025): OK, I think I get some ideas about how to make it neat and merge it into Gitea.
Author
Owner

@wxiaoguang commented on GitHub (Jan 3, 2025):

-> Make git clone URL could use current signed-in user #33091

TBH, much more complicated than I thought .... 🤣

@wxiaoguang commented on GitHub (Jan 3, 2025): -> Make git clone URL could use current signed-in user #33091 TBH, much more complicated than I thought .... 🤣
Author
Owner

@prologic commented on GitHub (Jan 14, 2025):

Hey just checking, did this get into the GItea 1.23.1 release? 🤔

@prologic commented on GitHub (Jan 14, 2025): Hey just checking, did this get into the GItea 1.23.1 release? 🤔
Author
Owner

@prologic commented on GitHub (Jan 14, 2025):

Looks like it didn't. Just tested this:

[server]
...
SSH_USER = %(DOER_USERNAME)s
@prologic commented on GitHub (Jan 14, 2025): Looks like it didn't. Just tested this: ``` [server] ... SSH_USER = %(DOER_USERNAME)s ```
Author
Owner

@wxiaoguang commented on GitHub (Jan 14, 2025):

Hey just checking, did this get into the GItea 1.23.1 release? 🤔

No, it is a new feature and only in 1.24

Looks like it didn't. Just tested this:

[server]
...
SSH_USER = %(DOER_USERNAME)s

But it does work, see the document:

image

SSH_USER = %(DOER_USERNAME)s is wrong. Use SSH_USER = (DOER_USERNAME)

@wxiaoguang commented on GitHub (Jan 14, 2025): > Hey just checking, did this get into the GItea 1.23.1 release? 🤔 No, it is a new feature and only in 1.24 > Looks like it didn't. Just tested this: > > ``` > [server] > ... > SSH_USER = %(DOER_USERNAME)s > ``` But it does work, see the document: ![image](https://github.com/user-attachments/assets/39907dae-2d90-447e-a2c2-e3b0593850c7) `SSH_USER = %(DOER_USERNAME)s` is wrong. Use `SSH_USER = (DOER_USERNAME)`
Author
Owner

@prologic commented on GitHub (Jan 14, 2025):

Ahh! Thanks!

@prologic commented on GitHub (Jan 14, 2025): Ahh! Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13906