File tree Expand file tree Collapse file tree 4 files changed +19
-4
lines changed
lib/cloud_controller/diego
spec/unit/lib/cloud_controller/diego Expand file tree Collapse file tree 4 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,8 @@ def app_lrp_arguments
61
61
routes [ SSH_ROUTES_KEY ] = Oj . dump ( {
62
62
container_port : DEFAULT_SSH_PORT ,
63
63
private_key : ssh_key . private_key ,
64
- host_fingerprint : ssh_key . fingerprint
64
+ host_fingerprint : ssh_key . fingerprint ,
65
+ host_256_fingerprint : ssh_key . sha256_fingerprint
65
66
} )
66
67
end
67
68
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ def fingerprint
26
26
@fingerprint ||= ::SSHKey . new ( key . to_der ) . sha1_fingerprint
27
27
end
28
28
29
+ def sha256_fingerprint
30
+ @sha256_fingerprint ||= ::SSHKey . new ( key . to_der ) . sha256_fingerprint
31
+ end
32
+
29
33
private
30
34
31
35
def key
Original file line number Diff line number Diff line change @@ -934,7 +934,8 @@ module Diego
934
934
expect ( lrp . routes . routes [ 'diego-ssh' ] ) . to eq ( Oj . dump ( {
935
935
container_port : 2222 ,
936
936
private_key : ssh_key . private_key ,
937
- host_fingerprint : ssh_key . fingerprint
937
+ host_fingerprint : ssh_key . fingerprint ,
938
+ host_256_fingerprint : ssh_key . sha256_fingerprint
938
939
} ) )
939
940
end
940
941
end
@@ -1037,7 +1038,8 @@ module Diego
1037
1038
expect ( lrp . routes . routes [ 'diego-ssh' ] ) . to eq ( Oj . dump ( {
1038
1039
container_port : 2222 ,
1039
1040
private_key : ssh_key . private_key ,
1040
- host_fingerprint : ssh_key . fingerprint
1041
+ host_fingerprint : ssh_key . fingerprint ,
1042
+ host_256_fingerprint : ssh_key . sha256_fingerprint
1041
1043
} ) )
1042
1044
end
1043
1045
end
@@ -1383,7 +1385,8 @@ module Diego
1383
1385
expect ( lrp . routes . routes [ 'diego-ssh' ] ) . to eq ( Oj . dump ( {
1384
1386
container_port : 2222 ,
1385
1387
private_key : ssh_key . private_key ,
1386
- host_fingerprint : ssh_key . fingerprint
1388
+ host_fingerprint : ssh_key . fingerprint ,
1389
+ host_256_fingerprint : ssh_key . sha256_fingerprint
1387
1390
} ) )
1388
1391
end
1389
1392
end
Original file line number Diff line number Diff line change @@ -39,6 +39,13 @@ module Diego
39
39
expect ( ssh_key . fingerprint ) . to match ( /([0-9a-f]{2}:){19}[0-9a-f]{2}/ )
40
40
end
41
41
end
42
+
43
+ describe '#fingerprint 256' do
44
+ it 'returns an sha256 fingerprint' do
45
+ ssh_key = SSHKey . new ( 1024 )
46
+ expect ( ssh_key . sha256_fingerprint ) . to match ( %r{[a-zA-Z0-9+/=]{44}} )
47
+ end
48
+ end
42
49
end
43
50
end
44
51
end
You can’t perform that action at this time.
0 commit comments