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]  myusern...@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 s...@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

Reply via email to