File tree 6 files changed +244
-93
lines changed
minidfs/src/main/java/main
6 files changed +244
-93
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,10 @@ public static void main(String args[]) throws Exception {
57
57
conf .set (HADOOP_RPC_PROTECTION , "privacy" );
58
58
conf .set (DFS_DATA_TRANSFER_PROTECTION_KEY , "privacy" );
59
59
if (flags .contains ("data_transfer_encryption" )) {
60
+ // Force encryption for all connections
60
61
conf .set (DFSConfigKeys .DFS_ENCRYPT_DATA_TRANSFER_KEY , "true" );
62
+ }
63
+ if (flags .contains ("aes" )) {
61
64
conf .set (DFS_ENCRYPT_DATA_TRANSFER_CIPHER_SUITES_KEY , "AES/CTR/NoPadding" );
62
65
}
63
66
} else if (flags .contains ("integrity" )) {
Original file line number Diff line number Diff line change @@ -550,12 +550,9 @@ impl DatanodeConnection {
550
550
. await ?;
551
551
self . writer . flush ( ) . await ?;
552
552
553
- let msg_length = self . reader . read_length_delimiter ( ) . await ?;
553
+ let message = self . reader . read_proto ( ) . await ?;
554
554
555
- let mut response_buf = BytesMut :: zeroed ( msg_length) ;
556
- self . reader . read_exact ( & mut response_buf) . await ?;
557
-
558
- let response = hdfs:: BlockOpResponseProto :: decode ( response_buf. freeze ( ) ) ?;
555
+ let response = hdfs:: BlockOpResponseProto :: decode ( message) ?;
559
556
Ok ( response)
560
557
}
561
558
@@ -630,12 +627,9 @@ pub(crate) struct DatanodeReader {
630
627
631
628
impl DatanodeReader {
632
629
pub ( crate ) async fn read_ack ( & mut self ) -> Result < hdfs:: PipelineAckProto > {
633
- let ack_length = self . reader . read_length_delimiter ( ) . await ?;
634
-
635
- let mut response_buf = BytesMut :: zeroed ( ack_length) ;
636
- self . reader . read_exact ( & mut response_buf) . await ?;
630
+ let message = self . reader . read_proto ( ) . await ?;
637
631
638
- let response = hdfs:: PipelineAckProto :: decode ( response_buf . freeze ( ) ) ?;
632
+ let response = hdfs:: PipelineAckProto :: decode ( message ) ?;
639
633
Ok ( response)
640
634
}
641
635
}
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ pub enum DfsFeatures {
13
13
Token ,
14
14
Integrity ,
15
15
Privacy ,
16
+ AES ,
16
17
HA ,
17
18
ViewFS ,
18
19
EC ,
@@ -28,6 +29,7 @@ impl DfsFeatures {
28
29
DfsFeatures :: Privacy => "privacy" ,
29
30
DfsFeatures :: Security => "security" ,
30
31
DfsFeatures :: Integrity => "integrity" ,
32
+ DfsFeatures :: AES => "aes" ,
31
33
DfsFeatures :: Token => "token" ,
32
34
DfsFeatures :: RBF => "rbf" ,
33
35
}
Original file line number Diff line number Diff line change @@ -357,6 +357,14 @@ impl DigestSaslSession {
357
357
server : kis,
358
358
}
359
359
}
360
+
361
+ pub ( crate ) fn supports_encryption ( & self ) -> bool {
362
+ match & self . state {
363
+ DigestState :: Stepped ( ctx) => matches ! ( ctx. qop, Qop :: AuthConf ) ,
364
+ DigestState :: Completed ( ctx) => ctx. as_ref ( ) . is_some_and ( |c| c. encryptor . is_some ( ) ) ,
365
+ _ => false ,
366
+ }
367
+ }
360
368
}
361
369
362
370
impl SaslSession for DigestSaslSession {
You can’t perform that action at this time.
0 commit comments