Using Curl to Change Settings in Mailman Lists

  • (rendered for 'sample' list)

How to use this page

View this page as https://cs.uwaterloo.ca/twiki/view/CF/MailManManagementGuideSettingsCurl?mmlist=LISTNAME but replace the word LISTNAME with the actual page name for your list. (Perhaps you have already done that...)

Changing settings in a lot of lists.

If you maintain (administer) a lot of mailman lists it may happen from time-to-time that you realize you have a particular setting you wish to change on many of those lists. Even if you set up a page of links to quickly get to each link, going through all the lists manually can be tedious, time-consuming and error-prone.

So this page hints at how an advanced list administrator could make use of tools, in particular the command-line tool curl to rapidly make similar changes to multiple lists.

Step 1: Creating URLs to change settings in one list

Many mailman pages will accept query parameters to change variables which are indicated within the page. For instance, look at:

Note the line

Action to take when a moderated member posts to the list.
(Details for member_moderation_action)
Hold Reject Discard

If you use browser developer options to view the source for the page, you will see that the three options have corresponding numerical values 0, 1, and 2. And the indicated variable name member_moderation_action is actually a variable which can be specified in a query URL.

The following links, which specify the variable member_moderation_action in a query URL, if you are authenticated as list administrator for list-name-parameter, will actually cause the mailman setting to be changed. (Use these links very cautiously! This option was chosen, however, because its value tends to be moot).

Step 2: Using curl to perform the operation for many lists

Generalizing the above, if you have a cookie file which allows you to authenticate to multiple lists, then the curl program can be used to make changes to a list in one line, allowing perhaps many lists to be changed quickly using command-lines without needing to point-and-click in a web browser (except to derive the model URLs).

   curl -b cookiefile -s 'https://lists.uwaterloo.ca/mailman/admin/list-name-parameter/privacy/sender?member_moderation_action=0' > list-name-parameter-output.html

You might repeat that operation, perhaps in a command file, but in this case substituting for list-name-parameter other lists you wish to change (and for which you have cookies in the cookiefile).

The curl command is available from http://curl.haxx.se/ but tends to be packaged for most Linux distros.

A browser add-on can help you create a suitable cookie file. Advanced Cookie Manager seems excellent, and would be well worth contributing to financially.

Notes

  • Not all variables on all pages can be changed like this
    • some pages/variables require setting up POST data
  • some variable values may require URL encoding
  • there is potential here for causing great damage
    • with great power comes great responsibility

Command-line upload of mailman listinfo page

If you have a properly-prepared page of HTML suitable for use as a "listinfo" page, say listinfo.html, and a suitable cookiefile you can upload the HTML as follows:

   curl -b cookiefile --data-urlencode html_code@listinfo.html -s 'https://lists.uwaterloo.ca/mailman/edithtml/list-name-parameter/listinfo.html' > list-name-parameter-output.html

Since you should use Mailman variables to parameterize such listinfo pages, it will likely be appropriate to perform the same operation for a number of different but similar lists.

-- AdrianPepper - 2016-10-14

Topic revision: r4 - 2018-12-20 - AdrianPepper
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback