Class SaslDataTransferClient
java.lang.Object
org.apache.hadoop.hdfs.protocol.datatransfer.sasl.SaslDataTransferClient
Negotiates SASL for DataTransferProtocol on behalf of a client. There are
two possible supported variants of SASL negotiation: either a general-purpose
negotiation supporting any quality of protection, or a specialized
negotiation that enforces privacy as the quality of protection using a
cryptographically strong encryption key.
This class is used in both the HDFS client and the DataNode. The DataNode
needs it, because it acts as a client to other DataNodes during write
pipelines and block transfers.
-
Constructor Summary
ConstructorsConstructorDescriptionSaslDataTransferClient(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.SaslPropertiesResolver saslPropsResolver, TrustedChannelResolver trustedChannelResolver) Creates a new SaslDataTransferClient.SaslDataTransferClient(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.SaslPropertiesResolver saslPropsResolver, TrustedChannelResolver trustedChannelResolver, AtomicBoolean fallbackToSimpleAuth) Creates a new SaslDataTransferClient. -
Method Summary
Modifier and TypeMethodDescriptionnewSocketSend(Socket socket, OutputStream underlyingOut, InputStream underlyingIn, DataEncryptionKeyFactory encryptionKeyFactory, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId) Sends client SASL negotiation for a newly allocated socket if required.peerSend(Peer peer, DataEncryptionKeyFactory encryptionKeyFactory, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId) Sends client SASL negotiation for a peer if required.socketSend(Socket socket, OutputStream underlyingOut, InputStream underlyingIn, DataEncryptionKeyFactory encryptionKeyFactory, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId) Sends client SASL negotiation for a socket if required.socketSend(Socket socket, OutputStream underlyingOut, InputStream underlyingIn, DataEncryptionKeyFactory encryptionKeyFactory, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId, SecretKey secretKey)
-
Constructor Details
-
SaslDataTransferClient
public SaslDataTransferClient(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.SaslPropertiesResolver saslPropsResolver, TrustedChannelResolver trustedChannelResolver) Creates a new SaslDataTransferClient. This constructor is used in cases where it is not relevant to track if a secure client did a fallback to simple auth. For intra-cluster connections between data nodes in the same cluster, we can assume that all run under the same security configuration.- Parameters:
conf- the configurationsaslPropsResolver- for determining properties of SASL negotiationtrustedChannelResolver- for identifying trusted connections that do not require SASL negotiation
-
SaslDataTransferClient
public SaslDataTransferClient(org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.security.SaslPropertiesResolver saslPropsResolver, TrustedChannelResolver trustedChannelResolver, AtomicBoolean fallbackToSimpleAuth) Creates a new SaslDataTransferClient.- Parameters:
conf- the configurationsaslPropsResolver- for determining properties of SASL negotiationtrustedChannelResolver- for identifying trusted connections that do not require SASL negotiationfallbackToSimpleAuth- checked on each attempt at general SASL handshake, if true forces use of simple auth
-
-
Method Details
-
newSocketSend
public IOStreamPair newSocketSend(Socket socket, OutputStream underlyingOut, InputStream underlyingIn, DataEncryptionKeyFactory encryptionKeyFactory, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId) throws IOException Sends client SASL negotiation for a newly allocated socket if required.- Parameters:
socket- connection socketunderlyingOut- connection output streamunderlyingIn- connection input streamencryptionKeyFactory- for creation of an encryption keyaccessToken- connection block access tokendatanodeId- ID of destination DataNode- Returns:
- new pair of streams, wrapped after SASL negotiation
- Throws:
IOException- for any error
-
peerSend
public Peer peerSend(Peer peer, DataEncryptionKeyFactory encryptionKeyFactory, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId) throws IOException Sends client SASL negotiation for a peer if required.- Parameters:
peer- connection peerencryptionKeyFactory- for creation of an encryption keyaccessToken- connection block access tokendatanodeId- ID of destination DataNode- Returns:
- new pair of streams, wrapped after SASL negotiation
- Throws:
IOException- for any error
-
socketSend
public IOStreamPair socketSend(Socket socket, OutputStream underlyingOut, InputStream underlyingIn, DataEncryptionKeyFactory encryptionKeyFactory, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId) throws IOException Sends client SASL negotiation for a socket if required.- Parameters:
socket- connection socketunderlyingOut- connection output streamunderlyingIn- connection input streamencryptionKeyFactory- for creation of an encryption keyaccessToken- connection block access tokendatanodeId- ID of destination DataNode- Returns:
- new pair of streams, wrapped after SASL negotiation
- Throws:
IOException- for any error
-
socketSend
public IOStreamPair socketSend(Socket socket, OutputStream underlyingOut, InputStream underlyingIn, DataEncryptionKeyFactory encryptionKeyFactory, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> accessToken, DatanodeID datanodeId, SecretKey secretKey) throws IOException - Throws:
IOException
-
getTargetQOP
-