Linux でのシームレスな Kerberos 接続

このタスクについて

kinit および k5start ユーティリティーを使用して 2 つの cron ジョブを作成する必要があります。これらのユーティリティーは次の操作を実行します

  1. 更新可能期限の前に TGT を更新する。(k5start)
  2. 期限が切れる前にトークンを再生成する。(kinit)

手順

  1. k5start ユーティリティーを使用して TGT を更新します。これを cron に追加します。Kerberos 管理者に問い合わせて、この値を入手してください。
    a. Kerberos キータブ・ファイルを使用して、Cloudera BigData インスタンスの認証を確立します。

    k5start -f <KEYTABFILE> -K <minutes> -l <time> [-u <PRINCIPAL>]
    [-v]
    You can add this command in the corn job and make sure that the kerberos token is always
    alive.
    b. 次を参照してください https://linux.die.net/man/1/k5start
    c. k5start -f <KEYTABFILE> -K <minutes> -l <time> [-u <PRINCIPAL>] [-v]
    -f keytab
    Authenticate using the keytab rather than asking for a password. A key for the client principal must be present in keytab.
    
    -K minutes
    Run in daemon mode to keep a ticket alive indefinitely. The program reawakens after minutes minutes, checks if the ticket will expire before or less than two minutes after the next scheduled check, and gets a new ticket if needed. If this option is not given but a command was given on the command line, an interval appropriate for the ticket lifetime will be used.
    
    -l time string
    Set the ticket lifetime. time string should be in a format recognized by the Kerberos libraries for specifying times, such as "10h" (ten hours) or "10m" (ten minutes). Known units are "s", "m", "h", and "d"
    
    -v
    Be verbose. This will print out a bit of additional information about what is being attempted and what the results are.
    For example:
    k5start -f <FilePath>/impala.keytab -K 1 -l 3m impala/quickstart.cloudera@CLOUDERA
    k5start -f <FilePath>/impala.keytab -K 1 -l 3m impala/quickstart.cloudera@CLOUDERA -v
  2. kinit ユーティリティーを使用してトークンを再生成します。チケットの期限が切れる前に再生成するように、cron に追加します。
     kinit -k -t <keytab_filename> <principal>
    Refer https://linux.die.net/man/1/kinit .
    -k [-t keytab_file]
    チケットを要求し、ローカル・ホストのキータブ・ファイルのキーから取得します。キータブ・ファイルの名前と場所は、-t キータブ・ファイル・オプションで指定できます。指定しないと、デフォルトの名前と場所が使用されます。デフォルトで、ホスト・チケットは要求されますが、プリンシパルを指定することができます。KDC では、特別なキータブの場所 KDB: を指定して、kinit が KDC データベースを開き、キーを直接検索する必要があることを示すことができます。これにより、管理者はパスワードベースの認証をサポートするプリンシパルとしてチケットを取得できます。
    例 kinit -k -t /root/impala.keytab impala/quickstart.cloudera@CLOUDERA