Einen Überblick über das Administrationstool KeyHelp der Keyweb AG und dessen Download gibt es auf https://www.keyhelp.de

Dieses Forum soll es interessierten Benutzern ermöglichen, sich über KeyHelp auszutauschen und Hilfe bei Problemen zu finden.

Mail server

For questions and problems during the installation.
sempre
Beiträge: 1
Registriert: Fr 19. Jul 2019, 17:58

Mail server

Beitrag von sempre »

Hello,
How can I create email account for main panel domain which is also hostname?
Also, is it possible to modify mail() to send all panel e-mail notifications via external SMTP account?

Thanks
Benutzeravatar
Alexander
Keyweb AG
Beiträge: 1406
Registriert: Mi 20. Jan 2016, 02:23

Re: Mail server

Beitrag von Alexander »

In the following, I assume, you are currently have installed KeyHelp on "domain.com".
How can I create email account for main panel domain which is also hostname?
This could be one reason, you may want to change the hostname of the system to a subdomain to e.g. "keyhelp.domain.com" - this can be done via the KeyHelp configuration page, and after that you can create a user and assign the main domain "domain.com" to him. Than you can manage the email accounts within this user and maybe add a redirection for "domain.com" to "keyhelp.domain.com" within domain settings.
Alternatively, depending on your demands: Inside KeyHelp, have a look into the "Configuration" page -> Notifications" -> "Forward emails sent to common mailbox names of the server domain". Maybe this is already sufficient for your needs.

Also, is it possible to modify mail() to send all panel e-mail notifications via external SMTP account?
This is currently not possible, but i will add your point to the feature request list.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
lmarcos
Beiträge: 34
Registriert: So 26. Jan 2020, 12:55

Re: Mail server

Beitrag von lmarcos »

Alexander hat geschrieben:
Mi 24. Jul 2019, 09:43
Also, is it possible to modify mail() to send all panel e-mail notifications via external SMTP account?
This is currently not possible, but i will add your point to the feature request list.
What happened to this?

Actually, what I want is to be able to send email from both the domain and the external SMTP account and receive only in the other account. I suppose I will need to modify the MX records manually, but I have the DNS server disabled. Is there a way to check which would be the correct MX?
Benutzeravatar
Alexander
Keyweb AG
Beiträge: 1406
Registriert: Mi 20. Jan 2016, 02:23

Re: Mail server

Beitrag von Alexander »

What happened to this?
Your request has actually nothing to do with the initial request by sempre, where he just wanted to configure the sender of panel notifications.

If you want to send mails by PHP via external SMTP, have a look here https://github.com/PHPMailer/PHPMailer.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
lmarcos
Beiträge: 34
Registriert: So 26. Jan 2020, 12:55

Re: Mail server

Beitrag von lmarcos »

Well, what I actually want is the reverse, send emails from a phpBB board directly from the server instead of through gmail. I don't know what I have done, but the email queue is something like 12000 and adding up.
Benutzeravatar
Tobi
Community Moderator
Beiträge: 1342
Registriert: Do 5. Jan 2017, 13:24

Re: Mail server

Beitrag von Tobi »

First you create an user account.
Within this account you can manage email adresses.
Then you can use this new email account for your board.

If your mailqueue is still full you can delete all emails in KeyHelp as administrator.
Gruß,
Tobi


-----------------------------
wewoco.de
Das Forum für Reseller, Digital-Agenturen, Bildschirmarbeiter und Mäuseschubser
lmarcos
Beiträge: 34
Registriert: So 26. Jan 2020, 12:55

Re: Mail server

Beitrag von lmarcos »

The user was set up.

This is the error I'm getting amavis[218378]: (218378-03-429) (!!)TROUBLE in check_mail: check_init2 FAILED: /etc/resolv.conf: No such file or directory at /usr/sbin/amavisd-new line 18264.
Benutzeravatar
space2place
Beiträge: 82
Registriert: Di 24. Mär 2020, 11:02

Re: Mail server

Beitrag von space2place »

lmarcos hat geschrieben:
Di 18. Aug 2020, 22:01
TROUBLE in check_mail: check_init2 FAILED: /etc/resolv.conf: No such file or directory
It seems the file "/etc/resolv.conf" does not exist.
lmarcos
Beiträge: 34
Registriert: So 26. Jan 2020, 12:55

Re: Mail server

Beitrag von lmarcos »

It's a virtual link and it fails to open and point to the correct file.
Benutzeravatar
space2place
Beiträge: 82
Registriert: Di 24. Mär 2020, 11:02

Re: Mail server

Beitrag von space2place »

What file is the target of the symbolic link?
The file „/etc/resolv.conf“ is the a file where you add the namserver.
E.g.

Code: Alles auswählen

nameserver 8.8.8.8
nameserver 8.8.4.4
lmarcos
Beiträge: 34
Registriert: So 26. Jan 2020, 12:55

Re: Mail server

Beitrag von lmarcos »

Apparently, I've done something with it and it would not open on sftp. I'll let it sit until I have a few free days and can devote sometime to look for the point where I might have messed it. Looks like it's having an external nameserver.
lmarcos
Beiträge: 34
Registriert: So 26. Jan 2020, 12:55

Re: Mail server

Beitrag von lmarcos »

Ok, I can now confirm that /etc/resolv.conf doesn't exist. On the CLI I get cat: /etc/resolv.conf: No such file or directory

My setup is similar to what @shortsnow mentioned here https://translate.googleusercontent.com ... mAg#p15406
-External mail server
-External DNS
-mail sent by scripts via phpmail and does not use SMTP
Gmail is working fine (the external email server) and is set up in the external DNS and in KH DNS Manager. I've just set up the spf record for it as well.
The website is also working properly.

But every email sent by the system is queued and doesn't go out.
EMail domain is set to yes and DNS is enabled for the domain.

I've seen another message in this board by @smied saying this worked for him:

Code: Alles auswählen

sudo systemctl enable systemd-resolved
And I've seen people recreating manually the file with:

Code: Alles auswählen

echo "nameserver xx.xx.xx.xx" | sudo tee /etc/resolv.conf
echo "nameserver yy.yy.yy.yy" | sudo tee -a /etc/resolv.conf
I get the following when checking where the simlink points and bingo! there's no resolve directory.

Code: Alles auswählen

ls -altrh /etc/resolv.conf
lrwxrwxrwx 1 root root 39 May 27 23:40 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
Which system do you recommend as the best way to go forward?
Benutzeravatar
george
Beiträge: 69
Registriert: Fr 3. Jan 2020, 05:53
Wohnort: AUSTRALIA

Re: Mail server

Beitrag von george »

Hello lmarcos,
firstly, DNS setup always comes before email setup. Forget about email until you have proper DNS resolution at least. See my suggestions in the topic you quoted above:
viewtopic.php?p=25490#p25490

Here are some handy commands, to aid in testing.

Check GLOBAL/LINK DNS resolvers:

Code: Alles auswählen

systemctl status systemd-resolved
journalctl -u systemd-resolved -f
systemd-resolve --status

Check services listening on port 53:

Code: Alles auswählen

lsof -i :53
ss -lp 'sport = :domain'

Check ROOT nameservers:

Code: Alles auswählen

dig . ns

Check requested data is authenticated:

Code: Alles auswählen

systemd-resolve encryptedsni.com

The standard resolver used listens on 127.0.0.53, and handles all client dns requests, forwarding them to upstream server. When running a proper email server (internal), I always prefer to use bind on 127.0.0.1. This gives better results for spam BL checks, and works better overall. If you choose to go this way, you will need to limit recursion to local clients only (for security).

These days, the best and recommended method of establishing which nameserver to use, is NETPLAN.
My netplan config file resides here:
/etc/netplan/01-eth0.yaml


Contents (nameservers at bottom):

Code: Alles auswählen

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
# /etc/netplan/01-eth0.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      dhcp6: no
      addresses:
        - 111.111.222.222/24			# KeyHelp public IPv4 address.
        - "2404:6800:4006:810::200e/64"		# Primary IPv6 address.
      gateway4: 111.111.222.1			# Primary IPv4 gateway.
      gateway6: "fe80::1"			# Primary IPv6 gateway.
      nameservers:
        search: [host.domain.com]		# Search domain.
        addresses: [127.0.0.1, "::1"]		# DNS Server IP addresses.

If you create a netplan config, make sure to keep the formatting as above. Once saved, test the config is ok:

Code: Alles auswählen

netplan try
Apply the config:

Code: Alles auswählen

netplan apply
May need a reboot too.

This should get you rolling...
lmarcos
Beiträge: 34
Registriert: So 26. Jan 2020, 12:55

Re: Mail server

Beitrag von lmarcos »

Thanks George,

I have an external DNS which has been up and running for years and through several server moves; it's easier to point @ to the new ip in the nameserver than reimport all the CNAMEs, etc. to a new one, specially if your server crashes. And I have another server for a new domain which worked flawlessly with KH from the start, other than me trying to 'innovate' :oops:

So when KH panel emails were not going out now, I thought I was missing some DNS settings or something relating to it.

To your comments

Code: Alles auswählen

systemctl status systemd-resolved
IT's loaded, but inactive (dead)
Journal is not exiting query, but so far is blank.

Code: Alles auswählen

systemd-resolve --status
Failed to get global data: Unit dbus-org.freedesktop.resolve1.service not found.

Code: Alles auswählen

lsof -i :53
ss -lp 'sport = :domain'

Code: Alles auswählen

COMMAND    PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
named   496696 bind   23u  IPv4 20171049      0t0  UDP localhost:domain
named   496696 bind   24u  IPv4 20171050      0t0  UDP localhost:domain
named   496696 bind   26u  IPv4 20171051      0t0  TCP localhost:domain (LISTEN)
named   496696 bind   27u  IPv4 20171051      0t0  TCP localhost:domain (LISTEN)
named   496696 bind   28u  IPv4 20171051      0t0  TCP localhost:domain (LISTEN)
The list continues with server name and doubles with IPv6. The output is similar for the second command.

Code: Alles auswählen

dig . ns
Returns external IPs for A (I guess the external NS') and something like this for AAAA

Code: Alles auswählen

c.root-servers.net.     328164  IN      AAAA    2001:500:2XXX

Code: Alles auswählen

systemd-resolve encryptedsni.com
encryptedsni.com: resolve call failed: Unit dbus-org.freedesktop.resolve1.service not found.
Benutzeravatar
george
Beiträge: 69
Registriert: Fr 3. Jan 2020, 05:53
Wohnort: AUSTRALIA

Re: Mail server

Beitrag von george »

Hello lmarcos, my post above was to get you going. Your queries go beyond the scope of this topic, as yours is a DNS resolution problem, not a mailserver problem. I suggest you start another topic:
"systemd-resolved is broken"

When you decide to get "innovative" again, make sure to follow these tips, to avoid getting stuck like this:
viewtopic.php?p=25490#p25490
Especially, take notes of your "innovations", so you can go back and undo.

The most important component, you have left out: NETPLAN
I strongly suggest you configure it, as it really sorts out the network, and its nameservers take precedence.

Quick FIX:
This will likely work, especially after configuring netplan.

Code: Alles auswählen

apt install --reinstall libnss-resolve

If you still need help, start a new topic.
Good luck!
Antworten