おのたく日記 YouTubeも始めました→
2013-12-04(Wed) [長年日記]
■ [Debian][git][gitlab] git cloneするのにgitlabだどrepositories/が必要
先日インストールしたgitlabだけど、一応うまく動いている物の、git gloneしようとすると
% git clone git@on-o.com:takuya/test.git
Cloning into 'test'...
fatal: 'takuya/test.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
となってしまって
$ git clone git@on-o.com:repositories/takuya/test.git
Cloning into 'test'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
と、URLにrepositories/を入れないとダメ。
これは、gitユーザは既に普通のgit用に使っていて、~git/.ssh/authorized_keysに、接続元のpublicキーが入っていたから。gitlab-shellが起動されていなかった。
逆に、authorized_keysにgitlab-shellのエントリーだけにすると、
fatal: unrecognized command '/home/git/gitlab-shell/bin/gitlab-shell key-1'
fatal: The remote end hung up unexpectedl
となってしまう。これはgitユーザのshellがgit-shellでgitlab-shellの起動が制限されているから。
■ 結局 gitlab用にgitlabユーザを作った
gitユーザと、gitlabユーザを分けることにして、# mv ~git/gitlab* ~gitlab/ なんてして、新しいgitlabユーザでgitlabを動かすことにした。
SSHキーをgitlabに再インストールしたり、sshdにgitlabでのログインを許したりにははまったけど、基本的にはconfigファイルを書き換えることで移行完了。
■ [git] リモートからssh:でgit clone できない
ローカルから出来るし、自分は出来ているので安心しきっていたのだけど、リモートからgiユーザでgit clone出来ない事判明。
Dec 4 10:26:32 mirara sshd[14265]: fatal: Access denied for user gitlab by PAM account configuration [preauth]
[/var/log/auth.logより引用]
と拒絶されている。
原因は、sshで入れるユーザをPAMで制限してた。
/etc/pam.d# cat sshd.tkyn.diff
--- sshd.org 2013-02-09 06:24:56.000000000 +0900
+++ sshd 2013-08-13 00:34:26.863427340 +0900
@@ -16,6 +16,7 @@
# Uncomment and edit /etc/security/access.conf if you need to set complex
# access limits that are hard to express in sshd_config.
# account required pam_access.so
+account required pam_access.so
# Standard Un*x authorization.
@include common-account
sshdは、PAMも関わっていたの忘れていたのね。そこで、
/etc/security# diff -u access.conf.org access.conf
--- access.conf.org 2008-08-20 07:58:16.000000000 +0900
+++ access.conf 2013-12-04 07:36:35.379862343 +0900
@@ -120,3 +120,6 @@
#
# All other users should be denied to get access from all sources.
#- : ALL : ALL
+-:ALL EXCEPT ssh:ALL EXCEPT LOCAL 192.168.
として、sshグループのユーザは入れるようにした。
|