2017-09-06 23 views
0

公開鍵認証を使用してホスト上のローカルアカウント(Ubuntu 16.04)にログインできるようにシステムを設定しようとしています。 LDAPサーバーがダウンしています。LDAPサーバがダウンしているときにローカルユーザを認証する公開鍵

これはクラウドイメージなので、ローカルに必要なユーザーはubuntuです。このユーザーはパスワードを持っていません(私はセキュリティのためにパスワードを設定したくありません)。このユーザーに対して公開鍵認証のみを許可する必要があります。

このユーザーは、UID 1001と私のすべてのLDAPユーザがUID番号を持っている持っている> = 2000

私は一日中ものをしようとしてきた(例えばpam_succeed_if.sopam_localuserなど)。

getent passed ubuntuは正常に動作し、ローカルのpasswd行を返します。しかし、そのようssh拒否する:

Sep 6 17:27:43 ip-10-99-0-241 sshd[24895]: nss_ldap: could not connect to any LDAP server as (null) - Can't contact LDAP server 
Sep 6 17:27:43 ip-10-99-0-241 sshd[24895]: nss_ldap: failed to bind to LDAP server ldaps://ldap.domain.tld: Can't contact LDAP server 
Sep 6 17:27:43 ip-10-99-0-241 sshd[24895]: nss_ldap: reconnecting to LDAP server... 

そして最終的にはAuthentication failed.で失敗します。

  • ​​

    passwd:   compat [success=return] ldap 
    group:   compat [success=return] ldap 
    shadow:   compat [success=return] ldap 
    
  • /etc/pam.d/common-account

    account [success=2 new_authtok_reqd=done default=ignore]  pam_unix.so 
    # NOTE: These two won't work - fatal: Access denied for user <ldap user> by PAM account configuration [preauth] 
    #account sufficient      pam_localuser.so 
    #account sufficient      pam_succeed_if.so uid [le sign] 500 quiet 
    account [success=1 default=bad success=ok user_unknown=ignore] pam_ldap.so 
    account requisite      pam_deny.so 
    account required      pam_permit.so 
    account required      pam_krb5.so minimum_uid=2000 
    
  • /etc/pam.d/common-auth

    auth [success=3 default=ignore]  pam_krb5.so minimum_uid=2000 ignore_root 
    auth [success=2 default=ignore]  pam_unix.so nullok_secure try_first_pass 
    auth [success=1 default=ignore]  pam_ldap.so use_first_pass ignore_unknown_user ignore_authinfo_unavail 
    # NOTE: Can't login with this (changed the success above)! 
    #auth requisite      pam_succeed_if.so uid [ge sign] 500 quiet 
    auth requisite      pam_deny.so 
    auth required      pam_permit.so 
    
  • /etc/ldap.conf

    bind_timelimit 10 
    pam_min_uid 2000 
    nss_initgroups_ignoreusers ubuntu,local 
    nss_reconnect_tries 2 
    nss_reconnect_sleeptime 1 
    nss_reconnect_maxsleeptime 8 
    nss_reconnect_maxconntries 2 
    

(私は事前に、コードブロックを使用してみましたが、SOFは、これは恐ろしい見える場合ので、申し訳ありませんが、私はその後、ポスト許さなかった - 管理者権限を持つ誰もが中に入ると、修正することができた場合、してください。man page for nsswitch.confを読み直す)

答えて

0

は、私にこれを与えたか:

  • return
    • 結果を今すぐ返します。さらなるルックアップ機能を呼び出さないでください。ただし、互換性の理由から、この がグループデータベースとnotfoundステータスに対して選択されたアクションであり、設定ファイルにinitgroups行が含まれていない場合は、検索結果に影響を与えることなく次の検索機能が常に呼び出されます。

キーワードここではこの部分である:設定ファイルは、initgroups行が含まれていない、次の検索機能は常にと呼ばれています。同様に

、私はライン

initgroups:  files 

を追加した場合、私は今、LDAPサーバーがダウンした場合でも、ubuntuユーザーにログインすることができますが!

関連する問題