Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Apr 29, 2010 5:09 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 06, 2009 9:02 pm
Posts: 54
Website: http://mark.watero.us/
Location: Las Vegas
I have rules similar to the following to deny access to my various control panels (using WordPress as the example here);

Code:
<Directory ~ "/var/www/.*/wp-admin">

        Order deny,allow
        Deny from all
        Allow from *.*.*

</Directory>


With a few IP blocks set up to allow access for me from my ISP (which happily changes my IP more than a narcissist looks at himself in the mirror, but anywho).

It seems that these rules are now voided since I finally got around to setting up an nginx proxy. I'm assuming Apache is only seeing the IP address that nginx is sending from (rpaf is set up and working).

Can I do this from nginx.conf?

Code:
location ~* wp-admin/?$ {
    allow *.*.*
    deny all
}


Is this right? Can I place it outside of server { } so it takes effect globally?


Top
   
 Post subject:
PostPosted: Fri Apr 30, 2010 3:23 pm 
Offline
Newbie

Joined: Thu Aug 06, 2009 7:24 pm
Posts: 4
You can't do it globally as far as I know. location directives must be inside server directives.

However, you can put this piece of code in a separate file and include it to avoid code duplication.


Top
   
 Post subject:
PostPosted: Fri Apr 30, 2010 10:44 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 06, 2009 9:02 pm
Posts: 54
Website: http://mark.watero.us/
Location: Las Vegas
Fooey! Shouldn't rpaf be passing the IP through? Or does it only work when it comes to logging the information?

It's not going to kill me to recreate my current setup but I wish I didn't have to. :)


Top
   
 Post subject:
PostPosted: Sat May 01, 2010 4:48 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
what's your mod_rpaf configuration? It might need a recompile.


Top
   
 Post subject:
PostPosted: Sat May 01, 2010 6:55 am 
Offline
Newbie

Joined: Thu Aug 06, 2009 7:24 pm
Posts: 4
rpaf should replace the IP address. Did you configure nginx to pass the address to rpaf? Show us your nginx and rpaf configs. Also, what versions are you using?


Top
   
 Post subject:
PostPosted: Sat May 01, 2010 11:12 am 
Offline
Senior Member
User avatar

Joined: Sun Dec 06, 2009 9:02 pm
Posts: 54
Website: http://mark.watero.us/
Location: Las Vegas
My nginx conf for the site in question:

Code:
server {
        listen 69.164.207.5:80;
        limit_conn gulag 5;
        server_name mark.watero.us;

        access_log  /var/log/nginx/assets.access.log;

        location ~* \.(js|css|rdf|xml|ico|txt|gif|jpg|png|jpeg)$ {
                root   /var/www/watero.us/mark/;
                index  index.html;
                expires max;
        }

        location / {
            proxy_pass         http://69.164.193.193:80/;
            proxy_redirect     off;

            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;

            client_max_body_size       10m;
            client_body_buffer_size    128k;

            proxy_connect_timeout      90;
            proxy_send_timeout         90;
            proxy_read_timeout         90;

            proxy_buffer_size          4k;
            proxy_buffers              4 32k;
            proxy_busy_buffers_size    64k;
            proxy_temp_file_write_size 64k;

        }

}


... and here's my rpaf:

Code:
<IfModule mod_rpaf.c>
RPAFenable On
RPAFsethostname On
RPAFproxy_ips 127.0.0.1 69.164.207.5 192.168.*.*
</IfModule>


Since both IPs are on the same node, I wasn't sure if I actually needed to put anything there other than localhost, but I did anyways.

Both nginx and apache have been restarted ( a few times ) since these configurations were added.


Top
   
 Post subject:
PostPosted: Sun May 02, 2010 2:44 am 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
Use:
RPAFproxy_ips 127.0.0.1

Also if you're apache isn't accepting connections from the outside world you can happily restrict it to listening on 127.0.0.1


Top
   
 Post subject:
PostPosted: Sun May 02, 2010 11:46 am 
Offline
Senior Member
User avatar

Joined: Sun Dec 06, 2009 9:02 pm
Posts: 54
Website: http://mark.watero.us/
Location: Las Vegas
It is. I've got a number of sites running off the same node right now and the nginx setup is experimenta. As of right now it's actually only serving static files for one domain and proxying for one other...

I have to get my dollars worth on that second IP. ;)


Top
   
 Post subject:
PostPosted: Sun May 02, 2010 4:37 pm 
Offline
Senior Member

Joined: Sun Mar 07, 2010 7:47 pm
Posts: 1970
Website: http://www.rwky.net
Location: Earth
Ah not sure then, the only thing I can see different between your config and mine is the ips, try taking the wild card out see if it makes a difference, if not recompile mod_rpaf I've seen that fix it before.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group