Mailing List Archive

Local mail server
Afternoon all,

I'd like to set up a little box to be a local mail server. It would receive
mails from other machines on the LAN, and it would fetch POP3 mail from my ISP
and IMAP mail from google mail. KMail on my workstation would then read the
mails via IMAP. That's all. I might want to add a few extras later, such as
receiving SMTP mail for a .me domain I own. My present total of emails is
about 4000.

I used to have a working system on a box that's now deceased [1], but in
replicating it I'm having difficulty threading my way through the mutually
inconsistent Gentoo mail server docs, omitting the bits I don't need and
interpreting the rest. Bits I don't need? Database backend, web-mail access,
web admin tools, fancy multi-user authorisation, any other baroque complexity.

So I'm asking what systems other people use. I can't be unusual in what I
want, so there must be lots of solutions out there somewhere. Would anyone
like to offer me some advice?

1. Yes, of course I did have backups, but in juggling the media I managed to
lose them. A world of advice to others: don't grow old. :)

--
Regards,
Peter.
Re: Local mail server [ In reply to ]
On 19/07/2020 15:18, Peter Humphrey wrote:
> So I'm asking what systems other people use. I can't be unusual in what I
> want, so there must be lots of solutions out there somewhere. Would anyone
> like to offer me some advice?

Doing my best to remember my setup ...

Running postfix as my mail server. I never managed to get it working to
SEND email, so clients had to be configured to send straight to my ISP.
Don't send to google - it rewrites the headers ...

Used fetchmail to download, until an upgrade/fix/something broke MySQL
so all my virtual email addresses broke.

Use Courier-IMAP to provide access from clients to the mail store.

I *think* that's all, but I dunno how long my system has been running
(it hasn't even been updated for a couple of years :-( and apart from
that MySQL problem it's been running untouched pretty much from day 1.

Cheers,
Wol
Re: Local mail server [ In reply to ]
On Sunday, 19 July 2020 16:48:29 BST antlists wrote:
> On 19/07/2020 15:18, Peter Humphrey wrote:
> > So I'm asking what systems other people use. I can't be unusual in what I
> > want, so there must be lots of solutions out there somewhere. Would anyone
> > like to offer me some advice?
>
> Doing my best to remember my setup ...
>
> Running postfix as my mail server. I never managed to get it working to
> SEND email, so clients had to be configured to send straight to my ISP.
> Don't send to google - it rewrites the headers ...
>
> Used fetchmail to download, until an upgrade/fix/something broke MySQL
> so all my virtual email addresses broke.
>
> Use Courier-IMAP to provide access from clients to the mail store.
>
> I *think* that's all, but I dunno how long my system has been running
> (it hasn't even been updated for a couple of years :-( and apart from
> that MySQL problem it's been running untouched pretty much from day 1.
>
> Cheers,
> Wol

Notwithstanding a recent security vulnerability net-mail/dovecot may be able
to do all you want/need from a home mailserver.
Re: Local mail server [ In reply to ]
Dovecot works well enough, catch is that it has some security
issues. My fix is to have it run on localhost and ssh tunnel
local ports into 143 & 25 on the in-house server. At that point
postfix + dovecot work fine for me.


--
Steven Lembark
Workhorse Computing
lembark@wrkhors.com
+1 888 359 3508
Re: Local mail server [ In reply to ]
Am Sonntag, 19. Juli 2020, 16:18:32 CEST schrieb Peter Humphrey:
> Afternoon all,
>
> I'd like to set up a little box to be a local mail server. It would receive
> mails from other machines on the LAN, and it would fetch POP3 mail from my
> ISP and IMAP mail from google mail.

For me this was a good starting point:
https://wiki.gentoo.org/wiki/Complete_Virtual_Mail_Server[1]

I placed a Gentoo VM for this on my Proxmox VM server doing the job.

regards
Petric


--------
[1] https://wiki.gentoo.org/wiki/Complete_Virtual_Mail_Server
Re: Local mail server [ In reply to ]
On 7/19/20 8:18 AM, Peter Humphrey wrote:
> Afternoon all,

Hi,

> I'd like to set up a little box to be a local mail server. It would
> receive mails from other machines on the LAN, and it would fetch
> POP3 mail from my ISP and IMAP mail from google mail. KMail on my
> workstation would then read the mails via IMAP. That's all. I might
> want to add a few extras later, such as receiving SMTP mail for a
> .me domain I own. My present total of emails is about 4000.

That should be quite possible to do.

IMHO there's not much difference in an internal only and an externally
accessible mail server as far as the software & configuration that's on
said server. The only real difference is what the world thinks of it.

> I used to have a working system on a box that's now deceased
> [1], but in replicating it I'm having difficulty threading my
> way through the mutually inconsistent Gentoo mail server docs,
> omitting the bits I don't need and interpreting the rest. Bits I
> don't need? Database backend, web-mail access, web admin tools,
> fancy multi-user authorisation, any other baroque complexity.

There are a LOT of ways to do this. You need to pick the program that
you want to use for various functions:

- SMTP: Sendmail (my preference), Postfix (quite popular), etc.
- IMAP: Courier (my preference), Dovecot (quite popular), etc.
- POP3: Courier, Dovecot (?), QPopper (?), etc.
- LDA: Procmail (my preference), delivermail, etc.

Pick the programs that you want to run, possibly influenced by what they
do and don't support to find an overlap that works. E.g. Maildir used
to be less well supported than it is today.

You have already indicated that you want to use fetchmail (or something
like it).

> So I'm asking what systems other people use. I can't be unusual in what
> I want, so there must be lots of solutions out there somewhere. Would
> anyone like to offer me some advice?

I actually think it's more unusual to want to run an email server that
doesn't receive email directly from the world vs one that does. But
whatever you want.

As others have alluded to, sending email may be tricky, but ultimately
possible to do. It will have a LOT to do with what domain name you use,
and if you have your server smart host through something else.

> 1. Yes, of course I did have backups, but in juggling the media I
> managed to lose them. A world of advice to others: don't grow old. :)

Oops!



--
Grant. . . .
unix || die
Re: Local mail server [ In reply to ]
On Sun, 19 Jul 2020 15:18:32 +0100, Peter Humphrey wrote:

> I used to have a working system on a box that's now deceased [1], but
> in replicating it I'm having difficulty threading my way through the
> mutually inconsistent Gentoo mail server docs, omitting the bits I
> don't need and interpreting the rest. Bits I don't need? Database
> backend, web-mail access, web admin tools, fancy multi-user
> authorisation, any other baroque complexity.

I use Postfix for SMTP, Dovecot for IMAP and getmail to fetch mail from a
POP3 account (other mail is delivered directory to Postfix).

I also use procmail for filtering - although if you already have this set
up in KMail, that should suffice - and dspam for spam filtering.


--
Neil Bothwick

Never ask a geek why, just nod your head and slowly back away
Re: Local mail server [ In reply to ]
On Monday, 20 July 2020 12:33:50 BST Neil Bothwick wrote:

> I use Postfix for SMTP, Dovecot for IMAP and getmail to fetch mail from a
> POP3 account (other mail is delivered directory to Postfix).

That's what I want to use, except for fetchmail instead of getmail.

I'm taking the suggestions in this thread (thanks), and following the simple
mail server guide [1]. I've made precisely two changes in main.cf: soft_bounce
= yes, mynetworks_style = host. Everything else is left at its default.

Postfix starts okay, but when I 'telnet localhost 25' I get this in the log:

fatal: in parameter smtpd_relay_restrictions or smtpd_recipient_restrictions,
specify at least one working instance of: reject_unauth_destination,
defer_unauth_destination, reject, defer, defer_if_permit or
check_relay_domains

Which of those restrictions do I specify, and where, and why aren't they set
by default?

> I also use procmail for filtering - although if you already have this set
> up in KMail, that should suffice - and dspam for spam filtering.

Yes, KMail is fine for this, with spamassassin.

1. https://wiki.gentoo.org/wiki/Postfix

--
Regards,
Peter.
Re: Local mail server [ In reply to ]
On 20/07/2020 15:55, Peter Humphrey wrote:
> fatal: in parameter smtpd_relay_restrictions or smtpd_recipient_restrictions,
> specify at least one working instance of: reject_unauth_destination,
> defer_unauth_destination, reject, defer, defer_if_permit or
> check_relay_domains
>
> Which of those restrictions do I specify, and where, and why aren't they set
> by default?

I'm guessing that's because it needs to know what to do with an email ...

The language is odd, but I suspect it's saying "do I relay this message
and if so how, or do I deliver and and if so how do I know where and to
who?"

None of these can be known by default...

Cheers,
Wol
Re: Local mail server [ In reply to ]
On 2020-07-20 12:39, antlists wrote:
> On 20/07/2020 15:55, Peter Humphrey wrote:
>> fatal: in parameter smtpd_relay_restrictions or smtpd_recipient_restrictions,
>> specify at least one working instance of: reject_unauth_destination,
>> defer_unauth_destination, reject, defer, defer_if_permit or
>> check_relay_domains
>>
>> Which of those restrictions do I specify, and where, and why aren't they set
>> by default?
>

(I missed the original mail, so I'm replying here.)

If you don't specify one of those restrictions in one of those places,
your mail server is an open relay. Postfix doesn't let you do that.

One of them is set by default; smtpd_relay_restrictions end with
defer_unauth_destination on new installs.
Re: Local mail server [ In reply to ]
I have used "https://wiki.gentoo.org/wiki/Mailfiltering_Gateway/en" or
variations of for many years - currently on an lxc instance on a low
power arm server.  Handles 1-200 emails (including spam) a day with
potentially up to quite a few thousand.  I am using the configuration
without mysql etc.  My biggest maintenance on it is trying to keep the
permissions correct after upgrades etc., otherwise as the families mail
gateway its quite reliable.

BillK


On 19/7/20 10:18 pm, Peter Humphrey wrote:
> Afternoon all,
>
> I'd like to set up a little box to be a local mail server. It would receive
> mails from other machines on the LAN, and it would fetch POP3 mail from my ISP
> and IMAP mail from google mail. KMail on my workstation would then read the
> mails via IMAP. That's all. I might want to add a few extras later, such as
> receiving SMTP mail for a .me domain I own. My present total of emails is
> about 4000.
>
> I used to have a working system on a box that's now deceased [1], but in
> replicating it I'm having difficulty threading my way through the mutually
> inconsistent Gentoo mail server docs, omitting the bits I don't need and
> interpreting the rest. Bits I don't need? Database backend, web-mail access,
> web admin tools, fancy multi-user authorisation, any other baroque complexity.
>
> So I'm asking what systems other people use. I can't be unusual in what I
> want, so there must be lots of solutions out there somewhere. Would anyone
> like to offer me some advice?
>
> 1. Yes, of course I did have backups, but in juggling the media I managed to
> lose them. A world of advice to others: don't grow old. :)
>
Re: Local mail server [ In reply to ]
On Monday, 20 July 2020 18:25:28 BST Michael Orlitzky wrote:
> On 2020-07-20 12:39, antlists wrote:
> > On 20/07/2020 15:55, Peter Humphrey wrote:
> >> fatal: in parameter smtpd_relay_restrictions or
> >> smtpd_recipient_restrictions, specify at least one working instance of:
> >> reject_unauth_destination, defer_unauth_destination, reject, defer,
> >> defer_if_permit or check_relay_domains
--->8
> If you don't specify one of those restrictions in one of those places,
> your mail server is an open relay. Postfix doesn't let you do that.
>
> One of them is set by default; smtpd_relay_restrictions end with
> defer_unauth_destination on new installs.

That command doesn't appear in my main.cf.

I ended up adding the following to main.cf:

-------
# Allow connections from trusted networks only.
smtpd_client_restrictions = permit_mynetworks, reject

# Don't talk to mail systems that don't know their own hostname.
smtpd_helo_restrictions = reject_unknown_helo_hostname

# Don't accept mail from domains that don't exist.
smtpd_sender_restrictions = reject_unknown_sender_domain

smtpd_recipient_restrictions = permit_mynetworks,
permit_sasl_authenticated,

smtpd_relay_restrictions = permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination

# Block clients that speak too early.
smtpd_data_restrictions = reject_unauth_pipelining

-------

Those came from http://www.postfix.org/SMTPD_ACCESS_README.html.

I don't know what use the page https://wiki.gentoo.org/wiki/Postfix is: it
hasn't helped me at all.

As usual, though, the kind people on this list certainly have! Thank you all.

--
Regards,
Peter.
Re: Local mail server [ In reply to ]
On Sunday, 19 July 2020 15:18:32 BST I wrote:

<snipped>

I think I'm nearly there, but still one config problem eludes me.

The setup is fetchmail > postfix > dovecot.

Postfix is trying to deliver some mail (not all) to me@this-workstation instead
of to its own machine, and I can't see why. I've tried a couple of relay-host
settings, but then I just get "warning: relayhost configuration problem" in the
log, so relay-host is now back to its default value.

Here's an excerpt from main.cf:

myhostname = serv.<my.local.domain>
mydomain = <my.local.domain>
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

I've tried omitting $mydomain from that last line, but it didn't help.

Can anyone see what I'm missing? (More of main.cf if needed.)

--
Regards,
Peter.
Re: Local mail server [ In reply to ]
On 7/25/20 8:09 AM, Peter Humphrey wrote:
> On Sunday, 19 July 2020 15:18:32 BST I wrote:
>
> <snipped>
>
> I think I'm nearly there, but still one config problem eludes me.
>
> The setup is fetchmail > postfix > dovecot.
>
> Postfix is trying to deliver some mail (not all) to me@this-workstation instead
> of to its own machine, and I can't see why. I've tried a couple of relay-host
> settings, but then I just get "warning: relayhost configuration problem" in the
> log, so relay-host is now back to its default value.
>
> Here's an excerpt from main.cf:
>
> myhostname = serv.<my.local.domain>
> mydomain = <my.local.domain>
> mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
>
> I've tried omitting $mydomain from that last line, but it didn't help.
>
> Can anyone see what I'm missing? (More of main.cf if needed.)

Hello Peter,

I just ran across this document. I hope you find it relevant to your
mail issues.


https://bridge.grumpy-troll.org/2020/07/small-mailserver-bcp/

Small Mailserver Best Current Practices


James
Re: Local mail server [ In reply to ]
On Monday, 27 July 2020 22:10:59 BST james wrote:

> I just ran across this document. I hope you find it relevant to your
> mail issues.
>
> https://bridge.grumpy-troll.org/2020/07/small-mailserver-bcp/
>
> Small Mailserver Best Current Practices

Thank you James.

I seem to have fixed my problem by removing the specific addresses from
mynetworks and setting mynetworkstyle = subnet.

That doesn't make sense to me, but hey-ho.

--
Regards,
Peter.
Re: Local mail server [ In reply to ]
On 7/28/20 4:23 AM, Peter Humphrey wrote:
> On Monday, 27 July 2020 22:10:59 BST james wrote:
>
>> I just ran across this document. I hope you find it relevant to your
>> mail issues.
>>
>> https://bridge.grumpy-troll.org/2020/07/small-mailserver-bcp/
>>
>> Small Mailserver Best Current Practices
>
> Thank you James.
>
> I seem to have fixed my problem by removing the specific addresses from
> mynetworks and setting mynetworkstyle = subnet.
>
> That doesn't make sense to me, but hey-ho.
>


Good news.

But I'm still looking for that complete list of (gentoo ebuild) codes to
run on top of 2-4 stems, for a small, but feature rich solution for

(2) DNS resolvers, (?) mail-servers for a robust mail system that "I"
admin, and (1) internet facing web server and (1) internal only facing
or limited outward facing Web server for development and security based
testing. Static IP are basically $5/month from my ISP.

So this is a point of curiosity for you or anyone with such a setup; but
only what they wish to reveal publically. A private disclosure, and
howto is ok too,
and I'll respect your privacy of such detail.

Eventually, when the Rasp.Pi_4 can map or at least utilize 16G of ram, I
want to move the entire operation to Rp4s. Then I can have one setup
stationary, and one mobile in my RV. The thought is the RF (pseudo)
statics are dominate, unless I travel to an area in the US, that does
not have connectivity for a mobile rig.

Anyone is encouraged, publically or privately, to make suggestions.
Eventually, the choices and basic instruction should make it to a web
page document.

If several folks go down this pathway, then the security and security
testing semantics, to ensure it is robustly safe, could be well
documents, via a group effort. So all can benefit and stay safe. Adding
a secure version of Slack, to these stacks, would be pretty cool too.

After all, such a setup would be sweet, and allow for for travel and
still be in charge of all of your resources.
Re: Local mail server [ In reply to ]
On 28/07/20 16:01, james wrote:
> (2) DNS resolvers, (?) mail-servers for a robust mail system that "I"
> admin, and (1) internet facing web server and (1) internal only facing
> or limited outward facing Web server for development and security based
> testing. Static IP are basically $5/month from my ISP.

Do you really want to pay for a static IP? I'd go IPv6 instead.

I learnt my v4 in the days of 10-base-2, and I'd really love to update
to punching holes in a v6 router. Limited risk, and no worries about
static IPs, NATing, all that legacy stuff ... :-)

Cheers,
Wol
Re: Local mail server [ In reply to ]
On 7/28/20 12:10 PM, Wols Lists wrote:
> On 28/07/20 16:01, james wrote:
>> (2) DNS resolvers, (?) mail-servers for a robust mail system that "I"
>> admin, and (1) internet facing web server and (1) internal only facing
>> or limited outward facing Web server for development and security based
>> testing. Static IP are basically $5/month from my ISP.
>
> Do you really want to pay for a static IP? I'd go IPv6 instead.
>
> I learnt my v4 in the days of 10-base-2, and I'd really love to update
> to punching holes in a v6 router. Limited risk, and no worries about
> static IPs, NATing, all that legacy stuff ... :-)
>
> Cheers,
> Wol
>


So, IPv6 can be assigned without payment to an ISP? Besides having
static IPs without bandwidth connections routed (assigned) to those IP6
addresses are not useful?


If I go IPv6, where does the bandwidth come from?

confused,
James
Re: Local mail server [ In reply to ]
On 7/28/20 12:05 PM, Wols Lists wrote:
> On 28/07/20 16:01, james wrote:
>> (2) DNS resolvers, (?) mail-servers for a robust mail system that "I"
>> admin, and (1) internet facing web server and (1) internal only facing
>> or limited outward facing Web server for development and security based
>> testing. Static IP are basically $5/month from my ISP.
>
> Do you really want to pay for a static IP? I'd go IPv6 instead.
>
> I learnt my v4 in the days of 10-base-2, and I'd really love to update
> to punching holes in a v6 router. Limited risk, and no worries about
> static IPs, NATing, all that legacy stuff ... :-)
>
> Cheers,
> Wol
>


It's the bandwidth provider's policy. Static IPs (4 or 6) requires a
monthly fee. If you know a way around this, with full privileges one
gets with static IP addresses, I'm all ears.....?

I do not want some limited/dysfunctional solution. I want/need the full
ability of what static IPs addresses bring. (all ports open etc).

I am curious about your details via IPv6 and static (permanently
assigned ) addresses.

James
Re: Local mail server [ In reply to ]
On 7/28/20 5:18 PM, james wrote:
> If you know a way around this, with full privileges one gets with static
> IP addresses, I'm all ears.....?

A hack that I see used is to pick up a small VPS for a nominal monthly
fee and establish a VPN to it. Have it's IP (and ports) directed
through the VPN to your local system. You get just about everything,
save for what's specifically needed for the VPN.



--
Grant. . . .
unix || die
Re: Local mail server [ In reply to ]
On 29/07/20 00:18, james wrote:
> It's the bandwidth provider's policy. Static IPs (4 or 6) requires a
> monthly fee. If you know a way around this, with full privileges one
> gets with static IP addresses, I'm all ears.....?

????? I can understand a fee for a static IP4 - they've run out, after
all, and people are fighting over them ...

Don't ISPs get a 2^64 allocation of IP6 *network* addresses? They should
just allocate one to your router and that's that! Still, I wouldn't put
it past them to charge extra for what should be free.
>
> I do not want some limited/dysfunctional solution. I want/need the full
> ability of what static IPs addresses bring. (all ports open etc).

That's not what a static IP brings, that's what a "globally known" IP
brings - if your router advertises its address to something like dyndns
every time it starts, you'll have the same result. Snag is, that's a
chargeable subscription, I believe.
>
> I am curious about your details via IPv6 and static (permanently
> assigned ) addresses.

That's why I need to dig and investigate :-) My first ISP in the days of
dial-up allocated a static IP as a matter of course. Not only was it
useful to use, it suited them because customers could only use it on one
computer at a time otherwise routing got screwed up :-)

Then we went to broadband, and in effect it was static because the
modem/router was always on ...


It'll be interesting digging through all this. Just try and make sure
you use your router as a firewall. I think my router drops all incoming
connections BY DEFAULT. But I can open up any port I want, either to
re-route to an internal computer or just pass through to it.

My first investigations would be (1) how do I advertise my router's
network address on dyndns, and (2) once the outside world knows my IP,
how do I let stuff through my router/firewall.

Cheers,
Wol
Re: Local mail server [ In reply to ]
On 29/07/20 00:11, james wrote:
> On 7/28/20 12:10 PM, Wols Lists wrote:
>> On 28/07/20 16:01, james wrote:
>>> (2) DNS resolvers, (?) mail-servers for a robust mail system that "I"
>>> admin, and (1) internet facing web server and (1) internal only facing
>>> or limited outward facing Web server for development and security based
>>> testing. Static IP are basically $5/month from my ISP.
>>
>> Do you really want to pay for a static IP? I'd go IPv6 instead.
>>
>> I learnt my v4 in the days of 10-base-2, and I'd really love to update
>> to punching holes in a v6 router. Limited risk, and no worries about
>> static IPs, NATing, all that legacy stuff ... :-)
>>
>> Cheers,
>> Wol
>>
>
>
> So, IPv6 can be assigned without payment to an ISP? Besides having
> static IPs without bandwidth connections routed (assigned) to those IP6
> addresses are not useful?
>
>
> If I go IPv6, where does the bandwidth come from?
>
From your ISP?

The OP's ISP charges EXTRA for a static address, which shouldn't be the
case seeing as they have oodles of the things. Or maybe I'm out-of-date,
seeing as my ISP in the old days provided a static IPv4 free of charge
as a matter of course.

Cheers,
Wol
Re: Local mail server [ In reply to ]
On 2020-07-29, Wols Lists <antlists@youngman.org.uk> wrote:

> ????? I can understand a fee for a static IP4 - they've run out,
> after all, and people are fighting over them ...
>
> Don't ISPs get a 2^64 allocation of IP6 *network* addresses? They
> should just allocate one to your router and that's that! Still, I
> wouldn't put it past them to charge extra for what should be free.

Pricing isn't based on cost. Pricing is based on what people are
willing to pay. People are willing to pay extra for a static IPv6
address, therefore static IPv6 addresses cost extra.

--
Grant
Re: Re: Local mail server [ In reply to ]
On Wednesday, 29 July 2020 13:59:11 BST Grant Edwards wrote:

> Pricing isn't based on cost. Pricing is based on what people are
> willing to pay. People are willing to pay extra for a static IPv6
> address, therefore static IPv6 addresses cost extra.

Aren't all IPv6 addresses static? Mine certainly are.

--
Regards,
Peter.
Re: Re: Local mail server [ In reply to ]
On 29/07/2020 16:41, Peter Humphrey wrote:
> On Wednesday, 29 July 2020 13:59:11 BST Grant Edwards wrote:
>
>> Pricing isn't based on cost. Pricing is based on what people are
>> willing to pay. People are willing to pay extra for a static IPv6
>> address, therefore static IPv6 addresses cost extra.
>
> Aren't all IPv6 addresses static? Mine certainly are.
>
I think there's static, and there's effectively static.

If your router is running 24/7, then the IP won't change even if it's
DHCP. But your router only needs to be switched off or otherwise off the
network for the TTL (time to live), and DHCP will assign you a different
IP when it comes back.

That's server-side configuration, so if the ISP doesn't elicitly
allocate you an address in their DHCP setup, what you've got is
effectively static not really static.

But it really should be so damn simple - take the ISP's network address,
add the last three octets of the customer's router or something like
that, and there's the customer's network v6 assigned to the customer's
router. One fixed address that won't change unless the customer changes
router or ISP.

I need to learn how v6 works ... :-)

Cheers,
Wol

1 2 3  View All