Discourse does not support wildcards in the blocked email domains list, so blocking entire domain patterns like @services.cn is not possible directly. However, there are several measures you can take to reduce or prevent these spam registration attacks:
Reduce “max new accounts per registration IP”
Lower this setting to 1 or another low number to limit how many new accounts can be created from the same IP address. This helps prevent mass registrations from a single IP and is very effective during an attack.
Enable hCaptcha on Registration
Add a CAPTCHA challenge to your signup form by enabling the Discourse hCaptcha Plugin. This increases friction for bots and automated signups and is available on all hosted plans.
Manually Block Known Bad Domains
While wildcards are not supported, you can explicitly add problematic domains to your “blocked email domains” list.
Require New User Approval
Temporarily enable the setting to “must approve users.” This puts all new registrations in a moderation queue for manual approval.
That’s a smart move! What was the wildcard that worked?
I wonder why this did not work? Maybe there is a case to be made for supporting wildcards, though I can imagine that would be very easy to misconfigure and make your site impossible for anybody to use!
I replied by mail but don’t see my reply here, no time to dig it up now and the web UI doesn’t let me just type preformatted text (I hate it!) so you’ll have to guess
@strk maybe you are not familiar with how preformatted text works in Discourse. There are multiple ways to do it and it’s quite powerful once you learn how. See: Posting code or preformatted text
@tobiaseigen there’s a little bug, though, if I copy that regex as text and paste it in Discourse, it gets mangled to /.@service...cn/ (the backslashes are lost).
What you are seeing there is not a bug, but intended markdown behavior. Two asterisks surrounding text displays the text as italics. Because it includes an @ it is displayed as an invalid @username. Once you surround the regex in backticks it displays as preformatted text:
Italics with username: /.@service...cn/
Preformatted text: /.*@service\..*\.cn/
Oh yes, I am able to replicate what you are describing, using the richtext editor. Try switching to the markdown editor first and it will work. Not sure if there is anything that can be done about this.