Fixed IP-Hashing and Alt Detection behind Reverse Proxies
This commit is contained in:
parent
46a7e9e067
commit
8b6aa69c51
7 changed files with 42 additions and 10 deletions
|
|
@ -14,6 +14,9 @@ GNU Affero General Public License for more details.
|
|||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
||||
|
||||
//Config
|
||||
const config = require('../../../config.json');
|
||||
|
||||
//Local Imports
|
||||
const channelModel = require('../../schemas/channel/channelSchema');
|
||||
const emoteModel = require('../../schemas/emoteSchema');
|
||||
|
|
@ -90,8 +93,11 @@ module.exports = class{
|
|||
}
|
||||
|
||||
async validateSocket(socket){
|
||||
//If we're proxied use passthrough IP
|
||||
const ip = config.proxied ? socket.handshake.headers['x-forwarded-for'] : socket.handshake.address;
|
||||
|
||||
//Look for ban by IP
|
||||
const ipBanDB = await userBanModel.checkBanByIP(socket.handshake.address);
|
||||
const ipBanDB = await userBanModel.checkBanByIP(ip);
|
||||
|
||||
//If this ip is randy bobandy
|
||||
if(ipBanDB != null){
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ You should have received a copy of the GNU Affero General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.*/
|
||||
|
||||
//local imports
|
||||
const config = require('../../../config.json');
|
||||
const channelModel = require('../../schemas/channel/channelSchema');
|
||||
const permissionModel = require('../../schemas/permissionSchema');
|
||||
const flairModel = require('../../schemas/flairSchema');
|
||||
|
|
@ -58,8 +59,14 @@ module.exports = class{
|
|||
//Send out the currently playing item
|
||||
this.channel.queue.sendMedia(socket);
|
||||
|
||||
//Tattoo hashed IP address to user account for seven days
|
||||
await userDB.tattooIPRecord(socket.handshake.address);
|
||||
//If we're proxied
|
||||
if(config.proxied){
|
||||
//Tattoo hashed IP address from reverse proxy to user account for seven days
|
||||
await userDB.tattooIPRecord(socket.handshake.headers['x-forwarded-for']);
|
||||
}else{
|
||||
//Tattoo hashed IP address to user account for seven days
|
||||
await userDB.tattooIPRecord(socket.handshake.address);
|
||||
}
|
||||
}
|
||||
|
||||
socketCrawl(cb){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue