Inicio Servidor Apache .htaccess Resumen de Seguridad con .htaccess

Resumen de Seguridad con .htaccess

Domingo, 02-01-2011 23:14 - Leer comentarios - Comentar

Es hora de juntar todo lo que hemos visto en temas de seguridad, en un sólo archivo. Copia y pega todo este contenido en la parte superior de tu archivo htaccess:

Texto plano
RewriteEngine on
RewriteBase /
ErrorDocument 404 /mapasitio.php
ErrorDocument 403 "Acceso denegado / Access denied"

Order deny,allow
Deny from All</Files>

Order deny,allow
Deny from All

RewriteCond %{REQUEST_URI} ^(/_vti_bin/|/MSOffice/) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^($|.$|.*Almaden|[bcdfgjklmnpqrstvwxyz]{5,}|.*compatible\ \;|.*DTS.Agent|.*Fluffy|.*Girafabot|.*HTTrack|.*Harvest|.*LWP|.*Rover|.*Searchhippo|.*TrueRobot|.*Twiceler|.*Voila|.*Voyager|.*WUMPUS|.*Webcraft@bea\.com|ADSARobot|ASPSeek|ASSORT|ATHENS|Acrobat\ Webcapture|Ah\-ha|Aktuelles|Amzn_assoc|Atomic\_Email\_Hunter|Attache|Autoemailspider|BDFetch|Beast|Bew|Big.brother|BlackWidow|Blog\_search\_engine|Boitho|Bullseye|Bumblebee|CCBot|CazoodleBot|CentiverseBot|CherryPicker|ChinaClaw|Crescent|Curl|Cyveillance|DCE|DIIbot|DISCo|DRFVNKYJYKYJ|Deweb|Digger|Digimarc|Disco|Download\ Demon|ECatch|Ecollector|EirGrabber|Email.Extractor|EmailCollector|EmailSiphon|EmailWolf|Exabot|Explorer|Express\ WebPictures|ExtractorPro|EyeNetIE|FAST|FEZhead|Fastlwspider|FavOrg|Favorites.Sweeper|Fetch|FlashGet|Franklin.?Locator|FrontPage|Generic|GetRight|GetURL|GetWebPage|Getleft|Go-Ahead-Got-It|Go-ahead-got-it|Goldfire\_Server|Gooblog|GrabNet|Grafula|Green\ Research|HLoader|HMSEbot|HMView|HTML.?Works|Holmes|HomePageSearch|Http.?generic|IBM_Planetwide|IUPUI.?Research.?Bot|Ichiro|Image\ Stripper|Image\ Sucker|IncyWincy|Industry.?Program|Ingelin|InterGET|InternetSeer.com|Internet\ Ninja|JOC\ Web\ Spider|Jakarta|Java|JetCar|Just\_a\_Browser|KWebGet|Larbin|LargeSmall\ Crawler|Leech|.*Libcurl|Libwww|LinkWalker|MCspider|MIDown\ tool|MJ12bot|MSFrontPage|Mac.?Finder|Mass\ Downloader|Metalogger|Microsoft|Mirror|Mister\ PiX|Moreoverbot|Mozilla.*Indy|Mozilla.*NEWT|MsProxy|MySweetSpider|My\-heritrix\-crawler|NICErsPRO|NPBot|NameOfAgent|Naver\ Robot|Navroad|NearSite|Net.Vampire|NetAnts|NetCarta|NetResearchServer|NetSpider|NetZIP|Net\ Vampire|Netprospector|Nost\.info|Nutscrape|Octopus|Offline\_Explorer|OpaL|OpenTextSiteCrawler|Openfind|OrangeBot|Others|PRCrawler|PSurf|PackRat|PageGrabber|Page\_verifier|Papa\ Foto|Pavuk|PcBrowser|PlantyNet_WebRobot|Production.?Bot|Program.?Shareware|.*Powerset|Psbot|PushSite|Python|REAP\-crawler|ReGet|Reget|RepoMonkey|Rezzibo|Robozilla|Rsync|Scope|ScoutAbout|Search4free|Searchterms\.it|Seekbot|Sensis|Shai|Shelob|ShopWiki|SindiceBot|Siphon|SiteSnagger|Sitecheck|Sogou|Spegla|SpiderBot|SqWorm|SuperBot|SuperHTTP|SurfWalker|Surfbot|TAkeOut|Tarspider|Teleport\ Pro|Telesoft|Templeton|TheRarestParser|TinEye|TurnitinBot|UIowaCrawler|UtilMind|VB\-Tec|Veoh|Visicom|VoidEYE|Vspider|W3mir|WEBMASTERS|WGOKSCOXEUQH|WISEbot|Web.by.mail|WebAlta\ Crawler|WebAuto|WebBandit|WebCopier|WebCopy|WebCorp|WebEMailExtrac|WebFetch|WebMiner|WebReaper|WebSauger|WebSnake|WebStripper|WebWhacker|WebZIP|Web\ Sucker|Webcollage|Website\ eXtractor|Websnatcher|Webvac|Webwalk|Wget|WhosTalking|Widow|WordPress|XGET|Xerka|YZGN|Yandex|Yeti|Yodaobot|Zermelo|Zeus|Zeus.*Webster|ZyBorg) [NC,OR]
RewriteCond %{REMOTE_ADDR} ^(201.234.113.210|151.23.89.68|190.100.150.19|200.93.233.162|78.129.202.15|219.133.77.140) [NC,OR]
RewriteCond %{HTTP_REFERER} ^(http://www.adobe.com/products|http://127.0.0.1) [NC]
RewriteCond %{REMOTE_ADDR} !^72.36.150.160 [NC]
RewriteCond %{REQUEST_URI} !^(/robots.txt) [NC]
RewriteRule ^.*$ - [F,L]

A grandes rasgos como repaso estamos haciendo lo siguiente:

  • Activando mod_rewrite
  • Configurando las páginas personalizadas de error para los códigos 403 y 404
  • Protegiendo tu instalación de accesos externos
  • Negando el acceso a archivos sensibles
  • Bloqueando los más comunes bots que suelen atacar las webs
  • Bloqueando el spam por referidos y direcciones de IP específicas
  • Todo esto permitiendo en todo momento el acceso desde mi propio servidor

Espero que éste capítulo de seguridad con Htaccess haya resultado fácil de entender, y sobre todo, útil para mejorar la seguridad de tu web.

Comentarios

Charla - Martes, 08-11-2011 15:17

Boy that rlealy helps me the heck out.


No se permiten comentarios en este momento.