Log IPs
This commit is contained in:
parent
c4518c7b94
commit
8c92f3cc49
|
@ -166,12 +166,19 @@ class NNTPServer extends NNTPServerBase {
|
||||||
return super._needAuth(session, command);
|
return super._needAuth(session, command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_address(session) {
|
||||||
|
const addr = session.in_stream.remoteAddress;
|
||||||
|
return addr ? addr.replace(/^::ffff:/, '').replace(/^::1$/, 'localhost') : 'N/A';
|
||||||
|
}
|
||||||
|
|
||||||
_authenticate(session) {
|
_authenticate(session) {
|
||||||
const username = session.authinfo_user;
|
const username = session.authinfo_user;
|
||||||
const password = session.authinfo_pass;
|
const password = session.authinfo_pass;
|
||||||
|
|
||||||
// :TODO: log IP address on these....
|
this.log.debug(
|
||||||
this.log.debug({ username }, `NNTP authentication request for "${username}"`);
|
{ username, ip: this._address(session) },
|
||||||
|
`NNTP authentication request for "${username}"`
|
||||||
|
);
|
||||||
|
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const user = new User();
|
const user = new User();
|
||||||
|
@ -180,7 +187,7 @@ class NNTPServer extends NNTPServerBase {
|
||||||
err => {
|
err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
this.log.warn(
|
this.log.warn(
|
||||||
{ username, reason: err.message },
|
{ username, reason: err.message, ip: this._address(session) },
|
||||||
`NNTP authentication failure for "${username}"`
|
`NNTP authentication failure for "${username}"`
|
||||||
);
|
);
|
||||||
return resolve(false);
|
return resolve(false);
|
||||||
|
@ -189,7 +196,7 @@ class NNTPServer extends NNTPServerBase {
|
||||||
session.authUser = user;
|
session.authUser = user;
|
||||||
|
|
||||||
this.log.info(
|
this.log.info(
|
||||||
{ username },
|
{ username, ip: this._address(session) },
|
||||||
`NTTP authentication success for "${username}"`
|
`NTTP authentication success for "${username}"`
|
||||||
);
|
);
|
||||||
return resolve(true);
|
return resolve(true);
|
||||||
|
@ -436,7 +443,7 @@ class NNTPServer extends NNTPServerBase {
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
this.log.info(
|
this.log.info(
|
||||||
{ messageUuid, messageId },
|
{ messageUuid, messageId, ip: this._address(session) },
|
||||||
'Access denied for message'
|
'Access denied for message'
|
||||||
);
|
);
|
||||||
return resolve(null);
|
return resolve(null);
|
||||||
|
|
Loading…
Reference in New Issue