You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Autodetermine if work-path needs to be specified in SSH authorized_keys
If a user's `app.ini` contains a `APP_DATA_PATH` which refers to a
non-absolute path then `gitea serv` etc. become dependent on the
`AppWorkPath`.
`gitea serv` may then require `--work-path` to be set in the
`authorized_keys` if the `AppWorkPath` determined by `gitea web` and
`gitea serv` are different.
This would occur if `GITEA_WORK_DIR` is set, `--work-path` is used to
run `gitea web` or if the AppPath cannot be determined at start-up.
This PR adds some code to attempt to automatically determine if this is
necessary and adds some documentation to suggest adding `--work-path` to
the template.
This should prevent SSH failures from happening as described in go-gitea#19317
Replace go-gitea#22754
Signed-off-by: Andrew Thornton <[email protected]>
Copy file name to clipboardExpand all lines: docs/content/doc/advanced/config-cheat-sheet.en-us.md
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -338,6 +338,9 @@ The following configuration set `Content-Type: application/vnd.android.package-a
338
338
-`SSH_CREATE_AUTHORIZED_PRINCIPALS_FILE`: **false/true**: Gitea will create a authorized_principals file by default when it is not using the internal ssh server and `SSH_AUTHORIZED_PRINCIPALS_ALLOW` is not `off`.
339
339
-`SSH_AUTHORIZED_PRINCIPALS_BACKUP`: **false/true**: Enable SSH Authorized Principals Backup when rewriting all keys, default is true if `SSH_AUTHORIZED_PRINCIPALS_ALLOW` is not `off`.
340
340
-`SSH_AUTHORIZED_KEYS_COMMAND_TEMPLATE`: **{{.AppPath}} --config={{.CustomConf}} serv key-{{.Key.ID}}**: Set the template for the command to passed on authorized keys. Possible keys are: AppPath, AppWorkPath, CustomConf, CustomPath, Key - where Key is a `models/asymkey.PublicKey` and the others are strings which are shellquoted.
341
+
- Gitea will add `--work-path={{.AppWorkPath}}` to the default template
342
+
if it determines that this is needed, however, you may need to add this explicitly
343
+
to any non-default template if your `APP_DATA_PATH` is not an absolute path.
341
344
-`SSH_SERVER_CIPHERS`: **[email protected], aes128-ctr, aes192-ctr, aes256-ctr, [email protected], [email protected]**: For the built-in SSH server, choose the ciphers to support for SSH connections, for system SSH this setting has no effect.
342
345
-`SSH_SERVER_KEY_EXCHANGES`: **curve25519-sha256, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group14-sha256, diffie-hellman-group14-sha1**: For the built-in SSH server, choose the key exchange algorithms to support for SSH connections, for system SSH this setting has no effect.
343
346
-`SSH_SERVER_MACS`: **[email protected], hmac-sha2-256, hmac-sha1**: For the built-in SSH server, choose the MACs to support for SSH connections, for system SSH this setting has no effect
Copy file name to clipboardExpand all lines: modules/setting/server.go
+9-2Lines changed: 9 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,8 @@ var (
53
53
AppSubURLstring
54
54
// AppDataPath is the default path for storing data.
55
55
// It maps to ini:"APP_DATA_PATH" in [server] and defaults to AppWorkPath + "/data"
56
-
AppDataPathstring
56
+
AppDataPathstring
57
+
AppDataPathDependentOnWorkPathbool// This is a helper marker used to inform if the AppDataPath is dependent on a user-provided or auto-determined work path
57
58
// LocalURL is the url for locally running applications to contact Gitea. It always has a '/' suffix
0 commit comments