12

Is there any way to restrict a mailman mailing list to only allowing subscriptions from one specific domain?

I know how to ban specific email addresses or domains from subscribing, but is there a way to ban all domains that aren't, say, example.com? Or maybe a couple specific domains?

We're starting to get hit by subscription attempts to some of our lists from what I'm sure are spammers on botnets1 and it's annoying list owners. Some lists are configured with a subscribe_policy of "Require approval" or "Confirm and approve" because the lists are intended to be only for our local users and it would be nice to minimize the annoyance of the list owners by automatically rejecting subscriptions from outside email addresses that won't be allowed to subscribe by the list owner anyways.

We can't simply restrict access to the local networks because we have lists intended for a worldwide audience and some of our "local" users can be anywhere.


1 One email address subscribes to a couple dozen unrelated lists from different IPs over a few hours; then the next day another round with a new email address and different IPs. In a few cases list owner has emailed them a question about why they were signing up for the list and received no reply.

freiheit
  • 14,334
  • 1
  • 46
  • 69
  • Have you considered simply hiding your internal lists from being advertised on the web interface? Or to put it differently, how are they finding your internal lists in the first place? – Zoredache Jun 08 '12 at 00:27
  • @Zoredache: yes. Might do that for some, but when "internal" is a population of thousands, list advertisement is useful I'm also assuming the spammers have the list names saved now. – freiheit Jun 08 '12 at 01:32

4 Answers4

7

Mailman uses Python's regular expression engine, which is flexible enough to match everything except a certain domain.

Put something like this in the ban_list for the list: ^(?!.*example\.edu) or: ^(?!.*(example\.edu|example\.com))

If lists are restricted and getting spam subscriptions, you may want to not advertise the list in mailman (make the link available elsewhere). Setting the mailing list subscription policy to "Confirm and Approve" instead of "Approve" so that spammers have to handle a piece of email before the list owner is annoyed can help, too.

freiheit
  • 14,334
  • 1
  • 46
  • 69
7

Other answers will not stop an email address like "enemy@xxxexample.com". This will: ^(?!.*[@.]example\.com) (assumes all subdomains of example.com are okay). To apply run:

config_list -i <(echo 'ban_list = [ "^(?!.*[@.]example\.com)$", ]' ) listname
sebix
  • 4,175
  • 2
  • 25
  • 45
nocnokneo
  • 171
  • 1
  • 4
0

See the GNU Mailman Wiki how to restrict membership to a single domain - only emails from that domain will be able to subscribe:

Go to the mailing list administration privacy options, for example in redhat.com:

https:// listman.redhat.com/mailman/admin/your-mail-list/privacy/subscribing

In the Ban list enter:

^.*@(?!redhat\.com$)
Noam Manos
  • 287
  • 1
  • 2
  • 7
0

Some regex foo should do the trick. Example on the Berkeley MailMan page - https://calmail.berkeley.edu/docs/mailman/regexp.html#settings

Skit
  • 640
  • 4
  • 8
  • 2
    Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference. Simply put `^(?!.*example\.edu)` or `^(?!.*(example\.edu|example\.com))` in the ban list? – freiheit Jun 08 '12 at 16:44