[Mailman-Users] Re: Question on outputting all lists and list owners and a process for batch disabling of lists without an owner

2022-05-27 Thread Mark Dale via Mailman-Users


>> ...which I found googling ‘how to disable a mailman 2 list’ because I’d like 
>> to know how, too, since we do occasionally have need to do this.)


> The method in that thread is simply moving the lists/ aside. That 
> is one way to disable a list, but there are others depending on what you 
> actually want. ...



To disable a list:

chmod 000 $PATH/lists/


And to re-enable it:

chmod 2775 $PATH/lists/
--
Mailman-Users mailing list -- mailman-users@python.org
To unsubscribe send an email to mailman-users-le...@python.org
https://mail.python.org/mailman3/lists/mailman-users.python.org/
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: https://www.mail-archive.com/mailman-users@python.org/
https://mail.python.org/archives/list/mailman-users@python.org/


[Mailman-Users] Re: Question on outputting all lists and list owners and a process for batch disabling of lists without an owner

2022-05-27 Thread John Lake
Thanks very much Bruce and Mark!  

Much appreciated,

John

On 5/27/22, 1:53 PM, "Mark Sapiro"  wrote:

On 5/27/22 12:47, Bruce Johnson via Mailman-Users wrote:
> Well some guy named Mark supported one method in the past 8-) (which I 
found googling ‘how to disable a mailman 2 list’ because I’d like to know how, 
too, since we do occasionally have need to do this.)
> 
> 
https://urldefense.com/v3/__https://mail.python.org/pipermail/mailman-users/2010-September/070283.html__;!!C5qS4YX3!AJcsaCQavpDgwaaIVqilPzNAu0rJ_NfoDw_GIKESav0V0oT2bK06YElcB7px4bxmW9JrUvOMkdrHNRxH$
 

The method in that thread is simply moving the lists/ aside. 
That is one way to disable a list, but there are others depending on 
what you actually want. For that, this withlist script will do it.
```
import os
from Mailman import Site
BACKUP_DIR = 'path to a mailman writable directory'
def no_owner(mlist)
 if len mlist.owner == 0:
 print('List %s has no owners, disabling.' % mlist.real_name)
 src = Site.get_listpath(mlist.internal_name())
 dst = os.path.join(BACKUP_DIR, mlist.internal_name())
 os.rename(src, dst)
```
BACKUP_DIR is set to the full path of the directory in which to save the 
list configurations. To avoid potential issues with os.rename, 
BACKUP_DIR should be on the same file system as Mailman's lists/ directory.

-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
--
Mailman-Users mailing list -- mailman-users@python.org
To unsubscribe send an email to mailman-users-le...@python.org

https://urldefense.com/v3/__https://mail.python.org/mailman3/lists/mailman-users.python.org/__;!!C5qS4YX3!AJcsaCQavpDgwaaIVqilPzNAu0rJ_NfoDw_GIKESav0V0oT2bK06YElcB7px4bxmW9JrUvOMkcv2vDVU$
 
Mailman FAQ: 
https://urldefense.com/v3/__http://wiki.list.org/x/AgA3__;!!C5qS4YX3!AJcsaCQavpDgwaaIVqilPzNAu0rJ_NfoDw_GIKESav0V0oT2bK06YElcB7px4bxmW9JrUvOMkdThkNA2$
 
Security Policy: 
https://urldefense.com/v3/__http://wiki.list.org/x/QIA9__;!!C5qS4YX3!AJcsaCQavpDgwaaIVqilPzNAu0rJ_NfoDw_GIKESav0V0oT2bK06YElcB7px4bxmW9JrUvOMkW3OTXfV$
 
Searchable Archives: mailman-users@python.org 
https://urldefense.com/v3/__https://www.mail-archive.com/mailman-users@python.org/__;!!C5qS4YX3!AJcsaCQavpDgwaaIVqilPzNAu0rJ_NfoDw_GIKESav0V0oT2bK06YElcB7px4bxmW9JrUvOMkRS9z4yU$
 
mailman-users@python.org 
https://urldefense.com/v3/__https://mail.python.org/archives/list/mailman-users@python.org/__;!!C5qS4YX3!AJcsaCQavpDgwaaIVqilPzNAu0rJ_NfoDw_GIKESav0V0oT2bK06YElcB7px4bxmW9JrUvOMke2Nwy1w$
 

--
Mailman-Users mailing list -- mailman-users@python.org
To unsubscribe send an email to mailman-users-le...@python.org
https://mail.python.org/mailman3/lists/mailman-users.python.org/
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: https://www.mail-archive.com/mailman-users@python.org/
https://mail.python.org/archives/list/mailman-users@python.org/


[Mailman-Users] Re: Question on outputting all lists and list owners and a process for batch disabling of lists without an owner

2022-05-27 Thread Mark Sapiro

On 5/27/22 12:47, Bruce Johnson via Mailman-Users wrote:

Well some guy named Mark supported one method in the past 8-) (which I found 
googling ‘how to disable a mailman 2 list’ because I’d like to know how, too, 
since we do occasionally have need to do this.)

https://mail.python.org/pipermail/mailman-users/2010-September/070283.html


The method in that thread is simply moving the lists/ aside. 
That is one way to disable a list, but there are others depending on 
what you actually want. For that, this withlist script will do it.

```
import os
from Mailman import Site
BACKUP_DIR = 'path to a mailman writable directory'
def no_owner(mlist)
if len mlist.owner == 0:
print('List %s has no owners, disabling.' % mlist.real_name)
src = Site.get_listpath(mlist.internal_name())
dst = os.path.join(BACKUP_DIR, mlist.internal_name())
os.rename(src, dst)
```
BACKUP_DIR is set to the full path of the directory in which to save the 
list configurations. To avoid potential issues with os.rename, 
BACKUP_DIR should be on the same file system as Mailman's lists/ directory.


--
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
--
Mailman-Users mailing list -- mailman-users@python.org
To unsubscribe send an email to mailman-users-le...@python.org
https://mail.python.org/mailman3/lists/mailman-users.python.org/
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: https://www.mail-archive.com/mailman-users@python.org/
   https://mail.python.org/archives/list/mailman-users@python.org/


[Mailman-Users] Re: Question on outputting all lists and list owners and a process for batch disabling of lists without an owner

2022-05-27 Thread Bruce Johnson via Mailman-Users
Well some guy named Mark supported one method in the past 8-) (which I found 
googling ‘how to disable a mailman 2 list’ because I’d like to know how, too, 
since we do occasionally have need to do this.)

https://mail.python.org/pipermail/mailman-users/2010-September/070283.html

Since he appears to have shell access using the script you gave would let him 
move the list directory to someplace like /path/to/mailman/lists/[listname] to 
/path/to/mailman/disabled lists/[listname]

That would let him re-enable the list without having to recreate everything.

On May 27, 2022, at 11:49 AM, Mark Sapiro 
mailto:m...@msapiro.net>> wrote:

On 5/27/22 10:22, John Lake wrote:
Our security department has asked me to canvas all of our lists (4,237!)—and if 
a list owner value is not defined they want me to disable the list.
  1.  Can I combine the list_lists and list_owners commands to output both 
(hopefully linked) values as a .csv?

`list_owners -w` will list the owners by list name. If a list has no owners, 
only the list name will be output for that list. You could then process that 
file to identify the lists with no owners.


  2.  Is there a script that any of you have leveraged to batch disable lists 
without a defined owner?


What do you mean by `disable`?

A withlist script like
```
def no_owner(mlist)
   if len mlist.owner == 0:
   if not mlist.Locked:
   mlist.Lock
   print('List %s has no owners, disabling.' % mlist.real_name)
   
   mlist.Save()
   mlist.Unlock()
```
saved as no_owner.py in Mailman's bin/ directory and run via
```
bin/withlist -a -r no_owner
```
You could omit the code
```
   if not mlist.Locked:
   mlist.Lock
   
   mlist.Save()
   mlist.Unlock()
```
I.e., just leave the print statement in the `if len mlist.owner == 0:` clause 
to just print the names of lists with no owner.

--
Mark Sapiro mailto:m...@msapiro.net>>The highway is 
for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
--
Mailman-Users mailing list -- 
mailman-users@python.org
To unsubscribe send an email to 
mailman-users-le...@python.org
https://mail.python.org/mailman3/lists/mailman-users.python.org/
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: https://www.mail-archive.com/mailman-users@python.org/
  https://mail.python.org/archives/list/mailman-users@python.org/

--
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs

--
Mailman-Users mailing list -- mailman-users@python.org
To unsubscribe send an email to mailman-users-le...@python.org
https://mail.python.org/mailman3/lists/mailman-users.python.org/
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: https://www.mail-archive.com/mailman-users@python.org/
https://mail.python.org/archives/list/mailman-users@python.org/


[Mailman-Users] Re: Question on outputting all lists and list owners and a process for batch disabling of lists without an owner

2022-05-27 Thread Mark Sapiro

On 5/27/22 10:22, John Lake wrote:


Our security department has asked me to canvas all of our lists (4,237!)—and if 
a list owner value is not defined they want me to disable the list.


   1.  Can I combine the list_lists and list_owners commands to output both 
(hopefully linked) values as a .csv?


`list_owners -w` will list the owners by list name. If a list has no 
owners, only the list name will be output for that list. You could then 
process that file to identify the lists with no owners.




   2.  Is there a script that any of you have leveraged to batch disable lists 
without a defined owner?



What do you mean by `disable`?

A withlist script like
```
def no_owner(mlist)
if len mlist.owner == 0:
if not mlist.Locked:
mlist.Lock
print('List %s has no owners, disabling.' % mlist.real_name)
that meant>

mlist.Save()
mlist.Unlock()
```
saved as no_owner.py in Mailman's bin/ directory and run via
```
bin/withlist -a -r no_owner
```
You could omit the code
```
if not mlist.Locked:
mlist.Lock
that meant>

mlist.Save()
mlist.Unlock()
```
I.e., just leave the print statement in the `if len mlist.owner == 0:` 
clause to just print the names of lists with no owner.


--
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan
--
Mailman-Users mailing list -- mailman-users@python.org
To unsubscribe send an email to mailman-users-le...@python.org
https://mail.python.org/mailman3/lists/mailman-users.python.org/
Mailman FAQ: http://wiki.list.org/x/AgA3
Security Policy: http://wiki.list.org/x/QIA9
Searchable Archives: https://www.mail-archive.com/mailman-users@python.org/
   https://mail.python.org/archives/list/mailman-users@python.org/