File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ private Task UpdateConfiguration()
6868 config . Global . Directories ??= new List < string > ( ) ;
6969 config . Global . Logging ??= new LoggingDefinition ( ) ;
7070 config . Global . Chroot ??= new ChrootDefinition ( ) ;
71+ config . Global . PKIandPassword ??= new string ( "" ) ;
7172 config . Global . HostKeys ??= new HostKeysDefinition ( ) ;
7273 config . Global . Hooks ??= new HooksDefinition ( ) ;
7374
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ public class GlobalConfiguration
77 public LoggingDefinition Logging { get ; set ; } = new ( ) ;
88 public HostKeysDefinition HostKeys { get ; set ; } = new ( ) ;
99 public HooksDefinition Hooks { get ; set ; } = new ( ) ;
10+ public string PKIandPassword { get ; set ; }
1011
1112 public string Ciphers { get ; set ; }
1213 public string HostKeyAlgorithms { get ; set ; }
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ public class SSHConfiguration
1212 public string HostKeyAlgorithms { get ; set ; }
1313 public string KexAlgorithms { get ; set ; }
1414 public string MACs { get ; set ; }
15+ public string PKIandPassword { get ; set ; }
1516
1617 public override string ToString ( )
1718 {
@@ -44,6 +45,8 @@ public override string ToString()
4445 builder . AppendLine ( "# Allowed users" ) ;
4546 builder . AppendLine ( $ "AllowUsers { string . Join ( " " , AllowUsers ) } ") ;
4647 builder . AppendLine ( ) ;
48+ if ( PKIandPassword == "true" ) builder . AppendLine ( "AuthenticationMethods \" publickey,password\" " ) ;
49+ builder . AppendLine ( ) ;
4750 builder . AppendLine ( "# Match blocks" ) ;
4851 foreach ( var matchBlock in MatchBlocks )
4952 {
Original file line number Diff line number Diff line change @@ -64,7 +64,8 @@ private async Task UpdateConfiguration()
6464 Ciphers = sftpConfig . Global . Ciphers ,
6565 HostKeyAlgorithms = sftpConfig . Global . HostKeyAlgorithms ,
6666 KexAlgorithms = sftpConfig . Global . KexAlgorithms ,
67- MACs = sftpConfig . Global . MACs
67+ MACs = sftpConfig . Global . MACs ,
68+ PKIandPassword = sftpConfig . Global . PKIandPassword
6869 } ;
6970
7071 var exceptionalUsers = sftpConfig . Users . Where ( s => s . Chroot != null ) . ToList ( ) ;
You can’t perform that action at this time.
0 commit comments