SHOWING REAL IP'S INSTEAD OF CLOUDFLARE IP'S WHEN USING CLOUDFLARE Print
- 0
Showing real IP's instead of CloudFlare IP's when using CloudFlare can be a bit of a trick since mod_cloudflare in WHM/cPanel obviously does not do the job as we anticipated it would.
What needs to be done is to uncheck cloudflare from within Easy Apache and compile Apache without the mod cloudflare WHM/cPanel RPM.
Then install Mod_Cloudflare via RPM
Check for dependenicies making sure the below module libtool httpd-devel is already installed:
# yum install libtool httpd-devel
Next step is to download mod_cloudflare to server:
# wget https://www.cloudflare.com/static/misc/mod_cloudflare/mod_cloudflare.c
Now edit mod_cloudflare.c adding your servers IP to the of the list cloudflare provides within the script:
static const char* CF_DEFAULT_TRUSTED_PROXY[] = {
/* IPv4 Address Ranges */
"Your Server IP's"
"74.91.25.234",
"204.93.240.0/24",
etc.
etc.
Save the modified file/script and install module
# apxs -a -i -c mod_cloudflare.c
Once the installation has completed:
restart apache --> # service httpd restart
stop railgun if applicable --> # service railgun stop
restart memcached --> # service memcached restart
start railgun if applicable --> # service railgun start
Be sure to run the cPanel distiller so that the modifications made to the apache configuration file httpd.conf by the new mod _cloudflare module are kept in the event of an httpd.conf cPanel modification in the events of adding and removing a domain to the server - in cPanel the httpd.conf is dynamically written therefore custom changes are kept using the distiller:
# /usr/local/cpanel/bin/apache_conf_distiller --update
That's it! All Done!
Special thanks to Mitch for laying the groundwork doing the grunt work by supplying the base of this procedure!
Was this answer helpful?
Related Articles
WHAT WE MANAGE AND FIREWALL FALSE POSITIVES
Relevant to dedicated servers and answering an inquiry from a dedicated server client:Certainly...
ADDING MEMCACHED TO CENTOS 6.5+ AND CENTOS 7+
Step 1: SSH into your server and fire this command yum install memcached.x86_64 Step 2: Next...
APACHE NOBODY ATTACK SCRIPT
The Apache Nobody attack script is useful in stopping those that are victims of Apache Nobody...
BOOT PARTITION FILLING UP
The boot partition can fill up with excess kernels causing the system to crash if the boot...
CLOUDFLARE RAILGUN SERVER INSTALLATION
Installing CloudFlares RailgunThe following tutorial considers that one is already a CloudFlare...