summaryrefslogtreecommitdiff
path: root/internal/command/uploadpack
Commit message (Collapse)AuthorAgeFilesLines
* Reuse Gitaly conns and SidechannelIgor Drozdov2022-03-072-16/+13
| | | | | | | | When gitlab-sshd has been introduced we've started running our own SSH server. In this case we're able to cache and reuse Gitaly connections and Registry. It helps to reduce memory usage.
* Optionally use SSHUploadPackWithSidechannelJacob Vosmaer2022-01-252-1/+74
| | | | | | | If the GitLab API returns an allowed response with use_sidechannel set to true, gitlab-shell will establish a sidechannel connection and use SSHUploadPackWithSidechannel instead of SSHUploadPack. This is an efficiency improvement.
* Remove some unreliable testsNick Thomas2021-07-301-15/+21
| | | | | | | | | | | | | Logrus buffers its output internally, which makes these tests fail intermittently. They're also not a good example to follow generally. We now have acceptance tests that exercise this functionality so I'm pretty relaxed about losing the expectations. However, we can test them by inspecting the server-received metadata too, so there's no loss of coverage here. The move from logrus to labkit for logging also makes these tests hard to justify keeping.
* fix: upgrade of the gitaly dependencyPavlo Strokov2021-06-021-2/+2
| | | | | | | | | | | Gitaly project now properly respects module release flow and includes a module suffix in the package name. It requires to re-write all non-suffixed imports with suffixed of a specific version of tha module. With proper module versioning we don't need to use a 'replace' directive to point to specific commit and can use semantic versioning for the gitaly dependency. Part of: https://gitlab.com/gitlab-org/gitaly/-/issues/3177
* Fix opentracing setup for gitlab-sshdNick Thomas2021-05-171-0/+1
| | | | | | | | | | | | | | | | | | | | Previously, opentracing (if configured) was initialized late in the gitlab-shell process's lifespan, coming just before making a gRPC call to Gitaly. By moving the opentracing initialization to be at process startup, we make it available for the whole process lifecycle, which is very useful to gitlab-sshd, as it means we'll only call tracing.Initialize() once on process startup, rather than once per SSH connection. To get this working, we need to introduce a context to gitlab-sshd. This carries the client/service name, but also carries an initial correlation ID. The main outcome of this is that all calls to the authorized_keys endpoint from a given gitlab-sshd process will now share a correlation ID. I don't have a strong opinion about this either way. Changelog: fixed
* Respect parent context for Gitaly callsNick Thomas2021-05-053-4/+7
| | | | | | | | | Without these changes, Gitaly calls would not be linked to a parent context. This means that they would have an unassociated correlationID, and Gitaly RPC calls would not be cancel()ed by parent context cancellation. Changelog: fixed
* Replace cleanup functions with t.CleanupIgor Drozdov2021-03-172-7/+4
| | | | | In this case we don't need to propagate cleanup function. It simplifies the code.
* chore: Refactor env introspection to rely on command initialization496-move-env-introspection-to-sshenvLucas Charles2021-03-152-12/+4
| | | | | | | Refactors introspection of execution environment to rely on per-connection state (`gitlab-shell`) or per request (`gitlab-sshd`) Relates to https://gitlab.com/gitlab-org/gitlab-shell/-/issues/496
* Use eventually to assert log entriesJaime Martinez2021-02-221-6/+11
|
* RFC: Simple built-in SSH serverLorenz Brun2021-01-182-4/+11
|
* tests: Replace assert with requirezj-remove-testify-assertZeger-Jan van de Weg2020-10-151-5/+4
| | | | | | | | | Testify features sub packages `assert` and `require`. The difference is subtle, and lost on novice Golang developers that don't read the docs. To create a more consistent code base `assert` will no longer be used. This change was generated by a running a sed command on all `_test.go` files, followed by `goimports -w`.
* Make it possible to propagate correlation ID across processesStan Hu2020-09-203-7/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, gitlab-shell did not pass a context through the application. Correlation IDs were generated down the call stack instead of passed around from the start execution. This has several potential downsides: 1. It's easier for programming mistakes to be made in future that lead to multiple correlation IDs being generated for a single request. 2. Correlation IDs cannot be passed in from upstream requests 3. Other advantages of context passing, such as distributed tracing is not possible. This commit changes the behavior: 1. Extract the correlation ID from the environment at the start of the application. 2. If no correlation ID exists, generate a random one. 3. Pass the correlation ID to the GitLabNet API requests. This change also enables other clients of GitLabNet (e.g. Gitaly) to pass along the correlation ID in the internal API requests (https://gitlab.com/gitlab-org/gitaly/-/issues/2725). Fixes https://gitlab.com/gitlab-org/gitlab-shell/-/issues/474
* Generate and log correlation IDsStan Hu2020-07-311-3/+1
| | | | | This will make it easier to tie an SSH access request to Rails API and Gitaly requests.
* Log SSH key detailsStan Hu2020-07-231-0/+2
| | | | | | | | | | | | | | | | | | | | | Right now when a client such as gitlab-shell calls the `/api/v4/internal/allowed` API, the response only tells the client what user has been granted access, and it's impossible to tell which deploy key/token was used in the authentication request. This commit adds logs for the following when available: 1. `gl_key_type` (e.g. `deploy_key` or `key`) 2. `gl_key_id` These fields make it possible for admins to identify the exact record that was used to authenticate the user. API changes in the `/internal/allowed` endpoint in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/37289 are needed to support this. Relates to https://gitlab.com/gitlab-org/gitlab-shell/-/issues/203
* Fix race conditions in testssh-add-http-status-codeStan Hu2020-05-081-6/+4
| | | | | | | | Calling logrus hook.LastEntry() can lead to race conditions. Use AllEntries instead: https://github.com/sirupsen/logrus/blob/60c74ad9be0d874af0ab0daef6ab07c5c5911f0d/hooks/test/test.go#L77 Closes https://gitlab.com/gitlab-org/gitlab-shell/-/issues/450
* Move gitlabnet client to client packagejc-refactor-gitlabnet-clientJohn Cai2020-05-042-2/+2
|
* Geo Pull custom action supportAsh McKenzie2020-04-171-0/+10
|
* Remove unnecessary command argumentDavid Kim2020-04-081-1/+1
|
* Move logging to handler insteadDavid Kim2020-04-071-3/+2
|
* Add test for command loggingDavid Kim2020-04-032-13/+5
|
* Add tests for loggingDavid Kim2020-03-301-0/+8
|
* Add git-archive-packStan Hu2020-03-261-6/+6
|
* Log git-{upload-pack,receive-pack} requestsStan Hu2020-03-261-0/+12
| | | | This restores the previous Ruby gitlab-shell behavior.
* commands: pass through GIT_PROTOCOL envvar provided by clientsps-git-protocol-envvarPatrick Steinhardt2020-02-281-1/+2
| | | | | | | | | | | Both git-upload-pack and git-receive-pack services inspect the GIT_PROTOCOL environment transferred via SSH in order to decide which protocols are supported by a given client. Currently, we don't use the environment variable at all, though, but instead forward the GitProtocol field of the access verification response. Improve this by passing on the GIT_PROTOCOL environment variable provided by the client as-is.
* Merge branch 'pass-ff-to-gitaly' into 'master'Ash McKenzie2019-10-292-1/+13
| | | | | Add support for Gitaly feature flags See merge request gitlab-org/gitlab-shell!351
* Rename import pathsNick Thomas2019-10-184-18/+18
|
* Move go code up one levelNick Thomas2019-10-184-0/+143