[Mailman-Users] Re: Pipermail scrubbing ascii txt to ksh attachment

2021-03-07 Thread Mark Sapiro
On 3/7/21 2:15 PM, Mark Dale via Mailman-Users wrote:
> 
> Hi Mark. Your patch to Scrubber.py has solved the problem. Thank you.


And this issue is reported at
 and the broken fix
committed at

and the fix for that at
.


-- 
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: Pipermail scrubbing ascii txt to ksh attachment

2021-03-07 Thread Mark Dale via Mailman-Users
 Original Message 
From: Mark Sapiro [mailto:m...@msapiro.net]
Sent: Saturday, March 6, 2021, 23:27 UTC
To: mailman-users@python.org
Subject: [Mailman-Users] Re: Pipermail scrubbing ascii txt to ksh attachment

> The patch I posted previously was bad. This one is correct. If you patch
> Scrubber.py with this patch, you won't need to edit the mbox and rebuild
> the archive as that message won't get scrubbed.

Hi Mark. Your patch to Scrubber.py has solved the problem. Thank you.

A summary below: 



PROBLEM: Plain text emails being automatically posted to a list, via a Perl 
script, were displaying okay in subscribers' email clients, but in the archive 
-- the body of the message is scrubbed as "attachment.ksh".

CAUSE: The headers of the posts to the list contained the lines: 

Content-Disposition: inline
Content-Type: text/plain 

Mark wrote: "If the script that sends this mail can be altered to either 
include the charset= on the Content-Type: text/plain header or not include the
Content-Disposition: inline header or both, that would solve this." He then 
wrote a patch for Mailman/Handlers/Scrubber.py to do this (in the event that 
the script could not be modified).

=== modified file 'Mailman/Handlers/Scrubber.py'
--- Mailman/Handlers/Scrubber.py2020-06-21 18:45:30 +
+++ Mailman/Handlers/Scrubber.py2021-03-06 19:10:28 +
@@ -90,6 +90,9 @@
 if ctype.lower == 'application/octet-stream':
 # For this type, all[0] is '.obj'. '.bin' is better.
 return '.bin'
+if ctype.lower == 'text/plain':
+# For this type, all[0] is '.ksh'. '.txt' is better.
+return '.txt'
 return all and all[0]
 
 
@@ -196,8 +199,11 @@
 format = part.get_param('format')
 delsp = part.get_param('delsp')
 # TK: if part is attached then check charset and scrub if none
-if part.get('content-disposition') and \
-   not part.get_content_charset():
+# MAS: Content-Disposition is not a good test for 'attached'.
+# RFC 2183 sec. 2.10 allows Content-Disposition on the main body.
+# Make it specifically 'attachment'.
+if (part.get('content-disposition', '').lower() == 'attachment'
+and not part.get_content_charset()):
 omask = os.umask(002)
 try:
 url = save_attachment(mlist, part, dir)


IN ADDITION: The following script was run to tidy up the list's .mbox file.

#!/bin/bash
PATH=/usr/sbin:/usr/bin:/sbin:/bin
LISTNAME=your_list_name_goes_here
echo $LISTNAME archive rebuild started at $(date +%H:%M:%S)
sed -i '/Content-Disposition: inline/d' 
/var/lib/mailman/archives/private/$LISTNAME.mbox/$LISTNAME.mbox
sed -i 's/Content-Type: text\/plain/Content-Type: text\/plain; 
charset="us-ascii"/' 
/var/lib/mailman/archives/private/$LISTNAME.mbox/$LISTNAME.mbox
/usr/lib/mailman/bin/arch --wipe $LISTNAME
echo $LISTNAME archive rebuild completed at $(date +%H:%M:%S)
exit 0


 
--
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: SPF trouble

2021-03-07 Thread Mark Sapiro
On 3/7/21 8:28 AM, Markus Grunwald via Mailman-Users wrote:
> 
> Now, virtual-mailman looks like this (just an extract):
> 
> 
> 
> # STANZA START: ankuendigungen
> # CREATED: Sun Mar  7 16:59:58 2021
> ankuendigun...@maennerchor-kirchseeon.de 
> ankuendigun...@maennerchor-kirchseeon.de
> ankuendigungen-ad...@maennerchor-kirchseeon.de 
> ankuendigungen-ad...@maennerchor-kirchseeon.de
> 


You can't do that. maennerchor-kirchseeon.de is a virtual domain so mail
to say ankuendigun...@maennerchor-kirchseeon.de gets looked up in
hash:/var/lib/mailman/data/virtual-mailman  which says send it to
ankuendigun...@maennerchor-kirchseeon.de which is the same virtual
domain so you have a loop. Whatever you set for
VIRTUAL_MAILMAN_LOCAL_DOMAIN must be a local domain, not a virtual domain.


-- 
Mark Sapiro The highway is for gamblers,
San Francisco Bay Area, Californiabetter use your sense - B. Dylan



signature.asc
Description: OpenPGP digital signature
--
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: SPF trouble

2021-03-07 Thread Markus Grunwald via Mailman-Users


Am Samstag den 06. März 2021 um 20:53:12 schrieb Mark Sapiro:


On 3/5/21 7:46 AM, Markus Grunwald via Mailman-Users wrote:
I have the test mail attached to this mail. There's something 
else strange:


X-Original-To: ankuendigun...@maennerchor-kirchseeon.de
Delivered-To: ankuendigun...@the-grue.de

Where does the "@the-grue.de" come from?



Postfix delivery.

This is the generated file 
/var/lib/mailman/data/virtual-mailman

...

# STANZA START: ankuendigungen
# CREATED: Thu Feb 18 14:28:43 2021
ankuendigun...@maennerchor-kirchseeon.de ankuendigungen



The above virtual mapping says deliver mail to
ankuendigun...@maennerchor-kirchseeon.de to the local address
ankuendigungen and postfix appends the local domain.


I see... I tried to fix that:

- rmlist ankuendigungen
- add VIRTUAL_MAILMAN_LOCAL_DOMAIN = 'maennerchor-kirchseeon.de' 
 to mm_cfg.py

- newlist ankuendigungen
- restore settings with config_list

Now, virtual-mailman looks like this (just an extract):


# STANZA START: ankuendigungen
# CREATED: Sun Mar  7 16:59:58 2021
ankuendigun...@maennerchor-kirchseeon.de 
ankuendigun...@maennerchor-kirchseeon.de
ankuendigungen-ad...@maennerchor-kirchseeon.de 
ankuendigungen-ad...@maennerchor-kirchseeon.de



I subscribed to the list, got the confirmation mail and replied to 
that. But now, the user is not known any more:


: user unknown

I didn't add that user, but I didn't have to add it when 
VIRTUAL_MAILMAN_LOCAL_DOMAIN wasn't set and it worked... What am I 
missing now?


That's my postfix config:

% sudo postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = yes
compatibility_level = 2
default_transport = smtp
dovecot-sa_destination_recipient_limit = 1
dovecot_destination_recipient_limit = 1
inet_interfaces = all
inet_protocols = ipv4
local_recipient_maps = $virtual_mailbox_maps
mailbox_size_limit = 5120
mailbox_transport = dovecot-sa
message_size_limit = 2048
milter_default_action = accept
milter_protocol = 2
mydestination = localhost, $mydomain
mydomain = the-grue.de
myhostname = the-grue.de
mynetworks = 127.0.0.0/8 [:::127.0.0.0]/104 [::1]/128
myorigin = $mydomain
non_smtpd_milters = unix:/run/opendkim/opendkim.sock
readme_directory = no
recipient_delimiter = +
relay_transport = smtp
relayhost =
sender_dependent_default_transport_maps = 
hash:/etc/postfix/sender_transport
smtp_tls_session_cache_database = 
btree:${data_directory}/smtp_scache

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
smtpd_client_restrictions = check_sender_access 
hash:/etc/postfix/sender_access, permit_mynetworks, 
permit_sasl_authenticated, reject_invalid_hostname, 
reject_unknown_client, reject_rbl_client sbl-xbl.spamhaus.org

smtpd_milters = unix:/run/opendkim/opendkim.sock
smtpd_recipient_limit = 250
smtpd_recipient_restrictions = check_sender_access 
hash:/etc/postfix/sender_access, permit_mynetworks, 
permit_sasl_authenticated, reject_unauth_destination

smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $mydomain
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_sasl_type = dovecot
smtpd_sender_restrictions = permit_mynetworks, 
reject_unknown_address, reject_unknown_sender_domain, 
reject_non_fqdn_sender

smtpd_tls_auth_only = yes
smtpd_tls_received_header = yes
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = 
btree:${data_directory}/smtpd_scache

smtpd_use_tls = yes
tls_random_source = dev:/dev/urandom
virtual_alias_maps = hash:/etc/postfix/virtual_alias, 
hash:/var/lib/mailman/data/virtual-mailman

virtual_gid_maps = static:5000
virtual_mailbox_base = /var/mail/vhosts
virtual_mailbox_domains = /etc/postfix/virtual_domains
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_minimum_uid = 100
virtual_transport = dovecot-sa
virtual_uid_maps = static:5000


Have a nice Sunday evening
--
Markus Grunwald
https://www.the-grue.de/~markus/markus_grunwald.gpg


signature.asc
Description: PGP signature
--
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/