Skip to content

$GITOLITE_HOME/.ssh/authorized_keys still NOT updating after commit ae48a33 #200

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
philippe-bollard opened this issue May 23, 2014 · 19 comments
Assignees
Labels

Comments

@philippe-bollard
Copy link

I'm sorry but the commit ae48a33 didn't fix the bug #187. 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 upgraded to latest Redmine 2.5.1. I checked the database, the keys, ... everything is OK but the file ".ssh/authorized_keys" is never updated when I add a key.

Please reopen the issue #187 and investigate further :)

@n-rodriguez
Copy link
Contributor

Did you try this? ALTER TABLE gitolite_public_keyMODIFYkey TEXT;

@n-rodriguez n-rodriguez self-assigned this May 23, 2014
@philippe-bollard
Copy link
Author

Yes, I checked before reporting the issue. The type of 'gitolite_public_keys.key' is already 'TEXT' and ssh-keys are not trimmed into database.

@n-rodriguez
Copy link
Contributor

Ok, so the bug is elsewhere. Can you please check your configuration in Administration -> Redmine Git Hosting -> Config Checks?

@philippe-bollard
Copy link
Author

Everything is OK and green :)

@n-rodriguez
Copy link
Contributor

Can you go in :gitolite_temp_dir/gitolite-admin.git and do a git status?

@philippe-bollard
Copy link
Author

There are some files not commited.
(I cleaned several times this folder during my tests and did a resync of sshkeys/projects from redmine. )

redmine@redmine:/tmp/redmine_git_hosting/gitolite/gitolite-admin.git$ git status
# Sur la branche master
# Votre branche est à jour avec 'origin/master'.
#
# Modifications qui seront validées :
#   (utilisez "git reset HEAD <fichier>..." pour désindexer)
#
#       modifié:         conf/gitolite.conf
#       nouveau fichier: keydir/redmine_philippe@redmine_1400802197_783802.pub
...

@n-rodriguez
Copy link
Contributor

Ok, so the bug is here. I think this is a permission issue.
If you did some git commit / git push -u origin master with the root user, files' owner has changed under the hood. You should try chown -R <redmine_user>/:gitolite_temp_dir/gitolite-admin.git and do some tests. The current modifications will be pushed with the new ones.

@philippe-bollard
Copy link
Author

I don't think so... The folder <redmine_user>/:gitolite_temp_dir/gitolite-admin.git is recreated with the redmine user. And I didn't commit/push with root :)

@philippe-bollard
Copy link
Author

I deleted the folder. So, the git index is empty, OK?
Then I did a resync from redmine. The folder is recreated with the user redmine. All permissions are good.
Then, I did a 'git status' with the same result... Some commits are pending.

@n-rodriguez
Copy link
Contributor

Which version of Gitolite are you using? (bundle list)

@philippe-bollard
Copy link
Author

# bundle list | grep git
  * github-markup (1.2.1)
  * gitlab-grit (2.6.7)
  * jbox-gitolite (1.1.11)

# apt-cache policy gitolite
gitolite:
  Installé : 2.3-1
  Candidat : 2.3-1

@n-rodriguez
Copy link
Contributor

What do you have in log file? (redmine/log/git_hosting.log)

@philippe-bollard
Copy link
Author

I past only the last try:

2014-05-23 14:37:44 +0200 INFO [GitHosting] Forced resync of all projects (15)...
2014-05-23 14:37:44 +0200 INFO [GitHosting] Forced resync of all ssh keys (25)...
2014-05-23 14:37:44 +0200 INFO [GitHosting] Testing if Gitolite user 'gitolite' can sudo to Redmine user 'redmine'...
2014-05-23 14:37:44 +0200 INFO [GitHosting] OK!
2014-05-23 14:37:44 +0200 INFO [GitHosting] Testing if Redmine user 'redmine' can sudo to Gitolite user 'gitolite'...
2014-05-23 14:37:44 +0200 INFO [GitHosting] OK!
2014-05-23 14:37:44 +0200 INFO [GitHosting] Global hook directory '~/.gitolite/hooks/common/post-receive.d' is already present, will not touch it !
2014-05-23 14:37:44 +0200 INFO [GitHosting] Our 'post-receive.redmine_gitolite.rb' hook is already installed
2014-05-23 14:37:45 +0200 INFO [GitHosting] Our 'post-receive.git_multimail.py' hook is already installed
2014-05-23 14:37:45 +0200 INFO [GitHosting] Our 'post-receive.mail_notifications.py' hook is already installed
2014-05-23 14:37:45 +0200 INFO [GitHosting] Installing Redmine Gitolite mirroring SSH keys ...
2014-05-23 14:37:45 +0200 INFO [GitHosting] Done !

@n-rodriguez
Copy link
Contributor

And if you try to push by hand (git push -u origin master)? Be sure to push with the user running Redmine.
You will have to configure .ssh/config file to do so.

root$ su - redmine
redmine$ vi .ssh/config
# [add this]
Host localhost
    User git
    IdentityFile /path/to/redmine_gitolite_admin_id_rsa
    IdentitiesOnly yes

@philippe-bollard
Copy link
Author

$ git commit -m 'Manual commit'

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: empty ident name (for <redmine@hostname>) not allowed

$ git config --global user.email "[email protected]"
$ git config --global user.name "Redmine"
$ git commit -m 'Manual commit'
[master ba38d88] Manual commit
 22 files changed, 95 insertions(+), 12 deletions(-)
 create mode 100644 keydir/redmine_myuser1@redmine_1400802197_783802.pub
...

$ git push
Counting objects: 10, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 2.10 KiB | 0 bytes/s, done.
Total 6 (delta 2), reused 0 (delta 0)
remote: 
remote: Repository does not have 'redminegitolite.projectid' set, exiting...
remote: 
remote: 
remote:                 ***** ABORTING *****
remote:         git config redminegitolite.projectid not allowed
remote: check GL_GITCONFIG_KEYS in the rc file for how to allow it
To ssh://gitolite@localhost/gitolite-admin.git
   76e0fcd..ba38d88  master -> master

@n-rodriguez
Copy link
Contributor

Here's the bug : check GL_GITCONFIG_KEYS in the rc file for how to allow it

@philippe-bollard
Copy link
Author

Thx, it solves my problem. I'm sorry to missed that... :)

But now, I see another bug. I just added a new deployment key (for a specific project, generated by an dedicated user on a deployment server... it's not my personal user key!). Now, it's OK, $GITOLITE_HOME/.ssh/authorized_keys is updated with all keys, but the keys are mixed (identifiers are not unique). On my deployment server, the deployment key provide access... to other unauthorized projects (and some in RW) !

Now from my server :

ssh [email protected]
PTY allocation request failed on channel 0
hello redmine_myuser_deploy_key_7, this is gitolite 2.3-1 (Debian) running on git 1.9.1
the gitolite config gives you the following access:
     R          projects/project1
     R          projects/project2
...
     R   W      projects/project3
     R   W      projects/thewantedproject

With a good configuration, It should only display:

ssh [email protected]
PTY allocation request failed on channel 0
hello redmine_myuser_deploy_key_7, this is gitolite 2.3-1 (Debian) running on git 1.9.1
the gitolite config gives you the following access:
     R   W      projects/thewantedproject

In fact, some keys are now inverted... I'm receiving alert form another server with previously deployment key configured.

R access for projects/myotherproject DENIED to redmine__deploy_key__1382624712_530271
(Or there may be no repository at the given path. Did you spell it correctly?)
fatal: The remote end hung up unexpectedly

I tried to rename/resync keys but it don't fix this problem...

@philippe-bollard
Copy link
Author

The previous migration messed up the keys: some older are not deleted.
So, I deleted deployment keys from redmine in order to clean database. Then I deleted all keys (but not admin) from gitolite_temp_dir/gitolite-admin.git and remove all conf from gitolite.conf. Now the file contains:

repo    @all
  RW+                            = redmine_gitolite_admin_id_rsa

repo    gitolite-admin
  RW+                            = redmine_gitolite_admin_id_rsa

I commited and pushed from redmine user.
Then, I deleted the gitolite_temp_dir/gitolite-admin.git and did a resync of projects and ssh keys in order to recreate this folder.

All files are now OK... but the changes are not commited/pushed automatically into the git repository. I commited/pushed manually with a stange message:

$ git push
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 394 bytes | 0 bytes/s, done.
Total 4 (delta 1), reused 0 (delta 0)
remote: 
remote: Repository does not have 'redminegitolite.projectid' set, exiting...
remote: 
remote: 
remote:                 ***** WARNING *****
remote:         You have 15 users WITHOUT pubkeys...!
To ssh://gitolite@localhost/gitolite-admin.git
   73549eb..d289069  master -> master

I tried to access from previous deployment server and the new keys seems now correctly configured.

I added new deployment keys from redmine. The file gitolite.conf is correctly updated and new keys added to the keydir folder. But changes are still not commited/pushed !

EDIT: I restarted Redmine (thin) and reactivated the Sidekiq mode. Change changes are now commited/pushed :)

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

2 participants