Enforce sender_login checks by default in Virtualmin postfix configuration

I haven’t found a Virtualmin option to enforce submission and smtps check for outgoing mail from mailboxes

The problem is that a logged user can send emails from any address because postfix, by default, doesn’t check that

the directives to enable are
smtpd_sender_login_maps in main.cf
reject_sender_login_mismatch in master.cf

also the smtpd_sender_login_maps needs a table in the “mails sasl_login” format so the /etc/postfix/virtual doesn’t work

I’ve created a script that can do it automatically:

#!/bin/bash

if [ “$(id -u)” = “0” ]; then
echo -n “” > /etc/postfix/login_map
for usermail in $(virtualmin list-users --all-domains --email-only)
do
echo “$usermail” “$usermail” >> /etc/postfix/login_map
done
postmap /etc/postfix/login_map
fi

it is raw but works