Gitolite3 SSH информация не работает

903
Florian Mertens

Я установил gitolite3 из репозитория EPEL в Centos6.4. Было много вещей, которые мне не нравились, поэтому я решил изменить их. Сначала я создал дополнительного пользователя и группу под названием «git», чтобы отдалиться от малоизвестного пользователя gitolite3. Во-вторых, я использовал пользовательскую папку / Server / Projects вместо / var / lib / gitolite3. Я позаботился о том, чтобы владение и права были одинаковыми.

Установка также прошла без проблем (su - git, затем настройка gitolite3 с ключом клиента администратора).

Обычно на клиентском компьютере команда ssh git@myserver infoгенерирует хороший возврат в виде простого gitolite, в котором перечислены репозитории и разрешения. Но теперь он дает мне запрос на пароль. Очевидно, что gitolite больше не подключается к порту ssh через этого пользователя, но обычная версия bash есть.

Я не эксперт по SSH, поэтому что-то пошло не так, или я забыл что-то сделать. Куда мне смотреть? Я думаю, что / usr / share / gitolite3 / gitolite3-shell - это приложение, которое SSHD должен вызывать, когда приходит запрос SSH с пользователем git.

1
Каковы права доступа к каталогу .ssh и файлу .ssh / authorized_keys для пользователя git? Что говорит `ssh -vvv git @ myserver info`? Что говорит журнал ssh на сервере? Etan Reisner 10 лет назад 1
Спасибо за помощь! Должен ли локальный пользователь, выполняющий эту команду ssh, быть известным в списке авторизованных gsh @ server ssh? -vvv возвращает много информации, вы хотите увидеть все это? Где находится журнал ssh, и вы спрашиваете о локальном журнале ssh или журнале sshd сервера? Florian Mertens 10 лет назад 0
Журнал сервера. Да все на выходе. Ключ, который использует локальный пользователь, должен быть в списке авторизованных ключей git @ server, иначе ключ локального пользователя не будет аутентифицировать пользователя в учетной записи git (но вам не нужно ничего делать с этим, так как gitolite управляет для вас authorized_keys ). Etan Reisner 10 лет назад 1

1 ответ на вопрос

0
Florian Mertens

SSH is not easy. I have resolved it myself, but it wasn't obvious. It was mostly a SELinux problem, but I found that I had also not setup the pubkey properly.

First, I (re)created the pubkey (admin.pub) for the local computer that was going to administer the gitolite server, copied it to the server git user home folder, rerun (under the git user in his home folder) the gitolite setup with that pubkey. A note here is that my local computer is windows with msys-git, making the problem not easy.

# su - git $ cd /Server/Projects $ gitolite setup --pubkey admin.pub 

..That resolved the pubkey problem. The selinux was a bigger learning curve, but essentially you lose all of the original /var/lib/gitolite3 folder context labellings when you just copy. To restore the labellings (with semanage), you reference the same labellings (with the -e flag) as on the original folder, to where you have set the current gitolite folder. Since that only adds to the existing selinux file contexts, you also need to restore these from the selinux file contexts. The final pithole is to use absolute paths, not relative paths. You can see what you did with the ll command:

# semanage fcontext -a -e /var/lib/gitolite3 /Server/Projects # restorecon -R /Server/Projects # ll -aZ 

Now, on your local machine, try it all out with the command below from the computer where the pubkey was coming from, it worked for me. Note that I didn't know that ssh git@unclefloserver info would only return a nice gitolite3 repo info output if the server actually has the pubkey of the requesting user/computer combination. I also failed to understand this concept a bit, and I was trying this out from a different computer.

> git clone git@server:gitolite-admin 

Big thanks to @Etan Reisner for keeping the pressure up.

Похожие вопросы