AD資格情報を使用すると、認証が成功した後にSSHが切断される

AD資格情報を使用すると、認証が成功した後にSSHが切断される

AD資格情報を受け入れるようにSSHを取得しようとしています。サーバーの詳細

  • セントOS 8
  • サーバーがドメインに正常に参加しました。
  • Ran Realmは、AD環境に関する正しい情報を返したことを発見しました。
  • 特定のユーザーを許可するために実行が許可されている領域
  • SSH設定ファイルが少し修正されました。主にルートログインのみを防ぎます。
  • ローカルユーザーアカウントを使用してSSH経由でサーバーに接続できます。
  • ユーザーはsomeuserというIDを使用して検索できます。 upnサフィックス(@ad.sample.com)を追加する必要はありません。

行動

  • SSH経由でログインすると、ユーザー名(ADユーザー名を提供)を入力するように求められ、パスワード(ADユーザーパスワードを提供する)を求めるメッセージが表示されます。パスワードを入力すると、SSHセッションはすぐに終了します。 /var/log/secure ログを使用すると、着信要求と資格情報が受け入れられることがわかります。認証されると、セッションはすぐに閉じます。無効なユーザー資格情報でテストした結果、端末自体と同様に、セキュリティログにこの内容が報告されていることがわかりました。
  • また、実際のサーバーコンソールでログイン試行をテストしましたが、最初はログインが許可されてからすぐに再度ログインするように見えました。
  • SSHデバッグの興味深い点は、MOTDが表示されることです。
  • 新しいユーザーがSSH経由でログインしようとすると、そのユーザーのホームディレクトリが作成されます。

SSHデバッグの部分出力

[email protected]'s password:
debug3: packet_send2: adding 48 (len 72 padlen 8 extra_pad 64)
debug2: we sent a password packet, wait for reply
debug1: Authentication succeeded (password).
Authenticated to x.x.x.x ([x.x.x.x]:xx).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Requesting 
debug1: Entering interactive session.
debug1: client_input_global_request: rtype  want_reply 0
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x10
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug1: Sending environment.
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env HOSTNAME
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env HISTSIZE
debug3: Ignored env SSH_CLIENT
debug3: Ignored env SSH_TTY
debug3: Ignored env USER
debug3: Ignored env LS_COLORS
debug3: Ignored env MAIL
debug3: Ignored env PATH
debug3: Ignored env PWD
debug1: Sending env LANG = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug3: Ignored env HISTCONTROL
debug3: Ignored env SHLVL
debug3: Ignored env HOME
debug3: Ignored env LOGNAME
debug3: Ignored env SSH_CONNECTION
debug3: Ignored env LESSOPEN
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env _
debug2: channel 0: request shell confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel_input_status_confirm: type 99 id 0
debug2: PTY allocation request accepted on channel 0
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Tue Jun  9 some date from x.x.x.x
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype  reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)

Connection to x.x.x.x closed.
Transferred: sent 2824, received 2420 bytes, in 0.1 seconds
Bytes per second: sent 24722.5, received 21185.7
debug1: Exit status 1

私たちのsssd.conf

[sssd]
domains = ad.sample.com
config_file_version = 2
services = nss, pam

[domain/ad.sample.com]
ad_domain = ad.sample.com
krb5_realm = AD.SAMPLE.COM
realmd_tags = manages-system joined-with-adcli
cache_credentials = True
id_provider = ad
krb5_store_password_if_offline = True
default_shell = /bin/bash
ldap_id_mapping = True
#use_fully_qualified_names = True
use_fully_qualified_names = False
#fallback_homedir = /home/%u@%d
fallback_homedir = /home/%u
access_provider = simple
simple_allow_users = someuser

この機能の設定に関するいくつかの投稿/ブログを確認しましたが、何も見逃していないようです。 sssd.confファイルのサービスセクションにSSHを追加してみました。違いはありません。

私が確認できる他の項目を知っている人はいますか?それとも何が間違っている可能性がありますか?

ベストアンサー1

確認する必要があるもう1つはaccess.confファイルです。説明するアクションの一部はローカルアカウントを受け入れますが、有効なグループまたはユーザーが設定されるまで他のアカウントを拒否するように設定することで実行できます。

おすすめ記事