我正在尝试为 ModSecurity 建立一系列规则来阻止坏机器人。
SecRule REQUEST_HEADERS:User-Agent "@pmFromFile /etc/apache2/conf.d/badbots.txt" "id:'444444',phase:2,t:none,deny,status:406,log,msg:'BAD BOT - Detected and Blocked. '"
但是这种方法并不好,因为 ModSecurity 使用 withcontains
而不是 begin。
360Spider
80legs
AIBOT
Aboundex
....
我认为最好的方法是为每个组使用规则
^(black.?hole|blackwidow|blowfish|botalot|buddy|builtbottough|bullseye)
^(cheesebot|cherrypicker|chinaclaw|collector|copier|copyrightcheck)
^(cosmos|crescent|curl|custo|da|diibot|disco|dittospyder|dragonfly)
^(drip|easydl|ebingbong|ecatch|eirgrabber|emailcollector|emailsiphon)
^(emailwolf|erocrawler|exabot|eyenetie|filehound|flashget|flunky)
^(frontpage|getright|getweb|go.?zilla|go-ahead-got-it|gotit|grabnet)
^(grafula|harvest|hloader|hmview|httplib|httrack|humanlinks|ilsebot)
^(infonavirobot|infotekies|intelliseek|interget|iria|jennybot|jetcar)
^(joc|justview|jyxobot|kenjin|keyword|larbin|leechftp|lexibot|lftp|libweb)
^(likse|linkscan|linkwalker|lnspiderguy|lwp|magnet|mag-net|markwatch)
^(mata.?hari|memo|microsoft.?url|midown.?tool|miixpc|mirror|missigua)
^(mister.?pix|moget|mozilla.?newt|nameprotect|navroad|backdoorbot|nearsite)
^(net.?vampire|netants|netcraft|netmechanic|netspider|nextgensearchbot)
^(attach|nicerspro|nimblecrawler|npbot|octopus|offline.?explorer)
^(offline.?navigator|openfind|outfoxbot|pagegrabber|papa|pavuk)
^(pcbrowser|php.?version.?tracker|pockey|propowerbot|prowebwalker)
^(psbot|pump|queryn|recorder|realdownload|reaper|reget|true_robot)
^(repomonkey|rma|internetseer|sitesnagger|siphon|slysearch|smartdownload)
^(snake|snapbot|snoopy|sogou|spacebison|spankbot|spanner|sqworm|superbot)
^(superhttp|surfbot|asterias|suzuran|szukacz|takeout|teleport)
^(telesoft|the.?intraformant|thenomad|tighttwatbot|titan|urldispatcher)
^(turingos|turnitinbot|urly.?warning|vacuum|vci|voideye|whacker)
^(libwww-perl|widow|wisenutbot|wwwoffle|xaldon|xenu|zeus|zyborg|anonymouse)
^web(zip|emaile|enhancer|fetch|go.?is|auto|bandit|clip|copier|master|reaper|sauger|site.?quester|whack)
^.*(craftbot|download|extract|stripper|sucker|ninja|clshttp|webspider|leacher|collector|grabber|webpictures).*$
尝试
SecRule REQUEST_HEADERS:User-Agent "@beginswith (black.?hole|blackwidow|blowfish|botalot|buddy|builtbottough|bullseye)" "id:'444440',phase:2,t:none,deny,status:406,log,msg:'BAD BOT - Detected and Blocked. '"
SecRule REQUEST_HEADERS:User-Agent "@beginswith (cheesebot|cherrypicker|chinaclaw|collector|copier|copyrightcheck)" "id:'444441',phase:2,t:none,deny,status:406,log,msg:'BAD BOT - Detected and Blocked. '"
SecRule REQUEST_HEADERS:User-Agent "@beginswith (cosmos|crescent|curl|custo|da|diibot|disco|dittospyder|dragonfly)" "id:'444442',phase:2,t:none,deny,status:406,log,msg:'BAD BOT - Detected and Blocked. '"
SecRule REQUEST_HEADERS:User-Agent "@beginswith (drip|easydl|ebingbong|ecatch|eirgrabber|emailcollector|emailsiphon)" "id:'444443',phase:2,t:none,deny,status:406,log,msg:'BAD BOT - Detected and Blocked. '"
SecRule REQUEST_HEADERS:User-Agent "@beginswith (emailwolf|erocrawler|exabot|eyenetie|filehound|flashget|flunky)" "id:'444444',phase:2,t:none,deny,status:406,log,msg:'BAD BOT - Detected and Blocked. '"
SecRule REQUEST_HEADERS:User-Agent "@beginswith (frontpage|getright|getweb|go.?zilla|go-ahead-got-it|gotit|grabnet)" "id:'444444',phase:2,t:none,deny,status:406,log,msg:'BAD BOT - Detected and Blocked. '"
SecRule REQUEST_HEADERS:User-Agent "@beginswith (grafula|harvest|hloader|hmview|httplib|httrack|humanlinks|ilsebot)" "id:'444445',phase:2,t:none,deny,status:406,log,msg:'BAD BOT - Detected and Blocked. '"
SecRule REQUEST_HEADERS:User-Agent "@beginswith (infonavirobot|infotekies|intelliseek|interget|iria|jennybot|jetcar)" "id:'444446',phase:2,t:none,deny,status:406,log,msg:'BAD BOT - Detected and Blocked. '"
SecRule REQUEST_HEADERS:User-Agent "@beginswith (joc|justview|jyxobot|kenjin|keyword|larbin|leechftp|lexibot|lftp|libweb)" "id:'444447',phase:2,t:none,deny,status:406,log,msg:'BAD BOT - Detected and Blocked. '"
但这是行不通的。