Authentication and Encryption

Security Authentication

Flink uses the following three authentication modes:

Encrypted Transmission

Flink uses following encrypted transmission modes:

Configuration about SSL encrypted transmission is mandatory while configuration about encryption of Yarn and Hadoop is not required.

To configure SSL encrypted transmission, configure the following parameters in the flink-conf.yaml file on the client:

  1. Enable SSL and configure the SSL encryption algorithm. see Table 2. Modify the parameters as required.
    Table 2 Parameter description

    Parameter

    Example Value

    Description

    security.ssl.enabled

    true

    Enable SSL.

    akka.ssl.enabled

    true

    Enable Akka SSL.

    blob.service.ssl.enabled

    true

    Enable SSL for the Blob channel.

    taskmanager.data.ssl.enabled

    true

    Enable SSL transmissions between TaskManagers.

    security.ssl.algorithms

    TLS_DHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_DHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384

    Configure the SSL encryption algorithm.

    Enabling SSL for data transmission between TaskManagers may pose great impact on the system performance.

  2. Generate the generate_keystore.sh script by referring to Example of Issuing a Certificate and place it in the bin directory of the Flink client. In the bin directory of the Flink client, run the sh generate_keystore.sh <password> command. For details, see Authentication and Encryption. The configuration items in Table 3 are set by default. You can also configure them manually.
    Table 3 Parameter description

    Parameter

    Example Value

    Description

    security.ssl.keystore

    ${path}/flink.keystore

    Path for storing the keystore. flink.keystore indicates the name of the keystore file generated by the generate_keystore.sh* tool.

    security.ssl.keystore-password

    123456

    Password of the keystore. 123456 indicates a user-defined password is required.

    security.ssl.key-password

    123456

    Password of the SSL key. 123456 indicates a user-defined password is required.

    security.ssl.truststore

    ${path}/flink.truststore

    Path for storing the truststore. flink.truststore indicates the name of the truststore file generated by the generate_keystore.sh* tool.

    security.ssl.truststore-password

    123456

    Password of the truststore. 123456 indicates a user-defined password is required.

    The path directory is a user-defined directory for storing configuration files of the SSL keystore and truststore. The commands vary according to the relative path and absolute path. For details, see 3 and 4.

  3. If the keystore or truststore file path is a relative path, the Flink client directory where the command is executed needs to access this relative path directly. Either of the following method can be used to transmit the keystore and truststore file:
    • Add -t option to the CLI yarn-session.sh command to transfer the keystore and truststore file to execution nodes. Example:
      ./bin/yarn-session.sh -t ssl/
    • Add -yt option to the flink run command to transfer the keystore and truststore file to execution nodes. Example:
      ./bin/flink run -yt ssl/ -ys 3  -m yarn-cluster -c org.apache.flink.examples.java.wordcount.WordCount /opt/client/Flink/flink/examples/batch/WordCount.jar
      • In the preceding example, ssl/ is the sub-directory of the Flink client directory. It is used to store configuration files of the SSL keystore and truststore.
      • The relative path of ssl/ must be accessible from the current path where the Flink client command is run.
  4. If the keystore or truststore file path is an absolute path, the keystore and truststore files must exist in the absolute path on Flink Client and all nodes.

    Either of the following methods can be used to execute applications. The -t or -yt option does not need to be added to transmit the keystore and truststore files.

    • Run the CLI yarn-session.sh command of Flink to execute applications. Example:
      ./bin/yarn-session.sh
    • Run the Flink run command to execute applications. Example:
      ./bin/flink run  -ys 3 -m yarn-cluster -c org.apache.flink.examples.java.wordcount.WordCount /opt/client/Flink/flink/examples/batch/WordCount.jar