Some logging cleanup
This commit is contained in:
parent
18420fd7a7
commit
bd28de9a69
|
@ -144,7 +144,7 @@ exports.getModule = class TransferFileModule extends MenuModule {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.client.log.info( { sentFiles : sentFiles }, `Successfully sent ${sentFiles.length} file(s)` );
|
this.client.log.info( { sentFiles : sentFiles }, `User "${self.client.user.username}" uploaded ${sentFiles.length} file(s)` );
|
||||||
}
|
}
|
||||||
return cb(err);
|
return cb(err);
|
||||||
});
|
});
|
||||||
|
|
|
@ -50,7 +50,7 @@ exports.getModule = class AreaPostFSEModule extends FullScreenEditorModule {
|
||||||
// note: not logging 'from' here as it's part of client.log.xxxx()
|
// note: not logging 'from' here as it's part of client.log.xxxx()
|
||||||
self.client.log.info(
|
self.client.log.info(
|
||||||
{ to : msg.toUserName, subject : msg.subject, uuid : msg.messageUuid },
|
{ to : msg.toUserName, subject : msg.subject, uuid : msg.messageUuid },
|
||||||
'Message persisted'
|
`User "${self.client.user.username}" posted message to "${msg.toUserName}" (${msg.areaTag})`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,7 @@ exports.getModule = class NewUserAppModule extends MenuModule {
|
||||||
};
|
};
|
||||||
newUser.create(createUserInfo, err => {
|
newUser.create(createUserInfo, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
self.client.log.info( { error : err, username : formData.value.username }, 'New user creation failed');
|
self.client.log.warn( { error : err, username : formData.value.username }, 'New user creation failed');
|
||||||
|
|
||||||
self.gotoMenu(extraArgs.error, err => {
|
self.gotoMenu(extraArgs.error, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
|
@ -126,7 +126,7 @@ exports.getModule = class NewUserAppModule extends MenuModule {
|
||||||
return cb(null);
|
return cb(null);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
self.client.log.info( { username : formData.value.username, userId : newUser.userId }, 'New user created');
|
self.client.log.info( { username : formData.value.username, userId : newUser.userId }, `New user "${formData.value.username}" created`);
|
||||||
|
|
||||||
// Cache SysOp information now
|
// Cache SysOp information now
|
||||||
// :TODO: Similar to bbs.js. DRY
|
// :TODO: Similar to bbs.js. DRY
|
||||||
|
|
|
@ -215,7 +215,7 @@ exports.getModule = class TelnetBridgeModule extends MenuModule {
|
||||||
self.client.removeListener('key press', connectionKeyPressHandler);
|
self.client.removeListener('key press', connectionKeyPressHandler);
|
||||||
|
|
||||||
if(err) {
|
if(err) {
|
||||||
self.client.log.info(`Telnet bridge connection error: ${err.message}`);
|
self.client.log.warn(`Telnet bridge connection error: ${err.message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(clientTerminated ? new Error('Client connection terminated') : null);
|
callback(clientTerminated ? new Error('Client connection terminated') : null);
|
||||||
|
|
|
@ -128,17 +128,18 @@ exports.getModule = class UserConfigModule extends MenuModule {
|
||||||
// :TODO: warn end user!
|
// :TODO: warn end user!
|
||||||
return self.prevMenu(cb);
|
return self.prevMenu(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.client.log.info(`User "${self.client.user.username}" updated configuration`);
|
||||||
|
|
||||||
//
|
//
|
||||||
// New password if it's not empty
|
// New password if it's not empty
|
||||||
//
|
//
|
||||||
self.client.log.info('User updated properties');
|
|
||||||
|
|
||||||
if(formData.value.password.length > 0) {
|
if(formData.value.password.length > 0) {
|
||||||
self.client.user.setNewAuthCredentials(formData.value.password, err => {
|
self.client.user.setNewAuthCredentials(formData.value.password, err => {
|
||||||
if(err) {
|
if(err) {
|
||||||
self.client.log.error( { err : err }, 'Failed storing new authentication credentials');
|
self.client.log.error( { err : err }, 'Failed storing new authentication credentials');
|
||||||
} else {
|
} else {
|
||||||
self.client.log.info('User changed authentication credentials');
|
self.client.log.info(`User "${self.client.user.username}" updated authentication credentials`);
|
||||||
}
|
}
|
||||||
return self.prevMenu(cb);
|
return self.prevMenu(cb);
|
||||||
});
|
});
|
||||||
|
|
|
@ -45,7 +45,7 @@ function userLogin(client, username, password, options, cb) {
|
||||||
const config = Config();
|
const config = Config();
|
||||||
|
|
||||||
if(config.users.badUserNames.includes(username.toLowerCase())) {
|
if(config.users.badUserNames.includes(username.toLowerCase())) {
|
||||||
client.log.info( { username, ip : client.remoteAddress }, 'Attempt to login with banned username');
|
client.log.info( { username, ip : client.remoteAddress }, `Attempt to login with banned username "${username}"`);
|
||||||
|
|
||||||
// slow down a bit to thwart brute force attacks
|
// slow down a bit to thwart brute force attacks
|
||||||
return setTimeout( () => {
|
return setTimeout( () => {
|
||||||
|
@ -80,13 +80,13 @@ function userLogin(client, username, password, options, cb) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if(existingClientConnection) {
|
if(existingClientConnection) {
|
||||||
client.log.info(
|
client.log.warn(
|
||||||
{
|
{
|
||||||
existingNodeId : existingClientConnection.node,
|
existingNodeId : existingClientConnection.node,
|
||||||
username : user.username,
|
username : user.username,
|
||||||
userId : user.userId
|
userId : user.userId
|
||||||
},
|
},
|
||||||
`User ${user.username} already logged in`
|
`User "${user.username}" already logged in on node ${existingClientConnection.node}`
|
||||||
);
|
);
|
||||||
|
|
||||||
return cb(Errors.BadLogin(
|
return cb(Errors.BadLogin(
|
||||||
|
@ -104,7 +104,7 @@ function userLogin(client, username, password, options, cb) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
client.log.info(`User ${user.username} successfully logged in`);
|
client.log.info(`User "${user.username}" successfully logged in`);
|
||||||
|
|
||||||
// User's unique session identifier is the same as the connection itself
|
// User's unique session identifier is the same as the connection itself
|
||||||
user.sessionId = client.session.uniqueId; // convenience
|
user.sessionId = client.session.uniqueId; // convenience
|
||||||
|
@ -238,6 +238,6 @@ function transformLoginError(err, client, username) {
|
||||||
err = Errors.BadLogin('To many failed login attempts', ErrorReasons.TooMany);
|
err = Errors.BadLogin('To many failed login attempts', ErrorReasons.TooMany);
|
||||||
}
|
}
|
||||||
|
|
||||||
client.log.info( { username, ip : client.remoteAddress, reason : err.message }, 'Failed login attempt');
|
client.log.warn( { username, ip : client.remoteAddress, reason : err.message }, `Failed login attempt for user "${username}", ${client.remoteAddress}`);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
Loading…
Reference in New Issue