メインコンテンツまでスキップ

Authentication

認証方法

StarRocksは、"ユーザー名+パスワード"の認証方法に加えて、LDAPもサポートしています。

LDAP認証

LDAP認証を使用するには、最初にLDAPサービスをFEノードの設定に追加する必要があります。

  • authentication_ldap_simple_server_host: サービスのIPを指定します。
  • authentication_ldap_simple_server_port: サービスのポートを指定します。デフォルト値は389です。

ユーザーを作成する際に、IDENTIFIED WITH authentication_ldap_simple AS 'xxx'という形式でLDAP認証を指定します。xxxはLDAP上のユーザーのDN(識別名)です。

例1:

CREATE USER tom IDENTIFIED WITH authentication_ldap_simple AS 'uid=tom,ou=company,dc=example,dc=com'

LDAPでユーザーのDNを指定せずにユーザーを作成することもできます。ユーザーがログインすると、StarRocksはLDAPシステムにユーザー情報を取得しに行きます。一致する情報が1つだけ存在する場合、認証は成功します。

例2:

CREATE USER tom IDENTIFIED WITH authentication_ldap_simple

この場合、FEに追加の設定が必要です。

  • authentication_ldap_simple_bind_base_dn: ユーザーのベースDNを指定し、ユーザーの取得範囲を指定します。
  • authentication_ldap_simple_user_search_attr: ユーザーを識別するLDAPオブジェクト内の属性の名前を指定します。デフォルトではuidです。
  • authentication_ldap_simple_bind_root_dn: ユーザー情報を取得するために使用する管理者アカウントのDNです。
  • authentication_ldap_simple_bind_root_pwd: ユーザー情報を取得する際に使用する管理者アカウントのパスワードです。

LDAP認証では、クライアントがクリアテキストのパスワードをStarRocksに渡す必要があります。クリアテキストのパスワードを渡す方法は3つあります:

  • MySQLコマンドライン

実行時に--default-auth mysql_clear_password --enable-cleartext-pluginを追加します:

mysql -utom -P8030 -h127.0.0.1 -p --default-auth mysql_clear_password --enable-cleartext-plugin
  • JDBC

JDBCのデフォルトのMysqlClearPasswordPluginではSSLトランスポートが必要ですので、カスタムのプラグインが必要です。

public class MysqlClearPasswordPluginWithoutSSL extends MysqlClearPasswordPlugin {
@Override
public boolean requiresConfidentiality() {
return false;
}
}

接続後、カスタムのプラグインをプロパティに設定します。

...
Properties properties = new Properties();// replace xxx.xxx.xxx to your pacakage name
properties.put("authenticationPlugins", "xxx.xxx.xxx.MysqlClearPasswordPluginWithoutSSL");
properties.put("defaultAuthenticationPlugin", "xxx.xxx.xxx.MysqlClearPasswordPluginWithoutSSL");
properties.put("disabledAuthenticationPlugins", "com.mysql.jdbc.authentication.MysqlNativePasswordPlugin");DriverManager.getConnection(url, properties);
  • ODBC

ODBCのDSNにdefault\_auth=mysql_clear_passwordENABLE_CLEARTEXT\_PLUGIN=1を追加します。ユーザー名とパスワードも指定します。