The Joy of .htaccess's Limit Directive
Submitted by Chris Ciulla on Sat, 2006-04-01 14:13.
On several sites I administer, I've had to deal with comment spam. Not just one or two comments, but hundreds.
While Jeremy Andrew's Drupal [spam module|http://www.kerneltrap.org/jeremy/drupal/spam/] helps, I've taken the additional step of denying access to these shitheads.
Here's how to do the same.
# If you haven't already, install Jeremy Andrew's Drupal [spam module|http://www.kerneltrap.org/jeremy/drupal/spam/]\\\\
# After you've been hit, execute the following query: \\{{{\\select distinct hostname from spam_log where entry like '%insert action%'}}}\\
# Select all of the hostnames, then edit your .htaccess file thusly: \\{{{\\\\deny from [hostname from query above]\\ \\}}}\\
# In your access logs, you'll start seeing a lot of 403's, but it's worth it.\\\\
# As an added bonus, here's my list of spammer's IP addresses:\\{{{\\24.95.110.251 \\58.67.31.194 \\59.17.183.152 \\60.248.171.231 \\61.120.171.84 \\61.153.240.195 \\61.16.237.243 \\61.19.51.228 \\61.218.64.76 \\61.27.174.114 \\61.27.26.122 \\61.54.53.10 \\61.60.21.226 \\61.70.63.23 \\61.8.138.97 \\62.150.81.34 \\62.156.146.2 \\62.75.157.133 \\63.146.21.70 \\64.40.99.44 \\65.40.196.236 \\66.30.16.239 \\68.231.163.37 \\68.87.66.148 \\68.87.71.180 \\68.87.76.153 \\68.87.77.180 \\69.59.189.156 \\69.59.189.156 \\71.10.223.2 \\72.129.80.111 \\72.25.82.37 \\80.191.131.136 \\80.220.222.68 \\80.237.140.233 \\80.38.189.29 \\80.49.92.116 \\80.59.86.100 \\80.87.84.238 \\81.214.110.150 \\81.219.232.81 \\82.175.84.186 \\82.193.15.174 \\82.210.128.9 \\82.67.177.213 \\83.14.144.154 \\83.18.243.10 \\83.18.243.10 \\83.19.208.66 \\83.233.42.198 \\84.245.34.243 \\84.36.51.50 \\84.97.220.242 \\85.124.125.99 \\85.168.182.175 \\85.219.165.44 \\85.219.247.52 \\85.219.247.52 \\87.248.169.224 \\125.190.98.105 \\134.83.1.225 \\142.204.74.210 \\159.148.11.4 \\164.77.205.234 \\165.21.154.116 \\165.228.130.12 \\168.209.98.66 \\193.0.92.6 \\193.145.39.242 \\193.213.114.98 \\193.219.14.237 \\195.146.135.6 \\195.22.30.122 \\195.82.167.221 \\196.1.98.253 \\200.118.2.218 \\200.242.105.131 \\200.27.187.52 \\200.58.206.234 \\200.7.23.172 \\200.90.71.207 \\201.145.206.134 \\201.19.226.137 \\201.232.72.161 \\201.247.150.149 \\201.34.32.243 \\201.51.139.236 \\202.140.182.183 \\202.142.180.1 \\202.149.82.28 \\202.154.86.106 \\202.181.236.51 \\202.28.204.124 \\202.33.224.213 \\202.39.237.196 \\202.4.48.236 \\202.82.18.1 \\203.155.1.245 \\203.166.129.42 \\203.177.167.195 \\203.236.112.122 \\203.36.224.19 \\203.36.224.19 \\208.138.21.64 \\209.221.239.28 \\210.146.8.65 \\210.17.210.134 \\210.194.126.73 \\210.222.202.28 \\211.154.21.52 \\211.230.69.17 \\211.232.42.182 \\211.249.162.212 \\211.42.197.39 \\211.75.41.198 \\212.14.53.163 \\212.143.99.228 \\212.182.119.173 \\212.183.10.190 \\212.62.48.126 \\212.68.193.242 \\213.105.176.1 \\213.132.155.204 \\213.134.178.130 \\213.186.167.123 \\213.86.57.3 \\213.96.37.223 \\216.228.240.1 \\217.110.209.170 \\217.219.155.216 \\217.56.105.180 \\217.89.43.18 \\218.112.124.184 \\218.124.196.37 \\218.140.190.31 \\218.152.129.31 \\218.19.185.112 \\218.218.67.37 \\218.40.17.91 \\218.44.174.178 \\218.47.199.55 \\218.78.210.2 \\219.160.89.95 \\219.165.51.147 \\219.172.65.30 \\219.253.178.112 \\219.31.8.51 \\219.99.17.115 \\220.120.97.41 \\220.227.154.177 \\220.29.12.59 \\220.79.183.115 \\220.99.76.14 \\221.128.125.92 \\221.133.198.187 \\221.151.89.19 \\221.158.31.113 \\221.169.51.189 \\221.24.170.21 \\221.24.194.85 \\221.246.159.34 \\222.120.168.60}}}
Enjoy.
»
- Chris Ciulla's blog
- Login to post comments