1313using Keyfactor . Orchestrators . Common . Enums ;
1414
1515using Microsoft . Extensions . Logging ;
16+ using static Keyfactor . PKI . PKIConstants . X509 ;
1617
1718namespace Keyfactor . Extensions . Orchestrator . RemoteFile
1819{
@@ -47,9 +48,22 @@ public JobResult ProcessJobToDo(ReenrollmentJobConfiguration config, SubmitReenr
4748 {
4849 SetJobProperties ( config , config . CertificateStoreDetails , logger ) ;
4950
50- string alias = config . ;
51- string sans = "reenroll2.Keyfactor.com&reenroll1.keyfactor.com&reenroll3.Keyfactor.com" ;
52- bool overwrite = true ;
51+ bool overwrite = config . Overwrite ;
52+ string alias = config . Alias ;
53+ string sans = "" ;
54+ if ( config . SANs . Count > 0 )
55+ {
56+ foreach ( KeyValuePair < string , string [ ] > keyValue in config . SANs )
57+ {
58+ string key = keyValue . Key . Replace ( "ip4" , "ip" , StringComparison . OrdinalIgnoreCase ) . Replace ( "ip6" , "ip" , StringComparison . OrdinalIgnoreCase ) . Replace ( "upn" , "uri" , StringComparison . OrdinalIgnoreCase ) ;
59+ foreach ( string value in keyValue . Value )
60+ {
61+ sans += ( key + ":" + value + "," ) ;
62+ }
63+ }
64+ if ( sans . Length > 0 )
65+ sans = sans . Substring ( 0 , sans . Length - 1 ) ;
66+ }
5367
5468 // validate parameters
5569 string KeyTypes = string . Join ( "," , Enum . GetNames ( typeof ( SupportedKeyTypeEnum ) ) ) ;
@@ -58,9 +72,7 @@ public JobResult ProcessJobToDo(ReenrollmentJobConfiguration config, SubmitReenr
5872 throw new RemoteFileException ( $ "Unsupported KeyType value { KeyType } . Supported types are { KeyTypes } .") ;
5973 }
6074
61- ApplicationSettings . FileTransferProtocolEnum fileTransferProtocol = ApplicationSettings . FileTransferProtocol ;
62-
63- certificateStore = new RemoteCertificateStore ( config . CertificateStoreDetails . ClientMachine , UserName , UserPassword , config . CertificateStoreDetails . StorePath , StorePassword , fileTransferProtocol , SSHPort , IncludePortInSPN ) ;
75+ certificateStore = new RemoteCertificateStore ( config . CertificateStoreDetails . ClientMachine , UserName , UserPassword , config . CertificateStoreDetails . StorePath , StorePassword , SSHPort , IncludePortInSPN ) ;
6476 certificateStore . Initialize ( SudoImpersonatedUser , UseShellCommands ) ;
6577
6678 PathFile storePathFile = RemoteCertificateStore . SplitStorePathFile ( config . CertificateStoreDetails . StorePath ) ;
0 commit comments