| | 118 | |
| | 119 | |
| | 120 | |
| | 121 | ######################## Get rid of spammers.... |
| | 122 | ######################## See: http://madwifi.org/wiki/FightingTracSpam |
| | 123 | |
| | 124 | ### Enable CGIs |
| | 125 | ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ |
| | 126 | |
| | 127 | <Directory /usr/lib/cgi-bin/> |
| | 128 | AllowOverride none |
| | 129 | Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch |
| | 130 | Order allow,deny |
| | 131 | Allow from all |
| | 132 | AuthType Basic |
| | 133 | AuthName "Museek+'s Access Stats" |
| | 134 | AuthUserFile /data/trac/auth/museek+.le-vert.net |
| | 135 | Require valid-user |
| | 136 | </Directory> |
| | 137 | |
| | 138 | <Location /cgi-bin> |
| | 139 | SetHandler None |
| | 140 | </Location> |
| | 141 | |
| | 142 | ### Awstats access stats |
| | 143 | Alias /awstats-icon/ /usr/share/awstats/icon/ |
| | 144 | |
| | 145 | <Location /awstats-icon> |
| | 146 | SetHandler None |
| | 147 | </Location> |
| | 148 | |
| | 149 | ErrorLog /var/log/apache2/museekplus.le-vert.net-error.log |
| | 150 | LogLevel warn |
| | 151 | |
| | 152 | CustomLog /var/log/apache2/museekplus.le-vert.net-access.log combined |
| | 153 | ServerSignature On |
| | 154 | |
| | 155 | |
| | 156 | |
| | 157 | |
| | 158 | ######################## Get rid of spammers.... |
| | 159 | ######################## See: http://madwifi.org/wiki/FightingTracSpam |
| | 160 | |
| | 161 | <IfModule mod_security.c> |
| | 162 | # |
| | 163 | # anti trac-spam rules v7 |
| | 164 | # http://madwifi.org/wiki/FightingTracSpam |
| | 165 | # |
| | 166 | |
| | 167 | SecFilterDebugLevel 0 |
| | 168 | # uncomment the following line if you enable debugging: |
| | 169 | #SecFilterDebugLog /path/to/somewhere/trac-spam.log |
| | 170 | |
| | 171 | SecFilterEngine On |
| | 172 | SecFilterScanPOST On |
| | 173 | SecFilterCheckURLEncoding On |
| | 174 | SecFilterCheckCookieFormat On |
| | 175 | SecFilterCheckUnicodeEncoding Off |
| | 176 | |
| | 177 | # default rule: if a request matches, we want mod-security to |
| | 178 | # put a notice about it into the (v)hosts' error log and |
| | 179 | # deny the request with status 402 ("Payment required") |
| | 180 | SecFilterDefaultAction "deny,log,status:402" |
| | 181 | |
| | 182 | # have a look at POST requests only, since they are what is used |
| | 183 | # to submit the spam - this helps to reduce the load that is |
| | 184 | # caused by mod-security |
| | 185 | SecFilterSelective REQUEST_METHOD "!(^POST$)" "nolog,allow" |
| | 186 | |
| | 187 | # allow all POST requests that are not directed to one of the |
| | 188 | # handlers we take into account below |
| | 189 | SecFilterSelective REQUEST_URI "!(/(wiki|newticket|ticket).*$)" "nolog,allow" |
| | 190 | |
| | 191 | # block POSTs to /ticket/<number>#preview and /newticket#preview |
| | 192 | # this catches spam type 1 |
| | 193 | SecFilterSelective REQUEST_URI "^/(newticket|ticket/[0-9]+).*\#preview" |
| | 194 | |
| | 195 | # block POSTs to /wiki, /ticket and /newticket from users who |
| | 196 | # don't have a trac cookie |
| | 197 | # this catches spam type 2 |
| | 198 | # |
| | 199 | # CAUTION: these rules likely cause false positives, as some users tend |
| | 200 | # to turn off cookie support in their browser. Don't activate them unless |
| | 201 | # you're sure that this won't offend your visitors, or at least warn |
| | 202 | # visitors. |
| | 203 | #SecFilterSelective REQUEST_URI "^/(wiki/|newticket|ticket/).*$" chain |
| | 204 | #SecFilterSelective HTTP_COOKIE "!(trac_auth|trac_session)" |
| | 205 | |
| | 206 | # don't accept usage of HTML processor in tickets / ticket comments |
| | 207 | # this catches spam type 3 |
| | 208 | SecFilterSelective REQUEST_URI "^/(newticket|ticket/).*$" chain |
| | 209 | SecFilterSelective "ARG_description|ARG_comment" "#!html" |
| | 210 | |
| | 211 | # block new ticket and ticket comment POSTs if they contain more |
| | 212 | # than one URL |
| | 213 | # this catches spam type 4 |
| | 214 | SecFilterSelective "REQUEST_URI" "^/(newticket|ticket/).*$" chain |
| | 215 | SecFilterSelective "ARGS" "http\:/.*http\:/" |
| | 216 | |
| | 217 | # block LED spammer; his spam is not blocked by the previous |
| | 218 | # rule, since he only includes only one URL to the spamvertised |
| | 219 | # website |
| | 220 | # last but not least, this catches spam type 5 |
| | 221 | SecFilterSelective REQUEST_URI "^/(newticket|ticket/).*$" chain |
| | 222 | SecFilterSelective "ARG_description|ARG_comment" "www.tideled.com" |
| | 223 | |
| | 224 | # block tickets or comments with an http://-URL in it, if user is |
| | 225 | # not properly authenticated; throw a 403 that allows to present |
| | 226 | # users with a custom error page which explains what is going |
| | 227 | # on (see below) |
| | 228 | SecFilterSelective "REQUEST_URI" "/(newticket|ticket/).*$" chain |
| | 229 | SecFilterSelective HTTP_COOKIE "!trac_auth" chain |
| | 230 | SecFilterSelective HTTP_Authorization "!Basic" chain |
| | 231 | SecFilterSelective "ARGS" "(http|https):/" "deny,log,status:403" |
| | 232 | |
| | 233 | |
| | 234 | # Apache allows to present users with customized error pages, |
| | 235 | # and we can make use of that feature to let spammers know what |
| | 236 | # we think of 'em. |
| | 237 | # Tell Apache what file to use as error page for 402, and |
| | 238 | # let it know that requests to this file should not be handled |
| | 239 | # by Trac. |
| | 240 | # |
| | 241 | # Uncomment the following lines if you want to make use of this |
| | 242 | # feature (see also step 3 of the recipe): |
| | 243 | Alias /error402.html /data/trac/museek+/htdocs/error402.html |
| | 244 | ErrorDocument 402 /error402.html |
| | 245 | <Location /error402.html> |
| | 246 | # XBitHack On |
| | 247 | SetHandler None |
| | 248 | </Location> |
| | 249 | # |
| | 250 | # Another use for customized error pages is, as mentioned above, |
| | 251 | # to let users know why they are not allowed to give URLs in |
| | 252 | # their tickets and what they can do to circumvent this |
| | 253 | # limitation. |
| | 254 | Alias /error403.html /data/trac/museek+/htdocs/error403.html |
| | 255 | ErrorDocument 403 /error403.html |
| | 256 | <Location /error403.html> |
| | 257 | SetHandler None |
| | 258 | </Location> |
| | 259 | </IfModule> |
| | 260 | |