Bug 7100 - forum logs should store user ip address, instead of proxy's
Summary: forum logs should store user ip address, instead of proxy's
Status: NEW
Alias: None
Product: Websites
Classification: Unclassified
Component: forums.mageia.org (show other bugs)
Version: trunk
Hardware: All Linux
Priority: High major
Target Milestone: ---
Assignee: Sysadmin Team
QA Contact:
URL:
Whiteboard:
Keywords: logs
Depends on:
Blocks:
 
Reported: 2012-08-18 13:28 CEST by Romain d'Alverny
Modified: 2020-09-19 18:09 CEST (History)
8 users (show)

See Also:
Source RPM:
CVE:
Status comment:


Attachments

Description Romain d'Alverny 2012-08-18 13:28:23 CEST
Currently, our phpbb setup is behind a reverse proxy. All users IP addresses logged in database are then the proxy IP (127.0.0.1 here). We need to fix this so that the user IP is logged instead.

Rationale: French law requires us to store for year access/action logs from users, and we need to have the correct IP address there.
Comment 1 Romain d'Alverny 2012-08-18 13:29:08 CEST
Two solutions so far:
 - package, install and use mod_rpaf
 - patch phpbb code to handle X-Forwarded-For header
Romain d'Alverny 2012-08-21 16:54:24 CEST

Assignee: mageia-webteam => sysadmin-bugs

Comment 2 Nicolas Vigier 2012-08-22 13:19:29 CEST
I'm not sure about mod rpaf after seeing this king of bug :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=683984

About phpbb patch, it's only a 2 lines changes to use X-Forwarded-For header for the IP. A little more if we add it as a configurable option in the admin panel, but that should be doable, and I think upstream would be interested by this patch.

CC: (none) => boklm

Nicolas Vigier 2013-09-21 17:04:23 CEST

Assignee: sysadmin-bugs => forums-bugs

Comment 3 Marja Van Waes 2013-10-27 21:34:33 CET
@ Thomas

Is my memory correct that it was decided many months ago that you'd be the sysadmin in charge of communicating with the forums admin? 

This bug was originally assigned to sysadmin team by rda. Later it was re-assigned to forums team. To the best of my knowledge, forums admin does not have enough rights to solve this, so asking for your help.

Can this bug be assigned to you, please?

CC: boklm => doktor5000, isis2000, maat-ml, marja11, tmb

claire robinson 2013-10-28 08:46:37 CET

CC: (none) => eeeemail

Comment 4 Marja Van Waes 2014-04-13 10:23:14 CEST
Assigning back to sysadmin team, because, to the very best of my knowledge, only sysadmin team can solve this.

@ rda

Should the status, for now, be changed to UNCONFIRMED, because of http://curia.europa.eu/jcms/upload/docs/application/pdf/2014-04/cp140054en.pdf
(Court of Justice of the European Union declares the Data Retention Directive to be invalid) ?

I don't have time to really dig into that, only read the headlines, so I have no real clue which impact that might have on French data-retention laws.

Assignee: forums-bugs => sysadmin-bugs

Comment 5 Pascal Terjan 2015-12-16 21:11:29 CET
This also prevents banning the IP of a user without banning everyone.

The code is in includes/session.php:

                // Why no forwarded_for et al? Well, too easily spoofed. With the results of my recent requests
                // it's pretty clear that in the majority of cases you'll at least be left with a proxy/cache ip.
                $this->ip = (!empty($_SERVER['REMOTE_ADDR'])) ? (string) $_SERVER['REMOTE_ADDR'] : '';
                $this->ip = preg_replace('# {2,}#', ' ', str_replace(',', ' ', $this->ip));

                // split the list of IPs
                $ips = explode(' ', trim($this->ip));

                // Default IP if REMOTE_ADDR is invalid
                $this->ip = '127.0.0.1';

In our case we could probably handle X-Forwarded-For but we should make sure we drop existing ones in the proxying apache.

CC: (none) => pterjan

Comment 6 Pascal Terjan 2015-12-17 00:29:10 CET
There is also https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html
Comment 7 Maat 2015-12-17 12:37:46 CET
Hello,

If we cant the best approach is to make our proxy transparent because sometimes users hide behind proxies we and they dont control (ISP proxies)

-> If we want to have a fully working IP ban system we need to access Both ORIGINAL FORWARDED-FOR and ORIGINAL IP

If the proxy is compromised we can ban it completely but if it's not that would be cool to be able to ban a user without hitting every nice users behind an ISP proxy

Cheers,
Comment 8 Pascal Terjan 2015-12-17 12:42:23 CET
You don't need to compromise a proxy.
It makes it useless if we allow X-Forwarded-For to be set by the user, which is why it is not supported by phpBB. You can set it to whatever you want without being behind a proxy and change it as much as you want.

For example https://addons.mozilla.org/en-GB/firefox/addon/x-forwarded-for-spoofer/ or https://addons.mozilla.org/en-gb/firefox/addon/x-forwarded-for-header/
Comment 9 Maat 2015-12-17 18:34:09 CET
Hi,

Sorry all, at second reading my point was not clear at all :-(

Same player tries shoot again:

If we have an incoming IP from a official ISP proxy the real IP for us is better taken in the FORWARDED-FOR header.

For those cases of header if we only get the proxy IP and ban a user we ban in the same time many clean users.

Same thing for big official proxies (Govs, big corps, ISP, universities...)

In the other end if we have an incoming connexion from xxxdynamic-adsl.some.isp or whatever IP in a big server farm (Big hosting companies from which everybody can rent a machine) we'd better not try to believe the FORWARDED-FOR headers and only get the ORIGINAL IP

The idea behind that requires to have a list of IP for proxies we can trust.

Hope i made things a little bit clearer.

Cheers,
Comment 10 Rémi Verschelde 2016-01-19 11:47:13 CET
This bug is starting to be quite critical, if you go to the EN forum you'll see that a crazy guy who started as "joshuya" and was banned by nickname already 3 or 4 times is now starting to impersonate active forum members, including doktor5000 (by naming himself "doktor50000", notice the extra 0).
Rémi Verschelde 2016-01-19 11:47:21 CET

Priority: Normal => High

Comment 11 bug zilla 2016-01-19 17:30:52 CET
Yep, that's a problem.

CC: (none) => root

Comment 12 bug zilla 2016-01-19 17:31:49 CET
lol
Comment 13 Marja Van Waes 2016-01-22 08:17:10 CET
Needs some more checking, but looks like it is solved:

2016:01:22:08:01 < marja> maat: yesterday i got the impression that the forums are no longer behind a reversed proxy.... did that indeed get solved?

2016:01:22:08:05 < marja> maat: you could see that user "shorewall" wasn't behind a tor node
2016:01:22:08:06 < marja> maat: so you didn't see "127.0.0.1" for him

2016:01:22:08:07 < maat> yup
2016:01:22:08:07 < maat> true you are 
2016:01:22:08:07 < maat> oh i love our sysadmin \o/

2016:01:22:08:08 < maat> true you are for the correct IP getting to the forums machine

2016:01:22:08:09 < marja> and they get logged, so bug 7100 can be closed, I suppose
2016:01:22:08:11 < maat> let's check twice or thrice
2016:01:22:08:11 < maat> before taking the risk of banning the world :P

Thanks whoever worked on this!

CC: root => (none)

Comment 14 Pascal Terjan 2016-01-24 02:16:02 CET
This is not really solved yet
Comment 15 Aurelien Oudelet 2020-09-19 18:09:15 CEST
Hi,
This is High priority bug for a good reason.

Making Mageia even better than ever is best direction.
In order to do right thing, this bug should be examined and fixed as soon as possible.

Packagers, please make the status to Assigned when you are working on this.
Feel free to reassign the bug if bad-triaged. Also, if bug is old, please close it.

On October 1st 2020, we will drop priority to normal.

Note You need to log in before you can comment on or make changes to this bug.