cephが/ homeディレクトリにインストールされている場合、sshはRSAキーペアに関連付けられません。

cephが/ homeディレクトリにインストールされている場合、sshはRSAキーペアに関連付けられません。

私が経験している問題は、私が維持しているサーバーからホームディレクトリのCephファイルシステムに切り替えた後、RSAキーを介したSSHログインが突然動作を停止することです。いくつか確認してみましたが、インターネットで見つけた解決策のどれも効果がありませんでした。

まず、はい、homedirと.ssh / *に対する私の権限が正しいです。

~$ ls -la .ssh
drwx------ 1 johndoe foo         5 10 apr 20:24 .
drwx------ 1 johndoe foo        50  8 aug 19:51 ..
-rw------- 1 johndoe foo      1617  7 aug 18:56 authorized_keys
-rw-r--r-- 1 johndoe foo       680 10 apr 20:24 config
-rw------- 1 johndoe foo      1675 17 dec  2018 id_rsa
-rw-r--r-- 1 johndoe foo       408 17 dec  2018 id_rsa.pub
-rw-r--r-- 1 johndoe foo      4050 10 apr 20:24 known_hosts

また、サーバー上のすべてのユーザーにこの問題があるように見えるため、その権限は問題になりません。

次に確認したのはssh -vvv server。これにより、次の出力が表示されます。

debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:SOMETHING /home/john/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/john/.ssh/id_dsa
debug3: no such identity: /home/john/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /home/john/.ssh/id_ecdsa
debug3: no such identity: /home/john/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /home/john/.ssh/id_ed25519
debug3: no such identity: /home/john/.ssh/id_ed25519: No such file or directory
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

驚いたことにid_dsa、代わりに秘密鍵を使ってみるという言及だけが出ていましたが、鍵をコピーid_rsaしていないサーバーに接続しようとした後も同じことが起こったように見えました。

公開鍵のコピーをもう一度試しましたが、パスワードの入力を求められ、試してみましたが、まだパスワードの入力ssh-copy-id serverssh server求められました。

サーバー側では、問題の兆候があるかどうかを確認しようとします。そのため、実行しようとしましたが、sudo journalctl -u sshd.service -f接続しようとしたときに次のような出力が出て、正しく入力したパスワードを尋ねました。

aug 08 20:42:13 server.domain.com sshd[30191]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=sshgateway.otherdomain.com  user=johndoe
aug 08 20:42:14 octiron.liacs.nl sshd[30191]: Accepted password for johndoe from 1.3.3.7 port 43636 ssh2

したがって、鍵が正しいにもかかわらず、サーバーはまだ認証に失敗しているようです。

この時点で、私ができることを見つけようとしました。 SSHを介して接続しようとする詳細な結果が明確にリストされているので、Authentications that can continue: publickeypubkeyが期待どおりに機能すると仮定しました。権限はすべて大丈夫ですが、キーを操作する方法はまだわかりません。

この問題を解決するためのアドバイスをいただきありがとうございます。

編集:ローカルユーザーとして同じ操作を実行しようとすると(cephインストールのhomedirではなくローカルディスクのhomedirを使用)、すべてが期待どおりに機能します。

キーストロークのみを使用してログインし、Ctrl + Cを使用して終了しようとすると、以下が追加されます/var/log/secure

Aug  8 23:22:34 server sshd[16775]: Connection closed by 132.229.44.36 port 59610 [preauth]
Aug  8 23:22:51 server unix_chkpwd[16780]: password check failed for user (johndoe)
Aug  8 23:22:51 server sudo: pam_unix(sudo:auth): authentication failure; logname=johndoe uid=200104 euid=0 tty=/dev/pts/0 ruser=johndoe rhost=  user=johndoe
Aug  8 23:22:51 server sudo: johndoe : TTY=pts/0 ; PWD=/home/johndoe ; USER=root ; COMMAND=/bin/cat /var/log/secure
Aug  8 23:22:51 server sudo: pam_unix(sudo:session): session opened for user root by johndoe(uid=0)

ベストアンサー1

新しいテストでは、setenforce 0サーバーでSELinux(または)を無効にすると正常なログインになると述べました。マウントされたファイルシステムとこのユーザーのSELinux設定が正しくない可能性があります。... permissivessh.ssh.ssh/*

以下を試してください。

restorecon -rv /home/*/.ssh

(またはそのユーザーを1人だけ使用)。

おすすめ記事