mosparo’s rule packages are a powerful way to protect your forms from spam without relying on external services. As an open-source spam protection solution, mosparo puts you in control of your form security through customizable rule sets that analyze submitted content in real-time.
One of mosparo’s standout features is its rule package system, which not only allows you to create sophisticated spam filters tailored to your needs but also makes it incredibly easy to share these rules between different mosparo installations. Whether you’re managing multiple projects, collaborating with team members, or contributing to the community, you can export your carefully crafted rule packages and import them elsewhere with just a few clicks. This portability means you don’t have to recreate the wheel – once you’ve developed an effective ruleset, you can deploy it across all your mosparo instances or share it with others facing similar spam challenges.
5 Days of Docker: Setting up mosparo.
What are Rule Packages?
Rule packages in mosparo are collections of rules that define what content should be blocked or allowed in your forms. They work by analyzing submitted form data and matching it against patterns you’ve defined, helping you filter out spam while letting legitimate submissions through.
Creating Your First Rule Package
To create a rule package, navigate to the rule packages section in your mosparo administration panel. Each package consists of individual rules that can check for:
- Specific words or phrases that commonly appear in spam
- Regular expressions for more complex pattern matching
- Domain and URL patterns to catch suspicious links
- Email patterns to identify disposable or suspicious addresses
Rule Types and Configuration
mosparo supports different rule types to give you flexibility:
Word rules are straightforward – they block submissions containing specific words. You can make them case-sensitive or insensitive depending on your needs.
Regex rules offer more sophisticated matching. For example, you might create a pattern to catch common spam phrases while allowing legitimate variations.
Domain rules help you block known spam domains while maintaining a whitelist of trusted sources.
Sharing Rule Packages
The export and import functionality makes collaboration effortless. You can export your rule package as a JSON file and share it with colleagues, deploy it to staging and production environments, or even contribute it to the mosparo community. When importing, mosparo validates the package structure and allows you to review the rules before activation, ensuring you maintain control over what gets implemented in your installation.
Best Practices
Start with a minimal ruleset and expand based on the spam you actually receive. Overly aggressive rules can lead to false positives, blocking legitimate users. Test your rules thoroughly before deploying them to production, and regularly review blocked submissions to ensure you’re not catching valid content.
Maintaining Your Rules
Rule packages require ongoing maintenance. As spammers adapt their tactics, you’ll need to update your rules accordingly. Schedule regular reviews of your blocked and allowed submissions to identify patterns and adjust your rules for optimal protection.
Example
Also see the OpenGist here.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
{ "lastUpdatedAt": "2025-11-11T12:00:00Z", "refreshInterval": 3600, "rules": [ { "uuid": "550e8400-e29b-41d4-a716-446655440000", "name": "Common Spam Words", "description": "Detects common spam keywords and phrases", "type": "word", "spamRatingFactor": 1.2, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440001", "type": "text", "value": "viagra", "rating": 0.9 }, { "uuid": "550e8400-e29b-41d4-a716-446655440002", "type": "text", "value": "cialis", "rating": 0.9 }, { "uuid": "550e8400-e29b-41d4-a716-446655440003", "type": "text", "value": "free money", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440004", "type": "text", "value": "win now", "rating": 0.7 }, { "uuid": "550e8400-e29b-41d4-a716-446655440005", "type": "text", "value": "click here", "rating": 0.6 } ] }, { "uuid": "550e8400-e29b-41d4-a716-446655440010", "name": "Suspicious Email Patterns", "description": "Regex patterns to detect suspicious email formats and content", "type": "regex", "spamRatingFactor": 1.0, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440011", "type": "regex", "value": "\\b[A-Z]{2,}\\s+[A-Z]{2,}\\s+[A-Z]{2,}\\b", "rating": 0.7 }, { "uuid": "550e8400-e29b-41d4-a716-446655440012", "type": "regex", "value": "\\$\\d+[,.]?\\d*\\s*(million|billion|thousand)", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440013", "type": "regex", "value": "(?i)\\b(urgent|immediate|act\\s+now|limited\\s+time)\\b", "rating": 0.6 }, { "uuid": "550e8400-e29b-41d4-a716-446655440014", "type": "regex", "value": "\\b\\d{1,2}%\\s+(?:off|discount|savings)\\b", "rating": 0.5 } ] }, { "uuid": "550e8400-e29b-41d4-a716-446655440020", "name": "Malicious User Agents", "description": "Known malicious or suspicious user agent strings", "type": "user-agent", "spamRatingFactor": 1.5, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440021", "type": "text", "value": "curl/", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440022", "type": "text", "value": "wget/", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440023", "type": "text", "value": "Python-urllib/", "rating": 0.7 }, { "uuid": "550e8400-e29b-41d4-a716-446655440024", "type": "regex", "value": "bot|crawler|spider", "rating": 0.6 } ] }, { "uuid": "550e8400-e29b-41d4-a716-446655440030", "name": "URL Spam Patterns", "description": "Detects suspicious URLs and link patterns", "type": "url", "spamRatingFactor": 1.1, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440031", "type": "regex", "value": "https?://bit\\.ly/[a-zA-Z0-9]+", "rating": 0.5 }, { "uuid": "550e8400-e29b-41d4-a716-446655440032", "type": "regex", "value": "https?://tinyurl\\.com/[a-zA-Z0-9]+", "rating": 0.5 }, { "uuid": "550e8400-e29b-41d4-a716-446655440033", "type": "text", "value": ".tk", "rating": 0.7 }, { "uuid": "550e8400-e29b-41d4-a716-446655440034", "type": "text", "value": ".ml", "rating": 0.7 } ] }, { "uuid": "550e8400-e29b-41d4-a716-446655440040", "name": "Phishing Keywords", "description": "Common phishing and social engineering terms", "type": "word", "spamRatingFactor": 1.3, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440041", "type": "text", "value": "verify your account", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440042", "type": "text", "value": "suspended account", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440043", "type": "text", "value": "update payment", "rating": 0.7 }, { "uuid": "550e8400-e29b-41d4-a716-446655440044", "type": "text", "value": "click to confirm", "rating": 0.6 }, { "uuid": "550e8400-e29b-41d4-a716-446655440045", "type": "text", "value": "security alert", "rating": 0.7 } ] }, { "uuid": "550e8400-e29b-41d4-a716-446655440050", "name": "Cryptocurrency Spam", "description": "Detects cryptocurrency-related spam and scam content", "type": "word", "spamRatingFactor": 1.4, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440051", "type": "text", "value": "bitcoin investment", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440052", "type": "text", "value": "crypto trading bot", "rating": 0.7 }, { "uuid": "550e8400-e29b-41d4-a716-446655440053", "type": "text", "value": "guaranteed profits", "rating": 0.9 }, { "uuid": "550e8400-e29b-41d4-a716-446655440054", "type": "text", "value": "mining software", "rating": 0.6 }, { "uuid": "550e8400-e29b-41d4-a716-446655440055", "type": "text", "value": "wallet recovery", "rating": 0.8 } ] }, { "uuid": "550e8400-e29b-41d4-a716-446655440060", "name": "Code Injection Patterns", "description": "Detects common code injection attempts", "type": "regex", "spamRatingFactor": 2.0, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440061", "type": "regex", "value": "<script[^>]*>.*?</script>", "rating": 1.0 }, { "uuid": "550e8400-e29b-41d4-a716-446655440062", "type": "regex", "value": "javascript:", "rating": 0.9 }, { "uuid": "550e8400-e29b-41d4-a716-446655440063", "type": "regex", "value": "(?i)\\b(SELECT|UNION|DROP|INSERT)\\b.*\\b(FROM|TABLE)\\b", "rating": 1.0 }, { "uuid": "550e8400-e29b-41d4-a716-446655440064", "type": "regex", "value": "\\bon\\w+\\s*=", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440065", "type": "regex", "value": "document\\.cookie", "rating": 0.9 } ] }, { "uuid": "550e8400-e29b-41d4-a716-446655440070", "name": "SEO Spam Keywords", "description": "Common SEO and marketing spam terms", "type": "word", "spamRatingFactor": 0.8, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440071", "type": "text", "value": "SEO services", "rating": 0.6 }, { "uuid": "550e8400-e29b-41d4-a716-446655440072", "type": "text", "value": "rank higher", "rating": 0.5 }, { "uuid": "550e8400-e29b-41d4-a716-446655440073", "type": "text", "value": "backlinks", "rating": 0.6 }, { "uuid": "550e8400-e29b-41d4-a716-446655440074", "type": "text", "value": "increase traffic", "rating": 0.5 }, { "uuid": "550e8400-e29b-41d4-a716-446655440075", "type": "text", "value": "link building", "rating": 0.6 } ] }, { "uuid": "550e8400-e29b-41d4-a716-446655440080", "name": "Adult Content Keywords", "description": "Detects adult content and inappropriate material", "type": "word", "spamRatingFactor": 1.5, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440081", "type": "text", "value": "adult dating", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440082", "type": "text", "value": "cam girls", "rating": 0.9 }, { "uuid": "550e8400-e29b-41d4-a716-446655440083", "type": "text", "value": "hookup tonight", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440084", "type": "text", "value": "singles near you", "rating": 0.7 }, { "uuid": "550e8400-e29b-41d4-a716-446655440085", "type": "text", "value": "meet locals", "rating": 0.6 } ] }, { "uuid": "550e8400-e29b-41d4-a716-446655440090", "name": "Pharmaceutical Spam", "description": "Illegal pharmacy and drug-related spam", "type": "word", "spamRatingFactor": 1.6, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440091", "type": "text", "value": "pharmacy online", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440092", "type": "text", "value": "no prescription", "rating": 0.9 }, { "uuid": "550e8400-e29b-41d4-a716-446655440093", "type": "text", "value": "weight loss pills", "rating": 0.7 }, { "uuid": "550e8400-e29b-41d4-a716-446655440094", "type": "text", "value": "enhancement pills", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440095", "type": "text", "value": "discount pharmacy", "rating": 0.7 } ] }, { "uuid": "550e8400-e29b-41d4-a716-446655440100", "name": "Suspicious Email Patterns", "description": "Detects suspicious email address patterns", "type": "regex", "spamRatingFactor": 1.2, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440101", "type": "regex", "value": "\\b[a-z]{1,3}\\d{3,}@[a-z]+\\.[a-z]{2,}\\b", "rating": 0.7 }, { "uuid": "550e8400-e29b-41d4-a716-446655440102", "type": "regex", "value": "\\bnoreply\\d+@[a-z]+\\.[a-z]{2,}\\b", "rating": 0.6 }, { "uuid": "550e8400-e29b-41d4-a716-446655440103", "type": "regex", "value": "\\btest\\d*@[a-z]+\\.[a-z]{2,}\\b", "rating": 0.5 }, { "uuid": "550e8400-e29b-41d4-a716-446655440104", "type": "regex", "value": "\\b\\w+\\.\\w+\\.\\w+@[a-z]+\\.[a-z]{2,}\\b", "rating": 0.6 } ] }, { "uuid": "550e8400-e29b-41d4-a716-446655440110", "name": "International Spam Terms", "description": "Spam terms in multiple languages", "type": "word", "spamRatingFactor": 1.0, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440111", "type": "text", "value": "kostenlos", "rating": 0.6 }, { "uuid": "550e8400-e29b-41d4-a716-446655440112", "type": "text", "value": "gratis", "rating": 0.6 }, { "uuid": "550e8400-e29b-41d4-a716-446655440113", "type": "text", "value": "casino", "rating": 0.7 }, { "uuid": "550e8400-e29b-41d4-a716-446655440114", "type": "text", "value": "lottery winner", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440115", "type": "text", "value": "inheritance claim", "rating": 0.9 } ] }, { "uuid": "550e8400-e29b-41d4-a716-446655440120", "name": "Suspicious Text Patterns", "description": "Various suspicious formatting and text patterns", "type": "regex", "spamRatingFactor": 1.1, "items": [ { "uuid": "550e8400-e29b-41d4-a716-446655440121", "type": "regex", "value": "\\b[A-Z]{4,}\\s+[A-Z]{4,}\\s+[A-Z]{4,}", "rating": 0.7 }, { "uuid": "550e8400-e29b-41d4-a716-446655440122", "type": "regex", "value": "\\b\\w*(.)\\1{4,}\\w*\\b", "rating": 0.6 }, { "uuid": "550e8400-e29b-41d4-a716-446655440123", "type": "regex", "value": "[!@#$%^&*]{4,}", "rating": 0.5 }, { "uuid": "550e8400-e29b-41d4-a716-446655440124", "type": "regex", "value": "\\d+\\.\\d+\\.\\d+\\.\\d+", "rating": 0.8 }, { "uuid": "550e8400-e29b-41d4-a716-446655440125", "type": "regex", "value": "\\b(URGENT|IMPORTANT|IMMEDIATE).*\\b(ACTION|RESPONSE)\\b", "rating": 0.8 } ] } ] } |
