
Veo muchas solicitudes en las que los usuarios intentan solicitar el directorio PhPMyAdmin en mi servidor web y me gustaría ponerles fin. Prueban algunos directorios diferentes como PhpMyAdmin-2.10 o simplemente PhpMyAdmin o simplemente PhpMyAdmin-2.09.
¿La regla de reescritura de Apache sería lo mejor para redirigirlos a un agujero negro que prohíbe que su IP acceda nuevamente a la IP?
O
Simplemente podría crear estos directorios y ponerles una redirección de JavaScript para hacerles un agujero negro también.
Se agradecen las ideas sobre una buena solución.
EDITAR: Esto es lo que estoy haciendo en .htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/phpmyadmin [NC,OR]
RewriteCond %{REQUEST_URI} ^/admin [NC,OR]
RewriteCond %{REQUEST_URI} ^/dbadmin [NC,OR]
RewriteCond %{REQUEST_URI} ^/mail [NC,OR]
RewriteCond %{REQUEST_URI} ^/myadmin [NC,OR]
RewriteCond %{REQUEST_URI} ^/mysql [NC,OR]
RewriteCond %{REQUEST_URI} ^/php\-my\-admin [NC,OR]
RewriteCond %{REQUEST_URI} ^/pma [NC,OR]
RewriteCond %{REQUEST_URI} ^/webmail [NC]
RewriteRule .* http://%{REMOTE_ADDR}%{REQUEST_URI} [R=301]
Respuesta1
Podría hacerles perder el tiempo, lo que puede hacer más para evitar que escaneen Internet en su totalidad que prohibir su IP:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} ^/phpmyadmin [NC]
RewriteRule .* http://%{REMOTE_ADDR}%{REQUEST_URI} [R=301]
Actualizar:Para agregar directorios o archivos puedes agregar condiciones adicionales (tener cuidado de no bloquear arañas de búsqueda, etc)...
Actualización x2:Se agregaron las banderas L
ast y Q
uery S
tring A
pend, y se comentó la ubicación deseable para reglas adicionales.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} ^/phpmyadmin [NC,OR]
RewriteCond %{REQUEST_URI} ^/admin [NC,OR]
RewriteCond %{REQUEST_URI} ^/dbadmin [NC,OR]
RewriteCond %{REQUEST_URI} ^/mail [NC,OR]
RewriteCond %{REQUEST_URI} ^/myadmin [NC,OR]
RewriteCond %{REQUEST_URI} ^/mysql [NC,OR]
RewriteCond %{REQUEST_URI} ^/php\-my\-admin [NC,OR]
RewriteCond %{REQUEST_URI} ^/pma [NC,OR]
RewriteCond %{REQUEST_URI} ^/webmail [NC]
RewriteRule .* http://%{REMOTE_ADDR}%{REQUEST_URI} [L,R=301,QSA]
#
# any other rewrite conditions and rules here
#
Respuesta2
ModSecurity o fail2ban es a lo que me llevó mi investigación.
También está esta pregunta: ¿Cómo frustrar los ataques de PHPMyAdmin?