[pmg-devel] [PATCH pmg-api v5 08/11] mailqueue: make mail queue writable by pmg group
Stoiko Ivanov
s.ivanov at proxmox.com
Thu Aug 14 02:13:35 CEST 2025
On Fri, 4 Apr 2025 15:14:35 +0200
Maximiliano Sandoval <m.sandoval at proxmox.com> wrote:
> Signed-off-by: Maximiliano Sandoval <m.sandoval at proxmox.com>
> ---
> debian/postinst | 9 +++++++++
> src/PMG/MailQueue.pm | 7 ++++---
> 2 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/debian/postinst b/debian/postinst
> index c12870fa..ba6497a0 100644
> --- a/debian/postinst
> +++ b/debian/postinst
> @@ -53,6 +53,15 @@ migrate_pmg_smtp_filter() {
>
> chown :pmg /var/lib/pmg
>
> + chown :pmg /var/spool/pmg/active
> + chown :pmg /var/spool/pmg/virus
> + chown :pmg /var/spool/pmg/spam
> + chown :pmg /var/spool/pmg/attachment
> + chmod g+w /var/spool/pmg/active
> + chmod g+w /var/spool/pmg/virus
> + chmod g+w /var/spool/pmg/spam
> + chmod g+w /var/spool/pmg/attachment
> +
I think this would be a bit more readable as a loop over `active virus spam
attachment`.
> if systemctl --quiet is-active rrdcached.service ; then
> systemctl daemon-reload
> deb-systemd-invoke reload-or-try-restart rrdcached.service >/dev/null || true
> diff --git a/src/PMG/MailQueue.pm b/src/PMG/MailQueue.pm
> index 4e37cb98..adbf28c1 100644
> --- a/src/PMG/MailQueue.pm
> +++ b/src/PMG/MailQueue.pm
> @@ -33,12 +33,13 @@ sub create_spooldirs {
> "$spooldir/attachment",
> ]) if $cleanup;
>
> - mkpath([
> + mkpath(
> "$spooldir/active",
> "$spooldir/spam",
> "$spooldir/virus",
> "$spooldir/attachment",
> - ]);
> + { group=>'pmg', chmod=>0775 },
> + );
>
> if ($lcid) {
> mkpath "$spooldir/cluster/$lcid/virus";
> @@ -68,7 +69,7 @@ sub new_fileid {
> my $uid;
> my $subsubdir = '';
>
> - if (!($fh = IO::File->new ($path, 'w+', 0600))) {
> + if (!($fh = IO::File->new ($path, 'w+', 0660))) {
> die "unable to create file '$path': $! : ERROR";
> }
>
More information about the pmg-devel
mailing list