Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-47214

Client IP shown as 0.0.0.0 when using multiple Reverse Proxies (reopened)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.5, 2.7
    • Fix Version/s: 2.7.3
    • Component/s: General, Logging
    • Labels:
    • Testing Instructions:
      Hide
      1. Set up HA Proxy
      2. Set up Varnish (use the default configuration)
      3. Set up Moodle
      4. Configure 1 & 2 so that the path is HAProxy -> Varnish -> Moodle
      5. Access the moodle server and review the log report.
      6. Without the patch client IP's should be reported as 0.0.0.0
      7. With the patch client IP should be reported as your IP address
      Show
      Set up HA Proxy Set up Varnish (use the default configuration) Set up Moodle Configure 1 & 2 so that the path is HAProxy -> Varnish -> Moodle Access the moodle server and review the log report. Without the patch client IP's should be reported as 0.0.0.0 With the patch client IP should be reported as your IP address
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull Master Branch:
      MDL-47214-ClientIp-wrong-with-multiple-proxies

      Description

      We've discovered this is still not handled in Moodle 2.6.

      Our set up is :

      • HA Proxy handling load balancing, to 4 application nodes.
      • Each node runs varnish in front of Apache

      We end up with in the X-Forwarded-For header 3 IP addresses now:

      • The original client
      • HA Proxy
      • Varnish

      The current implementation of getremoteaddr()) in moodlelib.php does not take into account that the de-facto standard (see Wikipedia) for this header is that it may be a comma separated list of IP addresses.

      The implementation header should be exploded first and then the 1st one (which should be the client IP) pased to cleanremoteaddr().

      We identified this as all our log entries started coming through as 0.0.0.0

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mhughes2k Michael Hughes
              Reporter:
              mhughes2k Michael Hughes
              Peer reviewer:
              Dan Poltawski
              Integrator:
              Sam Hemelryk
              Tester:
              Andrew Nicols
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                10/Nov/14