Hi,

you read an article from thuban. Original link is there : https://ybad.name/ah/fr/05-mail/ i suggest you to read the full article with virtual users.

I suggest also to read the article from the creator of opensmtpd :

https://poolp.org/posts/2019-12-23/mettre-en-place-un-serveur-de-mail-avec-opensmtpd-dovecot-et-rspamd/ (french) https://poolp.org/posts/2019-09-14/setting-up-a-mail-server-with-opensmtpd-dovecot-and-rspamd/ (english)


From my understanding you need just to manage your system account as a simple Maildir Mailbox on a system user or a virtual user.

In this way : edit /etc/mail/aliases and to route all account like root, postmaster, www --> to the user system

example :

(...)
# Well-known aliases -- these should be filled in!
root:           <local account>
# manager:
# dumper:
<local account>:          <virtual email or local email>
(...)

All system account will be routed to root... and root will be routed to <as you want> ... Mail to original target will not be deleted, simply routed.

Oliv.


On 11/17/2020 5:29 PM, Matthieu C wrote:
Hi,

I am new to mail servers, and I ran into a nice tutorial from a French NGO. However, I'd like to tweak a bit my configuration, and I cannot find a proper way to achieve my goal: I want to discard mails whose recipient is the address my_system_u...@my-domain.net <mailto:my_system_u...@my-domain.net> (and r...@my-domain.net <mailto:r...@my-domain.net> and so on), while accepting mails to be routed to my_system_user, through a list of aliases or virtual users. In fact, I want all the mails to go through this system user, and to be read by a unique dovecot account (hence, I'd say the simplest way to do is to have an unique Maildir?).

I created a thread on Stack Overflow for that matter: https://stackoverflow.com/questions/64715521/prevent-mailing-to-my-username-in-opensmtp-config <https://stackoverflow.com/questions/64715521/prevent-mailing-to-my-username-in-opensmtp-config> ; its content is below:

    I just set up my own mail server at home with OpenSMTP and Dovecot
    (I used this tutorial
    
<https://framacloud.org/fr/auto-hebergement/installation.html#courrier-%C3%A9lectronique>
    from Framasoft). I don't like the idea that people can mail to
    /my_system_u...@my-domain.net
    <mailto:my_system_u...@my-domain.net>/ or /r...@my-domain.net
    <mailto:r...@my-domain.net>/ (or any other system user), although
    I'll use this only /my_system_user/ account to receive my mails.

    That's why I added |root: /dev/null| and
    |my_system_u...@my-domain.net
    <mailto:my_system_u...@my-domain.net>: /dev/null| to my
    |/home/my_system_user/.myaliases| file (+ |makemap -t aliases
    ~/.myaliases|). But I still receive the mails for
    /my_system_u...@my-domain.net
    <mailto:my_system_u...@my-domain.net>/. Maybe I shouldn't go
    through the hassle of preventing this?

    |table aliases file:/etc/aliases table own_aliases
    file:/home/my_system_user/.myaliases pki mail.my-domain.net
    <http://mail.my-domain.net> key
    "/etc/letsencrypt/live/mail.my-domain.net/privkey.pem
    <http://mail.my-domain.net/privkey.pem>" pki mail.my-domain.net
    <http://mail.my-domain.net> certificate
    "/etc/letsencrypt/live/mail.my-domain.net/cert.pem
    <http://mail.my-domain.net/cert.pem>" # Deliver listen on lo
    listen on lo port 10029 tag DKIM listen on lo port 10036 tag
    ANTISPAM listen on eth0 port 25 hostname mail.my-domain.net
    <http://mail.my-domain.net> tls pki mail.my-domain.net
    <http://mail.my-domain.net> listen on eth0 port 587 hostname
    mail.my-domain.net <http://mail.my-domain.net> tls-require pki
    mail.my-domain.net <http://mail.my-domain.net> auth accept tagged
    ANTISPAM for any alias <own_aliases> deliver to maildir
    "~/Maildir" accept from local for local alias <aliases> deliver to
    maildir "~/Maildir" #accept from any for domain "my-domain.net
    <http://my-domain.net>" alias <own_aliases> deliver to maildir
    "~/Maildir" # antispam accept from any for domain "my-domain.net
    <http://my-domain.net>" relay via smtp://127.0.0.1:10035
    <http://127.0.0.1:10035> # Relay # dkim tagged can be sent accept
    tagged DKIM for any relay hostname mail.my-domain.net
    <http://mail.my-domain.net> # if not dkim tagged, send it to
    dkimproxy accept from local for any relay via
    smtp://127.0.0.1:10028 <http://127.0.0.1:10028> hostname
    mail.my-domain.net <http://mail.my-domain.net> |

    In my search, I found out that virtual users could be a solution
    (source)
    
<http://z5t1.com:8080/cucumber/cucumber-1.1/source/net-extra/opensmtpd/doc/example1.html#stats>,
    but it seems overkill to me (setting up a new /vmail/ user, new
    password table, new services...): I have only one repicient
    account with multiple (~10) aliases.


Any help is appreciated!
Best regards,

choumat

Reply via email to