@@ -32,8 +32,8 @@ public class Orchestrator : IRequestHandler<PamEventRequest, bool>
3232
3333 private readonly ILogger < Orchestrator > _logger ;
3434 private readonly IOptionsMonitor < SftpConfiguration > _sftpOptionsMonitor ;
35- private Process _serverProcess ;
3635 private SftpConfiguration _config ;
36+ private Process _serverProcess ;
3737
3838 public Orchestrator ( ILogger < Orchestrator > logger , IOptionsMonitor < SftpConfiguration > sftpOptionsMonitor )
3939 {
@@ -129,6 +129,7 @@ private Task PrepareAndValidateConfiguration()
129129 config . Global ??= new GlobalConfiguration ( ) ;
130130
131131 config . Global . Directories ??= new List < string > ( ) ;
132+ config . Global . Logging ??= new LoggingDefinition ( ) ;
132133 config . Global . Chroot ??= new ChrootDefinition ( ) ;
133134 if ( string . IsNullOrWhiteSpace ( config . Global . Chroot . Directory ) ) config . Global . Chroot . Directory = "%h" ;
134135 if ( string . IsNullOrWhiteSpace ( config . Global . Chroot . StartPath ) ) config . Global . Chroot . StartPath = null ;
@@ -218,7 +219,7 @@ private async Task ConfigureOpenSSH()
218219 builder . AppendLine ( ) ;
219220 builder . AppendLine ( ) ;
220221 builder . AppendLine ( "# Match all users" ) ;
221- builder . Append ( $ "Match User \" *") ;
222+ builder . Append ( "Match User \" *" ) ;
222223 if ( _config . Users . Any ( s => s . Chroot != null ) )
223224 {
224225 var exceptionUsers = _config . Users
@@ -229,6 +230,7 @@ private async Task ConfigureOpenSSH()
229230 builder . Append ( "," ) ;
230231 builder . Append ( exceptionList ) ;
231232 }
233+
232234 builder . Append ( "\" " ) ;
233235
234236
@@ -297,7 +299,6 @@ private async Task SyncUsersAndGroups()
297299 await GroupUtil . GroupAddUser ( SftpUserInventoryGroup , user . Username ) ;
298300 }
299301
300-
301302
302303 _logger . LogDebug ( "Updating the password for user '{user}'" , user . Username ) ;
303304 await UserUtil . UserSetPassword ( user . Username , user . Password , user . PasswordIsEncrypted ) ;
@@ -332,7 +333,7 @@ private async Task PrepareUserForSftp(string username)
332333 {
333334 Username = username ,
334335 Chroot = _config . Global . Chroot ,
335- Directories = _config . Global . Directories ,
336+ Directories = _config . Global . Directories
336337 } ;
337338
338339 var homeDirPath = Path . Combine ( HomeBasePath , username ) ;
@@ -414,6 +415,9 @@ private async Task StartOpenSSH()
414415
415416 private void OnSSHOutput ( object sender , DataReceivedEventArgs e )
416417 {
418+ if ( string . IsNullOrWhiteSpace ( e . Data ) ) return ;
419+ if ( _config . Global . Logging . IgnoreNoIdentificationString &&
420+ e . Data . Trim ( ) . StartsWith ( "Did not receive identification string from" ) ) return ;
417421 _logger . LogTrace ( $ "sshd - { e . Data } ") ;
418422 }
419423 }
0 commit comments