0
votes

I have a particularly annoying Mac user who is spamming me. This is the user-agent

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:9.0) Gecko/20100101 Firefox/9.0"

Would you suggest to block it via htaccess? Is the following sufficient or is Gecko/20100101 a common user agent?

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} Gecko/20100101 [NC]
RewriteRule ^ - [F,L]
2

2 Answers

2
votes

No, that's really not a good way to do it. First, you're blocking everyone who uses that version of firefox on a Mac running OSX 10.6. Second, you aren't blocking him when he switches to another browser to continue trolling you. Just block the ip address, or issue a cookie that returns a token when a user revisits the site, and automatically adds them to the blacklist if the token belongs to an offender. You can also block users who refuse the cookies if the problem is incredibly pervasive to ensure he can't just turn cookies off to circumvent this. There are of course ways around this for a persistent or knowledgeable pest, however in 99.9% of cases this will get rid of them.

1
votes

The UA string of Firefox itself is broken down into four components:

Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion

Mozilla/5.0 is the general token that says the browser is Mozilla compatible, and is common to almost every browser today.

platform describes the native platform the browser is running on (e.g. Windows, Mac, Linux or Android), and whether or not it's a mobile phone. Firefox OS phones simply say "Mobile"; the web is the platform. Note that platform can consist of multiple "; "-separated tokens. See below for further details and examples.

rv:geckoversion indicates the release version of Gecko (such as "17.0"). In recent browsers, geckoversion is the same as firefoxversion.

Gecko/geckotrail indicates that the browser is based on Gecko.

On Desktop, geckotrail is the fixed string "20100101"

Firefox/firefoxversion indicates the browser is Firefox, and provides the version (such as "17.0").

from Firefox 10 on mobile, geckotrail is the same as firefoxversion