authorized_keys file not being updated
Summary
The authorized_keys file for the git user is not updated when users add or remove SSH keys. Same issue on multiple GitLab installations/servers. Running gitlab-rake gitlab:shell:setup from command line will update the keys.
Steps to reproduce
Add or remove an SSH key from a user via web interface.
Example Project
Cannot reproduce on gitlab.com.
What is the current bug behavior?
The file /var/opt/gitlab/.ssh/authorized_keys is not changed when a user's keys are changed.
What is the expected correct behavior?
File should have keys added or removed as appropriate.
Relevant logs and/or screenshots
sidekiq/current:{"severity":"INFO","time":"2020-03-24T10:25:06.338Z","class":"AuthorizedKeysWorker","retry":3,"queue":"authorized_keys","jid":"a9e7fb7c744d14c6a2225d35","created_at":"2020-03-24T10:25:06.331Z","meta.user":"xand","meta.caller_id":"Profiles::KeysController#destroy","correlation_id":"u7ezWGQ7kb2","enqueued_at":"2020-03-24T10:25:06.337Z","pid":27368,"message":"AuthorizedKeysWorker JID-a9e7fb7c744d14c6a2225d35: start","job_status":"start","scheduling_latency_s":0.000624}
sidekiq/current:{"severity":"INFO","time":"2020-03-24T10:25:06.351Z","class":"AuthorizedKeysWorker","retry":3,"queue":"authorized_keys","jid":"a9e7fb7c744d14c6a2225d35","created_at":"2020-03-24T10:25:06.331Z","meta.user":"xand","meta.caller_id":"Profiles::KeysController#destroy","correlation_id":"u7ezWGQ7kb2","enqueued_at":"2020-03-24T10:25:06.337Z","pid":27368,"message":"AuthorizedKeysWorker JID-a9e7fb7c744d14c6a2225d35: done: 0.013141 sec","job_status":"done","scheduling_latency_s":0.000624,"duration":0.013141,"cpu_s":0.006481,"completed_at":"2020-03-24T10:25:06.351Z","db_duration":0.8173310197889805,"db_duration_s":0.0008173310197889805}
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Installation 1:
System information
System:
Current User: git
Using RVM: no
Ruby Version: 2.6.5p114
Gem Version: 2.7.10
Bundler Version:1.17.3
Rake Version: 12.3.3
Redis Version: 5.0.7
Git Version: 2.24.1
Sidekiq Version:5.2.7
Go Version: unknown
GitLab information
Version: 12.9.0
Revision: 9a382ff2c82
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 10.12
URL: https://git.xand.uk
HTTP Clone URL: https://git.xand.uk/some-group/some-project.git
SSH Clone URL: git@git.xand.uk:some-group/some-project.git
Using LDAP: no
Using Omniauth: yes
Omniauth Providers:
GitLab Shell
Version: 12.0.0
Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories
GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
Git: /opt/gitlab/embedded/bin/git
This issue is reproducible on another installation, same version and OS (CentOS 7).
Results of GitLab application Check
Checking GitLab subtasks ...
Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 12.0.0 ? ... OK (12.0.0)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Internal API available: OK
Redis available via internal API: OK
gitlab-shell self-check successful
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes
Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... LDAP is disabled in config/gitlab.yml
Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes
Database config exists? ... yes
All migrations up? ... yes
Database contains orphaned GroupMembers? ... no
GitLab config exists? ... yes
GitLab config up to date? ... yes
Log directory writable? ... yes
Tmp directory writable? ... yes
Uploads directory exists? ... yes
Uploads directory has correct permissions? ... yes
Uploads directory tmp has correct permissions? ... yes
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Projects have namespace: ...
2/1 ... yes
3/4 ... yes
4/6 ... yes
5/8 ... yes
8/9 ... yes
2/10 ... yes
8/11 ... yes
2/12 ... yes
11/13 ... yes
5/14 ... yes
2/15 ... yes
13/16 ... yes
2/17 ... yes
2/18 ... yes
13/19 ... yes
2/20 ... yes
2/21 ... yes
2/22 ... yes
2/23 ... yes
2/24 ... yes
5/25 ... yes
2/26 ... yes
2/27 ... yes
2/28 ... yes
2/29 ... yes
2/30 ... yes
2/31 ... yes
2/32 ... yes
2/33 ... yes
2/34 ... yes
2/35 ... yes
2/36 ... yes
5/37 ... yes
2/38 ... yes
5/40 ... yes
2/41 ... yes
5/42 ... yes
5/43 ... yes
2/44 ... yes
2/45 ... yes
5/46 ... yes
Redis version >= 2.8.0? ... yes
Ruby version >= 2.5.3 ? ... yes (2.6.5)
Git version >= 2.22.0 ? ... yes (2.24.1)
Git user has default SSH configuration? ... yes
Active users: ... 6
Is authorized keys file accessible? ... yes
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
Possible fixes
(If you can, link to the line of code that might be responsible for the problem)