20

私は今、週に2日ほどここに立ち往生しています。

Gitlab4 と gitolite を備えた CentOs マシンを持っています。すべてが何週間もうまく機能していましたが、突然先週末、奇妙なことが起こり、まったくすべてのバイナリがマシンから消えました (yum、python、ruby、mysql など)。 gitlab のコンパイルが再び機能していました。

しかし、 gitlabgitユーザーの間で ssh キーを取得できません。私はすでにgitユーザーを削除して再作成し、すべての権限を再設定し、sshキーを再作成し、gitolite ectを再インストールしました。しかし、何も機能せず、同じエラーが発生し続けます。

git ユーザー .ssh フォルダー

-rwx------ 1 git git  557 Mar 27 16:46 authorized_keys

gitlab ユーザーの .ssh フォルダー

-rw------- 1 gitlab gitlab 1671 Mar 27 16:45 id_rsa
-rw-r--r-- 1 gitlab gitlab  406 Mar 27 16:45 id_rsa.pub
-rw-r--r-- 1 gitlab gitlab  391 Mar 27 16:50 known_hosts

SSH エラー:

ssh -vvvT git@localhost
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/gitlab/.ssh/identity type -1
debug3: Not a RSA1 key file /home/gitlab/.ssh/id_rsa.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug3: key_read: missing keytype
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug3: key_read: missing whitespace
debug2: key_type_from_name: unknown key type '-----END'
debug3: key_read: missing keytype
debug1: identity file /home/gitlab/.ssh/id_rsa type 1
debug1: identity file /home/gitlab/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2
debug1: match: OpenSSH_4.3p2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3p2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: mac_init: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_init: found hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 132/256
debug2: bits set: 502/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: check_host_in_hostfile: filename /home/gitlab/.ssh/known_hosts
debug3: check_host_in_hostfile: match line 1
debug1: Host 'localhost' is known and matches the RSA host key.
debug1: Found key in /home/gitlab/.ssh/known_hosts:1
debug2: bits set: 505/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/gitlab/.ssh/identity ((nil))
debug2: key: /home/gitlab/.ssh/id_rsa (0x848ba50)
debug2: key: /home/gitlab/.ssh/id_dsa ((nil))
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/gitlab/.ssh/identity
debug3: no such identity: /home/gitlab/.ssh/identity
debug1: Offering public key: /home/gitlab/.ssh/id_rsa
debug3: send_pubkey_test
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/gitlab/.ssh/id_dsa
debug3: no such identity: /home/gitlab/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred: ,password
debug3: authmethod_is_enabled password
debug1: Next authentication method: password

認証ログは私に与えます:

Apr  2 10:19:13 venus sshd[15693]: User git not allowed because account is locked
Apr  2 10:19:13 venus sshd[15693]: Failed none for illegal user git from ::ffff:127.0.0.1 port 56906 ssh2

助けてくれてありがとう。

4

5 に答える 5

27

あなたは言及します:

Apr 2 10:19:13 venus shd[15693]: User git not allowed because account is locked 
Apr 2 10:19:13 venus sshd[15693]: Failed none for illegal user git from ::ffff:127.0.0.1 port 56906 ssh2

この記事では、次のことについて言及しています。

OpenSSH は、ロックされたアカウントをデフォルトでチェックするようになりました。
Linux システムでは、ロックされたアカウントは!!、のパスワード フィールドにある/etc/shadowアカウントとして定義されます。
これは、useradd コマンドで作成されたアカウントのデフォルト エントリです
GSI 認証を使用していて、ローカル パスワードを必要としない場合でも、次sshdのメッセージが表示されてユーザーがログインできなくなります。

Too many authentication failures for username

sshdデバッグ情報では、アカウントがロックされていることが示されます。

User username not allowed because account is locked

sshd マニュアルからの追加情報を次に示します。

認証タイプに関係なく、アカウントはチェックされ、アクセス可能であることが確認されます。
アカウントがロックされているか、DenyUsers にリストされているか、またはそのグループが DenyGroups にリストされている場合、アカウントにはアクセスできません。
ロックされたアカウントの定義はシステムによって異なります。
一部のプラットフォームには独自のアカウント データベース (AIX など) があり、passwd フィールド ( *LK*Solaris と UnixWare では " *"、HP-UX では " Nologin"、Tru64 では " "、FreeBSD では先頭に " *LOCKED*"、FreeBSD では先頭に " !!"を含む) を変更するプラットフォームもあります。 Linux)。
公開鍵を許可しながらアカウントのパスワード認証を無効にする必要がある場合は、passwdフィールドをこれらの値以外に設定する必要があります (例: " NP"*NP*

修正:交換!! (たとえば) /etc/shadow の NP を使用します。


jzakmeister (コメント) とYongcan-Frank-Lv (コメント)が言及したように:

sudo passwd -u git

アカウントのロックを解除するには十分です。

于 2013-04-02T10:37:51.033 に答える
1

受け入れられた答えはうまくいくかもしれませんが、これは好ましい方法ではないかもしれません。

少なくとも Ubuntu 12.04 ではpasswd -u git、次の警告が表示されます。

passwd: unlocking the password would result in a passwordless account.
You should set a password with usermod -p to unlock the password of this account.

いいですね... の man ページがオプションusermodの使用に対して警告していることを除いて。-p

Note: This option is not recommended because the password (or encrypted password)
will be visible by users listing the processes.

そのすべての代わりに、呼び出しpasswd -d gitlabはユーザーのパスワードを削除することでトリックを実行します (その passwd フィールドを空の文字列に設定します)。

于 2014-01-02T21:15:36.127 に答える
1

~gitlab/.ssh/id_rsa.pub を ~git/.ssh/authorized_keys に入れる必要があります

-rwx------ 1 git git 557 3 月 27 日 16:46 認可されたキー

-rw-r--r-- 1 gitlab gitlab 406 3 月 27 日 16:45 id_rsa.pub

サイズが一致していないことがわかります。authorized_keys にいくつかの ssh キー オプションを追加しましたか? また、sshd のエラー ログも確認する必要があります (例: /var/log/auth または /var/log/secure など)。

于 2013-03-28T10:04:33.980 に答える