How to setup local network passwordless mail gateway to one single gmail account

0

I have several linux and windows boxes on my home network. I also have Rpi (first one with 1core cpu; model B without +) acting as my core server for dhcp and local dns only.

Rpi

  • newest raspbian
  • clean image
  • ssh enabled with root accessible only via key
  • pi user disabled
  • not available to internet but has access via nat on router
  • 8gb sd card

Please keep in mind that all terminology regarding email system is somewhat fuzzy to me at this point.

I would like to setup on rpi MTA (as I understand that's what is required here) to:

  • receive email from local system (rpi) and other systems on my network without authentication
  • forward them to one single gmail account (my private/free email i use for my private stuff)

I would also like to setup other boxes to be able to use this MTA on rpi as mail gateway so it would be possible to easy send email (most likely from scripts) from non-existing emails like mygmaillogin+hostname@gmail.com or something similar. Hostname should be added automatically by MTA before forwarding it further or login should be set as hostname and then MTA on rpi should prepend it with my "gmaillogin+" and change server to gmail.com.

Some Windows box (no authentication) \
                                      > RPI (authenticated) > My GMAIL
Some Linux box   (no authentication) /  + local rpi mails

Now the thing is that although I know what smtp/imap/pop3, ssl/tls is I get lost in multitude of ways of configuring mentioned setup. If you can please help me with correct collection of tools/packages I need to install on rpi and any other linux box which should use this rpi mail gateway I would be grateful.

What I do understand:

  • MTA - the thing which sends email from my rpi to gmail; should act as internal smtp server;
  • MUA - a mail program which uses smtp server to send email to

What I don't uderstand:

  • Do I need to install dovecot or cyrrus or courier? I don't think I need to. I don't have own mailboxes. I don't have domain. So why use mail server? Sorry I'm just lost here.
  • What to choose for MTA ? I know that there is sendmail which is old and shouldn't be used due to security issues; exim is newer and easier to setup and has huge community; postfix is even newer and very strict and has better performance than exim; Maybe there are others like qmail but I haven't found a comparison for them so I don't know which one would be the best.
  • how to configure MTA on rpi as gateway
  • how to configure MTA on other linux boxes as to forward local emails from services to this gateway mta which would in return forward it to my gmail account.
  • how to setup similar thing on windows box to send emails to gateway.
  • how to setup gmail authentication which would use api key instead of password which I can change easily. I know there's a way to generate api key to authentication to gmail service.

All of the above is for emails from unattended services. For normal mails written and read by human I use normal, graphical client. Mostly gmail web interface on windows.

Lastly. Setting this up will be finally done by ansible so after configuring everything I would like to rewrite it to ansible so it would be portable across raspbian upgrades from clean image. But that part I should be able to handle myself. I already have extensive setup done such way. But for now I need to know how to setup mail system.

I know this is very broad question but after reading all this stuff I'm unsure what and where I should do now.

What I have already read:

In polish:

termil0r

Posted 2019-05-19T12:22:03.203

Reputation: 131

No answers