From fbe4e43c3d3487401cc4382bd6aa4da8b8aadaae Mon Sep 17 00:00:00 2001 From: Grant Woodford Date: Sat, 19 Oct 2013 21:37:11 +0200 Subject: [PATCH] Privacy: Add an option to disable IP logging --- settings.json.template | 3 +++ src/node/handler/PadMessageHandler.js | 10 ++++++++++ src/node/utils/Settings.js | 5 +++++ 3 files changed, 18 insertions(+) diff --git a/settings.json.template b/settings.json.template index 011c9e6e..50e7e9d4 100644 --- a/settings.json.template +++ b/settings.json.template @@ -82,6 +82,9 @@ /*when you use NginX or another proxy/ load-balancer set this to true*/ "trustProxy": false, + /* Privacy: disable IP logging */ + "disableIPlogging": false, + /* Users for basic authentication. is_admin = true gives access to /admin. If you do not uncomment this, /admin will not be available! */ /* diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index 6314351b..dbb0c195 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -130,6 +130,11 @@ exports.handleDisconnect = function(client) } client.get('remoteAddress', function(er, ip) { + //Anonymize the IP address if IP logging is disabled + if(settings.disableIPlogging) { + ip = 'ANONYMOUS'; + } + accessLogger.info('[LEAVE] Pad "'+session.padId+'": Author "'+session.author+'" on client '+client.id+' with IP "'+ip+'" left the pad') }) @@ -995,6 +1000,11 @@ function handleClientReady(client, message) //Log creation/(re-)entering of a pad client.get('remoteAddress', function(er, ip) { + //Anonymize the IP address if IP logging is disabled + if(settings.disableIPlogging) { + ip = 'ANONYMOUS'; + } + if(pad.head > 0) { accessLogger.info('[ENTER] Pad "'+padIds.padId+'": Client '+client.id+' with IP "'+ip+'" entered the pad'); } diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index 201938e0..2576aeab 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -109,6 +109,11 @@ exports.abiword = null; */ exports.loglevel = "INFO"; +/** + * Disable IP logging + */ +exports.disableIPlogging = false; + /* * log4js appender configuration */