SUMMARY
All emails from the Unitrends appliance comes from a non-existent domain. This article will summarize how to change the domain, as well as, how to change the 'from' sender address in sendmail.
ISSUE
For 10.0+ you may be able to use the INI value. If not, proceed to the detailed section.
Emails from the Unitrends appliance are being refused by the local email server since they come from a non-existent email domain.
RESOLUTION
For Appliance Versoin 10.0.0-1 and newer
Simply edit the master.ini file on the Unitrends appliance located at /usr/bp/bpinit/
vi /usr/bp/bpinit/master.ini [Reports] PageWidth=80 PageLength=60 WeeklySummaryName=weekly.rpt FailureReportName=failure.rpt TapeContentName=tape.rpt ;[email protected] ; Specify user to send reports asRemove the comment symbol (the ';' semicolon) from in front of the line that begins with ReportFrom= and change the email address to the one you want listed as the sender.
[email protected]Save this file, then restart the sendmail services: service sendmail restart
--This ONLY works for reports, not tests/sendmail directly --
To test report function after above change run the following
php /usr/bp/bin/genreports.php
STOP! You are done if your appliance is running 10.0.0-1 or newer.
Instructions below are only for systems older than release 10.x, or used for systems requiring more detailed steps:
For the appliance to send email from [email protected] instead of [email protected], your domain name must be configured in sendmail.cf.
To change the sender for all reports from a Unitrends appliance to a single sender, perform the following:
- SSH into the appropriate appliance and navigate to /etc/mail
cd /etc/mail
- Create a backup copy of your sendmail.cf and sendmail.mc files.
cp sendmail.cf sendmail.mc /root
- We now have enable the genericstable feature for sendmail and compile our new configuration file. You will need to add these lines to the sendmail.mc file. Also make sure the smart host that is defined is their relay server. Once you rebuild the sendmail.mc the DS record will be removed if the smart host is not defined.
define(`SMART_HOST',`smtp.mydomain.com')dnl FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl
- Added these directives to the end of the sendmail.mc file just before the MAILER directives. Original last 10 lines of the sendmail.mc
[[email protected] mail]# tail -n 12 sendmail.mc dnl # dnl FEATURE(masquerade_entire_domain)dnl dnl # dnl MASQUERADE_DOMAIN(localhost)dnl dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl dnl MASQUERADE_DOMAIN(mydomain.lan)dnl MAILER(smtp)dnl MAILER(procmail)dnl dnl MAILER(cyrusv2)dnl
- After making the changes:
[[email protected] mail]# tail -n 12 sendmail.mc dnl # dnl MASQUERADE_DOMAIN(localhost)dnl dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl dnl MASQUERADE_DOMAIN(mydomainalias.com)dnl dnl MASQUERADE_DOMAIN(mydomain.lan)dnl define(`SMART_HOST',`smtp.mydomain.com')dnl FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl MAILER(smtp)dnl MAILER(procmail)dnl dnl MAILER(cyrusv2)dnl define(`MAIL_HUB', `skynet.gov.')dnl define(`LOCAL_RELAY', `skynet.gov.')dnl
- Now lets create the new configuration file:
[[email protected] mail]# m4 sendmail.mc > sendmail.cf
- Create a /etc/mail/generics-domains file that is just a list of all the domains that should be inspected. Make sure the file includes the domain name used by the Unitrends appliance, which you can obtain using the command:
sendmail -bt -d0.1 </dev/null
- Here is a sample /etc/mail/generics-domains file:
[[email protected] mail]# cat /etc/mail/generics-domains unitrends.com
- Create your /etc/mail/genericstable file. First sendmail searches the /etc/mail/generics-domains file for a list of domains to reverse map. It then looks at the /etc/mail/genericstable file for an individual email address from a matching domain. The format of the file is linux-username [email protected]. Here is an example:
[[email protected] mail]# cat /etc/mail/genericstable root [email protected].gov reports [email protected].gov Failure.Report [email protected].gov Schedule.Report [email protected].gov
- If Unitrends release 9.1.1 or earlier, fix the mail_report.php with this sed command
[[email protected] mail]# sed -i 's/mail(\x27\x27, $subject,\x27\x27,$email);/mail(\x27\x27, $subject,\x27\x27,$email,"-f \x27$from\x27");/g' /usr/bp/bin/mail_report.php
- Ensure that the domain you're sending from is defined as an alias for the appliance in /etc/hosts and host entry defined for the SMTP relay as your domain with a trailing period.
[[email protected] ~]# cat /etc/hosts 127.0.0.1 localhost.localdomain localhost 192.168.0.5 skynet.gov UB.skynet.gov UB 192.168.0.45 skynet.gov.
- Ensure that the ReportFrom parameter is defined
[[email protected] ~] bputil -p "Reports" "ReportFrom" "[email protected].com" /usr/bp/bpinit/master.ini
- The last step is to restart sendmail
service sendmail restart
- Verify emails are being sent with the proper "from" address. This can be done using telnet and some basic SMTP commands seen below in bold and verifying that you received the email.
[[email protected] ~]# telnet localhost 25 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 skynet.gov ESMTP Sendmail 8.14.4/8.14.4; Sat, 5 Aug 2017 11:06:20 -0500 EHLO localhost 250-skynet.gov Hello localhost.localdomain [127.0.0.1], pleased to meet you 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-8BITMIME 250-SIZE 250-DSN 250-ETRN 250-DELIVERBY 250 HELP MAIL FROM: [email protected].gov 250 2.1.0 [email protected].gov... Sender ok RCPT TO: [email protected].com 250 2.1.5 [email protected].com... Recipient ok DATA 354 Enter mail, end with "." on a line by itself Test email . 250 2.0.0 v75G6KrM031870 Message accepted for delivery ^] telnet> quit Connection closed.
NOTES
DNS and /etc/hosts must agree on the FQDN. There may be issues if there is an internal and an external domain name.
Many of the changes in this KB are made using the program "vi," for more information on how to use this please refer to this documentation