Skip to content

Commit

Permalink
TEZ-4389: TestSecureShuffle fails if localhost name is different than…
Browse files Browse the repository at this point in the history
… "localhost" (#191) (Mark Bathori reviewed by Laszlo Bodor)
  • Loading branch information
mark-bathori authored Feb 18, 2022
1 parent f62bf12 commit a495fb6
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,15 @@ public static X509Certificate generateCertificate(String dn, KeyPair pair, int d
KeyPair keyPair = pair;
X509V3CertificateGenerator certGen = new X509V3CertificateGenerator();

String hostName = InetAddress.getLocalHost().getHostName();
String hostAddress = InetAddress.getLocalHost().getHostAddress();
certGen.addExtension(X509Extensions.SubjectAlternativeName, false,
new GeneralNames(new GeneralName[] { new GeneralName(GeneralName.iPAddress, hostAddress),
new GeneralName(GeneralName.dNSName, "localhost") }));
new GeneralNames(new GeneralName[] {
new GeneralName(GeneralName.iPAddress, hostAddress),
new GeneralName(GeneralName.dNSName, hostName),
new GeneralName(GeneralName.dNSName, "localhost")
})
);
X500Principal dnName = new X500Principal(dn);

certGen.setSerialNumber(sn);
Expand Down

0 comments on commit a495fb6

Please sign in to comment.