From: kashani <kashani-list@badapple.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] Setting up SMTP relay
Date: Sat, 22 Jan 2011 14:01:16 -0800 [thread overview]
Message-ID: <4D3B53AC.904@badapple.net> (raw)
In-Reply-To: <4D3B4D53.7000209@wonkology.org>
On 1/22/2011 1:34 PM, Alex Schuster wrote:
> Hi there!
>
> On my desktop PC, I have set up ssmtp with access data for my mail
> server, so things like smartmontools or portage can send me emails.
>
> This is working fine. But there are other PCs in the LAN, which I would
> also like to get status emails from. Being not the only one with root
> access there, I do not want to duplicate the ssmtp setup because of the
> password stored in ssmtp.conf.
>
> Is there an easy solution? Like setting up a simple SMTP server on my
> desktop PC, that accepts connections from the LAN and forwards mails to
> my external mail server?
>
> I once had courier running, but did not really understand the
> configuration, and would not really like to set it up again. Or dovecot,
> which I heard good things about, so I would prefer it now. But maybe the
> default configuration only needs few changes for my purpose? Or maybe
> there is another simple tool that does just what I want?
>
> It's nothing important, so if there's no simple solution, I'll just skip
> this and check the logs from time to time.
>
> Wonko
>
I handle it with Postfix. Dovecot is only imap and won't accept main
directly.
1. install postfix with USE sasl or devecot-sasl, I don't believe it
matters which. Add the following lines to the bottom of
/etc/postfix/main.cf and fill in your hostname, domain, etc as needed.
# local settings
myhostname = host.domain.com
mydomain = domain.com
myorigin = $myhostname
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost
mynetworks_style = subnet
mynetworks = 127.0.0.0/8 10.19.20.0/24
smtpd_recipient_restrictions =
# reject_non_fqdn_recipient
# reject_non_fqdn_sender
# reject_unknown_recipient_domain
permit_mynetworks
reject_unauth_destination
permit
I commented out some of the checks above. Enable them if they'll work in
your environment. I recommend at least reject_unknown_recipient_domain
which doesn't allow recipients to domains that don't exist.
2. run sudo newaliases
Postfix bitches if the /etc/mail/aliases.db doesn't exist and will hang
on start.
3. Verify postfix works, isn't complaining in the logs, etc.
Make sure it's up and running. That you can telnet to port 25 from
another machine and even send to a local user on your machine.
4. Add the user/pass stuff to the bottom of /etc/postfix/main.cf
# relay host and credentials
relayhost = [my.external.relayhost.com]
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl.passwd
smtp_sasl_mechanism_filter = digest-md5
smtp_sasl_security_options = noanonymous
/etc/postfix/sasl.passwd
[my.external.relayhost.com] myusername@relayhost.com:my_secure_passwd
sudo postmap /etc/postfix/sasl.passwd
sudo /etc/init.d/postfix restart
Things to remember. You need to restart Postfix is your change the
password because it caches it. Also the relayhost name needs to match
*exactly* between the passwd file and main.cf.
5. Once you're this far it's time to test all the way through.
make sure you can send from the localhost machine
sendmail -v some@address.com
.
Once you're sure that works test from another machine on the network.
Ideally it should just work if you've done all the steps.
kashani
next prev parent reply other threads:[~2011-01-22 22:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-22 21:34 [gentoo-user] Setting up SMTP relay Alex Schuster
2011-01-22 22:01 ` kashani [this message]
2011-01-23 19:23 ` Alex Schuster
2011-01-23 19:56 ` kashani
2011-01-23 20:20 ` Alan McKinnon
2011-01-23 20:48 ` [gentoo-user] " walt
2011-01-23 21:04 ` Alan McKinnon
2011-01-24 0:02 ` [gentoo-user] " kashani
2011-01-24 0:26 ` Alan McKinnon
2011-01-24 1:22 ` kashani
2011-01-24 7:00 ` Mick
2011-01-24 7:24 ` Alan McKinnon
2011-01-24 7:06 ` Alan McKinnon
2011-02-05 14:37 ` Alex Schuster
2011-01-26 4:04 ` Walter Dnes
2011-01-26 6:46 ` Mick
2011-01-26 9:07 ` Stroller
2011-01-26 16:52 ` kashani
2011-01-28 23:48 ` Stroller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D3B53AC.904@badapple.net \
--to=kashani-list@badapple.net \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox