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

5 posts Page 1 of 1
jestep
Junior Member
Posts: 15
Joined: 31 Mar 2010, 16:25


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.
jestep
Junior Member
Posts: 15
Joined: 31 Mar 2010, 16:25


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
Last edited by jestep on 21 Jun 2016, 21:40, edited 1 time in total.
jestep
Junior Member
Posts: 15
Joined: 31 Mar 2010, 16:25


Also, if I use the command: hostname it shows the correct hostname for the server and not localhost.localdomain.
jestep
Junior Member
Posts: 15
Joined: 31 Mar 2010, 16:25


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.
tiencao
Junior Member
Posts: 1
Joined: 14 Jan 2019, 19:58


LFD alert with [hostname] but I want replace [hostname] by mail IP of server. How to do it?
5 posts Page 1 of 1