Page 1 of 1

CSF Alert, How to Change Hostname in Email and Sender Address

Posted: 21 Jun 2016, 20:26
by jestep
This is happening to me on 2 non-cpanel servers that we're running. Basically the title of the email reads something like: lfd on localhost.localdomain

How do we get localhost.localdomain to be the actual hostname of the server?

We have our hostname attached to each IP in /etc/hosts. On 1 server, the sending email is showing: root@ourdomain.com, but for some reason the other one is still: root@localhost.localdomain

These servers are configured basically identically, both running CentOS 7, both setup side by side at the same time. I have no idea where they are handling this differently but we manage enough servers I have to get the title and sending email corrected.

On all of our cpanel servers the emails read LFD on myserver.mydomain.com, etc. I compared CSF configurations and our host file and can't find any differences here, so it must be handled somewhere else. We haven't messed with the email templates on any of these servers. Can anyone point me to where CSF pulls the domain in the title, and where the domain in the sender's address is pulled from, since that part works on 1 server but not on the other and they're configured identically.

Re: CSF Alert, How to Change Hostname in Email and Sender Address

Posted: 21 Jun 2016, 21:22
by jestep
To add both of these are using sendmail.

When I issue: sendmail -d0.1 -bv root

I get:

Code: Select all

Version 8.14.7
 Compiled with: DNSMAP HESIOD HES_GETMAILHOST LDAPMAP LOG MAP_REGEX
                MATCHGECOS MILTER MIME7TO8 MIME8TO7 NAMED_BIND NETINET NETINET6
                NETUNIX NEWDB NIS PIPELINING SASLv2 SCANF SOCKETMAP STARTTLS
                TCPWRAPPERS USERDB USE_LDAP_INIT

============ SYSTEM IDENTITY (after readcf) ============
      (short domain name) $w = mysubdomain
  (canonical domain name) $j = mysubdomain.mydomain.com
         (subdomain name) $m = mydomain.com
              (node name) $k = mysubdomain.mydomain.com
========================================================

root... deliverable: mailer local, user root

Re: CSF Alert, How to Change Hostname in Email and Sender Address

Posted: 21 Jun 2016, 21:40
by jestep
Also, if I use the command: hostname it shows the correct hostname for the server and not localhost.localdomain.

Re: CSF Alert, How to Change Hostname in Email and Sender Address

Posted: 21 Jun 2016, 21:52
by jestep
Ok, I think I got it. Even though the hostname was showing correctly using the: hostname command, I went ahead and issues a hostnamectl set-hostname mysubdomain.mydomain.com command. After restarting LFD, it seems to be working now.

Re: CSF Alert, How to Change Hostname in Email and Sender Address

Posted: 14 Jan 2019, 20:00
by tiencao
LFD alert with [hostname] but I want replace [hostname] by mail IP of server. How to do it?

Re: CSF Alert, How to Change Hostname in Email and Sender Address

Posted: 15 Apr 2019, 20:22
by salmino
jestep wrote: 21 Jun 2016, 21:52 Ok, I think I got it. Even though the hostname was showing correctly using the: hostname command, I went ahead and issues a hostnamectl set-hostname mysubdomain.mydomain.com command. After restarting LFD, it seems to be working now.
Redtube Beeg Spankbang

SAME THING TO ME