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() { Client.prototype.isLocal = function() {
// :TODO: return rather client is a local connection or not // :TODO: return rather client is a local connection or not
return false; return false;

View File

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

View File

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