@@ -32,8 +32,8 @@ public class Orchestrator : IRequestHandler<PamEventRequest, bool>
32
32
33
33
private readonly ILogger < Orchestrator > _logger ;
34
34
private readonly IOptionsMonitor < SftpConfiguration > _sftpOptionsMonitor ;
35
- private Process _serverProcess ;
36
35
private SftpConfiguration _config ;
36
+ private Process _serverProcess ;
37
37
38
38
public Orchestrator ( ILogger < Orchestrator > logger , IOptionsMonitor < SftpConfiguration > sftpOptionsMonitor )
39
39
{
@@ -129,6 +129,7 @@ private Task PrepareAndValidateConfiguration()
129
129
config . Global ??= new GlobalConfiguration ( ) ;
130
130
131
131
config . Global . Directories ??= new List < string > ( ) ;
132
+ config . Global . Logging ??= new LoggingDefinition ( ) ;
132
133
config . Global . Chroot ??= new ChrootDefinition ( ) ;
133
134
if ( string . IsNullOrWhiteSpace ( config . Global . Chroot . Directory ) ) config . Global . Chroot . Directory = "%h" ;
134
135
if ( string . IsNullOrWhiteSpace ( config . Global . Chroot . StartPath ) ) config . Global . Chroot . StartPath = null ;
@@ -218,7 +219,7 @@ private async Task ConfigureOpenSSH()
218
219
builder . AppendLine ( ) ;
219
220
builder . AppendLine ( ) ;
220
221
builder . AppendLine ( "# Match all users" ) ;
221
- builder . Append ( $ "Match User \" *") ;
222
+ builder . Append ( "Match User \" *" ) ;
222
223
if ( _config . Users . Any ( s => s . Chroot != null ) )
223
224
{
224
225
var exceptionUsers = _config . Users
@@ -229,6 +230,7 @@ private async Task ConfigureOpenSSH()
229
230
builder . Append ( "," ) ;
230
231
builder . Append ( exceptionList ) ;
231
232
}
233
+
232
234
builder . Append ( "\" " ) ;
233
235
234
236
@@ -297,7 +299,6 @@ private async Task SyncUsersAndGroups()
297
299
await GroupUtil . GroupAddUser ( SftpUserInventoryGroup , user . Username ) ;
298
300
}
299
301
300
-
301
302
302
303
_logger . LogDebug ( "Updating the password for user '{user}'" , user . Username ) ;
303
304
await UserUtil . UserSetPassword ( user . Username , user . Password , user . PasswordIsEncrypted ) ;
@@ -332,7 +333,7 @@ private async Task PrepareUserForSftp(string username)
332
333
{
333
334
Username = username ,
334
335
Chroot = _config . Global . Chroot ,
335
- Directories = _config . Global . Directories ,
336
+ Directories = _config . Global . Directories
336
337
} ;
337
338
338
339
var homeDirPath = Path . Combine ( HomeBasePath , username ) ;
@@ -414,6 +415,9 @@ private async Task StartOpenSSH()
414
415
415
416
private void OnSSHOutput ( object sender , DataReceivedEventArgs e )
416
417
{
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 ;
417
421
_logger . LogTrace ( $ "sshd - { e . Data } ") ;
418
422
}
419
423
}
0 commit comments