Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mod_cloudflare vs mod_remoteip

Discussion in 'EasyApache' started by caisc, Mar 3, 2017.

Tags:
  1. caisc

    caisc Well-Known Member

    Joined:
    Oct 5, 2011
    Messages:
    70
    Likes Received:
    2
    Trophy Points:
    58
    Location:
    India
    cPanel Access Level:
    Root Administrator
  2. vacancy

    vacancy Well-Known Member

    Joined:
    Sep 20, 2012
    Messages:
    140
    Likes Received:
    14
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    There is no difference.

    The work done in the mod_remoteip and mod_cloudflare extensions is to execute the function X-Forwarded-For.

    You can choose any.
     
    caisc likes this.
  3. caisc

    caisc Well-Known Member

    Joined:
    Oct 5, 2011
    Messages:
    70
    Likes Received:
    2
    Trophy Points:
    58
    Location:
    India
    cPanel Access Level:
    Root Administrator
    @vacancy Thanks for the update.

    I have EasyApache4 with cloudlinux 7 on server.

    Did EasyApache and installed mod_remoteip on the server.

    root@server [~]# httpd -M | grep remoteip
    remoteip_module (shared)
    root@server [~]#


    Now do I need to put some extra configuration in this file at location - /etc/apache2/conf.modules.d/360_mod_remoteip.conf

    Like -
    RemoteIPHeader X-Real-IP
    RemoteIPInternalProxy SERVER_IP_ADDRESS


    Replace the SERVER_IP_ADDRESS with your server IP address.

    Thanks
     
  4. vacancy

    vacancy Well-Known Member

    Joined:
    Sep 20, 2012
    Messages:
    140
    Likes Received:
    14
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    One last step is needed.

    Apache configuration > Include editor > Pre main Include / All versions

    The following codes should be added.

    Code:
    <IfModule remoteip_module>
      RemoteIPHeader X-Forwarded-For
    </IfModule>
    <IfModule log_config_module>
      LogFormat "%{Referer}i -> %U" referer
      LogFormat "%{User-agent}i" agent
      LogFormat "%a %l %u %t \"%r\" %>s %b" common
      LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
      CustomLog logs/access_log combined
    </IfModule>
     
  5. caisc

    caisc Well-Known Member

    Joined:
    Oct 5, 2011
    Messages:
    70
    Likes Received:
    2
    Trophy Points:
    58
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Thanks completed the last step as mentioned and restarted Apache.

    Now the real abusing IPs hidden behind cloudflare will be logged and will be blocked in CSF firewall as per rules defined in CSF firewall and mod_security rules. Right?
     
  6. vacancy

    vacancy Well-Known Member

    Joined:
    Sep 20, 2012
    Messages:
    140
    Likes Received:
    14
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    No.

    Csf and similar softwares, read netstat data.

    The x-forwarded-for function is only valid for traffic to the webserver.

    It can do it mod_evasive.
     
    #6 vacancy, Mar 3, 2017
    Last edited: Mar 3, 2017
  7. caisc

    caisc Well-Known Member

    Joined:
    Oct 5, 2011
    Messages:
    70
    Likes Received:
    2
    Trophy Points:
    58
    Location:
    India
    cPanel Access Level:
    Root Administrator
    So this will only log the real IP of the user who access the site hosted on my server via cloudflare or any other proxy network.
    plz confirm.
     
  8. vacancy

    vacancy Well-Known Member

    Joined:
    Sep 20, 2012
    Messages:
    140
    Likes Received:
    14
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Yes.

    Csf and similar firewalls that you use will operate according to the unix netstat data. The x-forwarded-for module is not a unix core module, but a webserver module.
     
    #8 vacancy, Mar 3, 2017
    Last edited: Mar 3, 2017
  9. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    It looks like this topic is now solved. Let us know if you have any additional questions.

    Thank you.
     
  10. rogerw

    rogerw Member

    Joined:
    Feb 21, 2012
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    51
    cPanel Access Level:
    Website Owner
    What was the solution?
    How can we pass the x-forwarded-for to CSF?
     
  11. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @rogerw,

    It's not supported. Here's the quote from earlier in this thread that answers this question:

    Thank you.
     
Loading...

Share This Page