Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

[ Linux - CentOS - Apache 2.2 - mod_cloudflare - apxs2 ]

I have changed my nameservers to point to CloudFlare. The problem is that all the IP addresses are coming in as CloudFlare's. This is no good, because I have to monitor and block some specific traffic. mod_cloudflare is supposed to resolve this but I have been unable to get this installed. The command in the documentation uses apxs2. I can't figure out how to install this, or if it just means for 'apache 2.4'. I'm running 2.2.3, and I can use 'apxs'.

When I run:

apxs -aic mod_cloudflare.c

I get the error

apxs:Error: Command failed with rc=65536

Does this mean I need apxs2 or something else? How do I get mod_cloudflare working on my server?

I appreciate any help, the documentation is vague and limited.

share|improve this question
    
Do you need to Apache to block in realtime? –  Alastair McCormack Oct 22 '12 at 19:50
    
Also, is there any other error printed before the one mentioned? –  Alastair McCormack Oct 22 '12 at 19:55
    
No just the one error. CloudFlare does the blocking, but I try to identify crawlers through behavioral tracking. For instance if the user loads the background texture image, and downloads the css file associated with a page. I've noticed CloudFlare can't get all the bots and some bots come directly by IP, bypassing CloudFlare. So I have to identify them before they get a chunk of my content. –  Adam Oct 22 '12 at 19:58
    
Also+, did you install the RPM? If so, please do rpm -ql mod_clodflare –  Alastair McCormack Oct 22 '12 at 19:58
    
package mod_cloudflare is not installed –  Adam Oct 22 '12 at 19:59

1 Answer 1

up vote 1 down vote accepted
+50

Fetch the RPM for your platform from https://www.cloudflare.com/resources-downloads: https://github.com/downloads/cloudflare/mod_cloudflare/mod_cloudflare-1.1.1-1.i586.rpm (32bit) and https://github.com/downloads/cloudflare/mod_cloudflare/mod_cloudflare-1.1.1-1.x86_64.rpm (64bit)

Install: rpm -ivh mod_cloudflare-1.1.1-1.*

Edit /etc/httpd/conf/httpd.conf

LoadModule cloudflare_module /usr/lib64/apache2/mod_cloudflare.so
<IfModule mod_cloudflare.c>
    CloudFlareRemoteIPHeader CF-Connecting-IP
    CloudFlareRemoteIPTrustedProxy 204.93.240.0/24 204.93.177.0/24 199.27.128.0/21 173.245.48.0/20 103.22.200.0/22 141.101.64.0/18 108.162.192.0/18
    #DenyAllButCloudFlare
</IfModule>

On 32bit change lib64 to lib

share|improve this answer
    
I'm awarding you the points for being the only person to respond with an answer and it might work for some people. I actually tried both of these and it did not resolve my issue. I instead worked around by checking for the CloudFlare Remote IP header and setting it as the remote IP in my code if it exists. Thanks, Fuzzyfelt. –  Adam Oct 28 '12 at 2:51
    
@Adam that's very generous, thank you. –  Alastair McCormack Oct 28 '12 at 8:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.