Fix client IP when connected via SSH

This commit is contained in:
Bryan Ashby 2017-02-18 09:37:22 -07:00
parent 27991ec3a0
commit 701f3c9728
3 changed files with 6 additions and 9 deletions

View File

@ -457,10 +457,6 @@ Client.prototype.waitForKeyPress = function(cb) {
});
};
Client.prototype.address = function() {
return this.input.address();
};
Client.prototype.isLocal = function() {
// :TODO: return rather client is a local connection or not
return false;

View File

@ -57,13 +57,14 @@ function getActiveNodeList(authUsersOnly) {
function addNewClient(client, clientSock) {
const id = client.session.id = clientConnections.push(client) - 1;
const remoteAddress = client.remoteAddress = clientSock.remoteAddress;
// Create a client specific logger
// Note that this will be updated @ login with additional information
client.log = logger.log.child( { clientId : id } );
const connInfo = {
ip : clientSock.remoteAddress,
remoteAddress : remoteAddress,
serverName : client.session.serverName,
isSecure : client.session.isSecure,
};

View File

@ -91,7 +91,7 @@ function getPredefinedMCIValue(client, code) {
UT : function themeId() { return userStatAsString(client, 'theme_id', ''); },
UC : function loginCount() { return userStatAsString(client, 'login_count', 0); },
ND : function connectedNode() { return client.node.toString(); },
IP : function clientIpAddress() { return client.address().address; },
IP : function clientIpAddress() { return client.remoteAddress; },
ST : function serverName() { return client.session.serverName; },
FN : function activeFileBaseFilterName() {
const activeFilter = FileBaseFilters.getActiveFilter(client);