Answer the question
In order to leave comments, you need to log in
How to disable POST requests to nginx for everyone except yourself?
Good time of the day!
There is a debian server with ISP manager 5 Lite installed. Spinning nginx + apache itk
on the server several sites on different CMS: Wordpress, Joomla, OpenCart, GetSimple... Sites are mostly new but there are also old ones. Even on Joomla 1.5.x.
Access is filtered by iptables, persons who have access are trusted.
I manage everything personally, well, or "almost" personally. The sites have a commercial intent and are visited periodically. But apparently they are visited not only by clients, but also by intruders ... Through a yet unknown hole on the server , php "Backdoors" are constantly (no, really, constantly, and most likely manually) uploaded, through which all sorts of horrors are happening.
Thought: "How long"? and found a solution :
Here is the main location of the ngingx site config file:
location / {
location ~ [^/]\.ph(p\d*|tml)$ {
limit_except GET {
allow <<МОЙ_ИП>;
deny all;
}
try_files /does_not_exists @fallback;
}
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
expires 7d;
try_files $uri $uri/ @fallback;
}
location / {
limit_except GET {
allow <МОЙ_ИП>;
deny all;
}
try_files /does_not_exists @fallback;
}
}
<МОЙ_ИП> - - [10/Dec/2014:11:40:06 +0300] "POST /index.php?option=com_rsform&Itemid=3 HTTP/1.1" 405
Answer the question
In order to leave comments, you need to log in
Probably because you allow yourself only GET
Try It
's a very strange way though. If all shells get through ISP, then give access to it only from work and that's it. From home vpn to work and you will be happy. Well, change the url for the panel.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question