Skip to content

$GITOLITE_HOME/.ssh/authorized_keys not updating #187

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

Closed
jamesloosli opened this issue May 5, 2014 · 13 comments
Closed

$GITOLITE_HOME/.ssh/authorized_keys not updating #187

jamesloosli opened this issue May 5, 2014 · 13 comments
Assignees
Labels

Comments

@jamesloosli
Copy link

It looks like the plugin is successfully committing and pushing my configuration changes to gitolite-admin.git, but authorized_keys does not contain the new keys.

I'm running redmine 2.5.1 with gitolite 2.3 on debian.

Relevant log showing that keys are being added:

2014-05-05 12:16:14 -0700 INFO [GitHosting] User 'admin' has added a SSH key
2014-05-05 12:16:14 -0700 INFO [GitWorker] Using Gitolite configuration file : 'gitolite.conf'
2014-05-05 12:16:14 -0700 INFO [GitWorker] add_ssh_key : SSH key 'redmine_jloosli@redmine_1399309903_846270' already exists in Gitolite, update it ...
2014-05-05 12:16:14 -0700 INFO [GitWorker] add_ssh_key : SSH key 'redmine_jloosli@redmine_1399317373_556615' does not exist in Gitolite, create it ...
2014-05-05 12:16:14 -0700 INFO [GitWorker] add_ssh_key : commiting to Gitolite...
2014-05-05 12:16:15 -0700 INFO [GitWorker] add_ssh_key : pushing to Gitolite...
2014-05-05 12:16:19 -0700 INFO [GitWorker] add_ssh_key : done !

However, ~/.ssh/authorized_keys for my git user only contains the admin key.

git@cookbook:~$ cat ~/.ssh/authorized_keys 
# gitolite start
command="/usr/share/gitolite/gl-auth-command admin",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB [...] BNsSQWB51RJc5 [email protected]_redmine_server.com
# gitolite end
@pashamesh
Copy link

I also confirm this behavior.

I'm running Redmine 2.5.1 with gitolite 3.5 on Debian.

@pashamesh
Copy link

I've also noticed that all new added pub keys are trimmed in gitolite repository files in «keys» folder

@n-rodriguez
Copy link
Contributor

This is weird, the trim should only happen with the devel branch.

The bug had been introduced in this commit afe951e (the field key in the gitolite_public_key table was converted from text to string) but is now fixed in the last commit ae48a33.

@pashamesh
Copy link

I've fixed this using mysql query:

ALTER TABLE `gitolite_public_key` MODIFY `key` TEXT;

@jamesloosli
Copy link
Author

Did this fix the keys in ~/.ssh/authorized_keys?

On Tuesday, May 6, 2014, Pasha MESH [email protected] wrote:

I've fixed this using mysql query «ALTER TABLE gitolite_public_key MODIFY
key TEXT».


Reply to this email directly or view it on GitHubhttps://github.com//issues/187#issuecomment-42286071
.

@pashamesh
Copy link

Nope. Need to recreate keys

@jamesloosli
Copy link
Author

After you re-created the keys, were new keys added to authorized_keys?

@jamesloosli
Copy link
Author

It looks like my database entries were already correct.


mysql> describe gitolite_public_keys;

+--------------------+--------------+------+-----+---------+----------------+

| Field              | Type         | Null | Key | Default | Extra
|

+--------------------+--------------+------+-----+---------+----------------+

| id                 | int(11)      | NO   | PRI | NULL    | auto_increment
|

| user_id            | int(11)      | NO   | MUL | NULL    |
|

| key_type           | int(11)      | NO   |     | 0       |
|

| title              | varchar(255) | NO   |     | NULL    |
|

| identifier         | varchar(255) | NO   | MUL | NULL    |
|

| key                | text         | NO   |     | NULL    |
|

| active             | tinyint(1)   | YES  |     | 1       |
|

| delete_when_unused | tinyint(1)   | YES  |     | 1       |
|

| created_at         | datetime     | NO   |     | NULL    |
|

| updated_at         | datetime     | NO   |     | NULL    |
|

+--------------------+--------------+------+-----+---------+----------------+

10 rows in set (0.00 sec)

On Tue, May 6, 2014 at 9:10 AM, Pasha MESH [email protected] wrote:

Nope. Need to recreate keys


Reply to this email directly or view it on GitHubhttps://github.com//issues/187#issuecomment-42323230
.

@pashamesh
Copy link

Maybe, migration fix problem, but key was already trimmed

@pashamesh
Copy link

Try to add new key

@jamesloosli
Copy link
Author

Neither of my keys were trimmed. I'll try to delete and re-add.

On Tue, May 6, 2014 at 11:25 AM, Pasha MESH [email protected]:

Try to add new key


Reply to this email directly or view it on GitHubhttps://github.com//issues/187#issuecomment-42339973
.

@n-rodriguez n-rodriguez self-assigned this May 7, 2014
@n-rodriguez n-rodriguez added the bug label May 7, 2014
@n-rodriguez
Copy link
Contributor

This is fixed in commit ae48a33.

Btw, be sure to use a stable branch (or a tarball release) and not the devel (devil?) branch ;)

@philippe-bollard
Copy link

I'm sorry but the commit ae48a33 didn't fix the bug. I currently running redmine_git_hosting 0.7.2 (migrated from 0.6.1) on Redmine 2.3.0.stable.11727 with Gitolite 2.3-1 and Git 1.9.1.

I checked the database, the keys, ... everything is OK but the file ".ssh/authorized_keys" is never updated when I add a key.

EDIT: I upgraded to latest Redmine 2.5.1. The bug is still here :(

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

4 participants