Ns8 rewrite sender outgoing like ns7

Rewrite outgoing email address - #8 by saitobenkei? U=france

In this post , thanks to @saitobenkei my neth7 had the opportunity to send emails by rewriting the sender . On ns8 sureemnte it will be possible to do it, but I don’t know how to do it. Also are /we are for some users waiting for a smtp relay to be implemented for all outgoing emails .

Thank you .

The NS8 Mail app is customizable, see GitHub - NethServer/ns8-mail: NS8 Mail module with SMTP, IMAP, Spam/Virus filter, so I just adapted the @saitobenkei solution including that postfix seems to use lmdb instead of hash now.

So, let’s enter the mail app environment: (in this example the mail app instance is named mail1)

runagent -m mail1

Let’s create a cf file /etc/postfix/main.cf.d/rewritesender.cf for rewriting senders…

podman exec -ti postfix vi /etc/postfix/main.cf.d/rewritesender.cf

with following content:

smtp_generic_maps = lmdb:/etc/postfix/main.cf.d/sender_rename

So we need another file /etc/postfix/main.cf.d/sender_rename holding the mail addresses to rewrite…

podman exec -ti postfix vi /etc/postfix/main.cf.d/sender_rename

with that content for example:

user@orig.mailadd1.org u.name@rewritten.mailadd2.com

Map file:

podman exec -ti postfix postmap /etc/postfix/main.cf.d/sender_rename

Restart postfix to apply the changes:

systemctl --user restart postfix

That’s it, mails should be rewritten now.

I think it’s already on the todo list but for now you could use following manual config:


Ciao Mark ecco il risultato :sleepy:

 runagent -m mail1
runagent: [INFO] starting bash -l
runagent: [INFO] working directory: /home/mail1/.config/state
[mail1@ns8 state]$ cd /etc/postfix/main.cf.d/
bash: cd: /etc/postfix/main.cf.d/: No such file or directory
[mail1@ns8 state]$ 

I think the usual problem has re-evered ( screenshot) merged…

If it’s about this, do you mind providing me with the syntax for mail1 to delete the merged?

i’am execute …

 runagent -m mail1 systemctl --user restart rspamd

Now is ok

1 Like

Please just enter the commands as I wrote them, there’s no need to do a cd /etc/postfix/main.cf.d/
The first command runagent -m mail1 enters the mail app environment and the second one podman exec -ti postfix vi /etc/postfix/main.cf.d/rewritesender.cf creates the file in the container using the right path and opens it for editing.

Was there a power outage or disk full or something like that? It seems the whole “podman cache” is destroyed.
If you find “invalid argument” in the app logs then you likely have the error again.
The commands for removing the merged dirs:

rmdir /home/mail1/.local/share/containers/storage/overlay/*/merged
runagent -m mail1 systemctl --user restart mail

Mark, sorry but I’m realizing that these problems related to the merged … are frequent and blocking. I wonder if Ns8 being in production, it is a continuous on the part of customers a frequent block.

You confirmed to me that unfortunately it occurs and I imagine that the team is working on it.

It occured once on my side after heavily testing my apps but on your server it seems to be a daily issue, that’s why I asked if there was a power outage or another issue maybe triggering this “podman cache” issue.

Sorry Mark I was too reckless and I forgot to write everything! Sorry .

1 Like

I don’t know .I don’t think the proxmox snaps, or an nfs problem. All the other servers are great .

No problem, there are some changes we need to get used to when customizing NS8.

Let’s hope that it’s just a one-time issue on our test servers…

Now I try . Ps: @mrmarkuz If you have time try to launch some snaps from proxmox , restore , delete etc. The only difference between yours and mine is NFS .
Clearly when you have time .

1 Like

@mrmarkuz Hi, I think unfortunately that the problems of the merged are generated by the roll back of the snaps or the deletion. When you can try to verify yourself, considering that you have the same system.


A snapshot is dependant, a backup is not!

I never use snapshots on Proxmox, as Backups are almost as fast with PBS.
But these are all independant from the “master”, while snapshots are not!

My 2 cents

Hi Andy, yes, definitely. But when I make changes I’ve been using them for a long time. Sometimes they recover from the PBS .

I add a scrub check on ZFS of the NAS, just to understand if the pool has problems but it’s all healthy …

OK, but the storage is on a ZFS on the NAS?
(TrueNAS Core?)

→ I’ld still try if you have the same errors with a full backup from Proxmox…
NethSecurity is still very small, space wise.

Sorry for the translation but I didn’t understand. The vm uses the quemu-guest-agents , the snap is performed by proxmox .


Thank you for your confirmation. I had assumed you were using a non-Proxmox storage with ZFS, and you have confirmed this.

→ If running on a Proxmox controlled ZFS pool, you probably would not be having these errors…

A NAS using XFS file system would not produce any errors, as Proxmox would use qcow2 as format, and this is capable of snapshots, while the XFS file system is not.

On ZFS, Proxmnox will attempt to use the raw format - thinking it controls that ZFS… The raw format does not support snapshots, it relies on the ZFS to do so.

My 2 cents

Never andy I’ve been using ZFS on XIGMANAS for years! All my VMs are there including Ns7 on which I have taken dozens of snapshots . Never had a problem.