Bug 1303422 - satellite sync hard coded email FROM does not allow customization for email addresses
satellite sync hard coded email FROM does not allow customization for email a...
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Satellite Synchronization (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Grant Gainey
Martin Korbel
: Patch
Depends On:
Blocks: sat580-low
  Show dependency treegraph
Reported: 2016-01-31 11:04 EST by Shannon Hughes
Modified: 2017-06-21 08:17 EDT (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2017-06-21 08:17:18 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
patch to add default_mail_from support to satsync (1.64 KB, application/mbox)
2016-01-31 11:32 EST, Shannon Hughes
no flags Details
sat sync patch for default mail (1.34 KB, application/mbox)
2016-02-03 14:13 EST, Shannon Hughes
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 1278443 None None None 2016-02-03 12:09 EST

  None (edit)
Description Shannon Hughes 2016-01-31 11:04:43 EST
Description of problem:

satellite-sync currently does not support a default_mail_from address similar to the webui. rather the address is hard coded to root@host which can produce issues for customers when the server uses a short name and mail relays require fqdn. A patch will be included for review to use a config variable, default_mail_from, in the satellite.server CFG namespace to overcome this issue.
Comment 1 Shannon Hughes 2016-01-31 11:32 EST
Created attachment 1119915 [details]
patch to add default_mail_from support to satsync
Comment 2 Grant Gainey 2016-02-02 07:55:17 EST
In the attached patch, if parseaddr fails, then sndr ends up as ''. Can we instead notice this, log an error, and default back to root@host_label? Otherwise, the emails arrive with no From line, and it makes it much harder for the customer to figure out what machine has a cfg-problem.
Comment 3 Shannon Hughes 2016-02-02 10:36:37 EST
Grant, I'll take a look when I am back in the office but good catch. Will fix it up.
Comment 4 Shannon Hughes 2016-02-03 14:13 EST
Created attachment 1120892 [details]
sat sync patch for default mail

this patch removes the need for the parse address lib
Comment 5 Shannon Hughes 2016-02-03 14:17:12 EST
test plan: 

1) modify rhn.conf and break the sat sync by modifying parent with a bogus name
server.satellite.rhn_parent = ssatellite.rhn.redhat.com

2) Add a new config var for the default email address for satellite.server namespace in rhn.conf

server.satellite.default_mail_from = user@fqdn

3) run satsync with email option, tail the /var/log/maillog file

satellite-sync -l --email

4) confirm mail from address shows up in /var/log/maillog

5) now comment out the server.satellite.default_mail_from config var. rerun sat sync. Confirm the mail from address is now root@hostname in /var/log/maillog
Comment 6 Grant Gainey 2016-02-19 14:38:18 EST
spacewalk.github c6369d1f57b352e49b116e677f5d2fbc5831d703

NOTE: use the included patch when applying to Satellite, the pune-to-puny namechange will get in the way of cherry-picking the SW commit
Comment 13 Tomas Lestach 2016-04-06 04:18:11 EDT
The patch can be found here - 
But according to Comment 6, there may be more changes needed.
Comment 15 Martin Korbel 2017-06-01 07:34:28 EDT
VERIFIED on spacewalk-backend-2.5.3-137  (SAT5.8_20170529)

1. Add "default_mail_from" into rhn.conf
 > echo "server.satellite.default_mail_from = tester@example.com" >> /etc/rhn/rhn.conf
2. Sync some channel
 >  cdn-sync -c rhn-tools-rhel-x86_64-server-5  --email
3. Check mailbox
 > mail
  N 11 tester@example.com    Thu Jun  1 07:28 661/46162 "CDN sync. report from host-8-179-109.host.centralc"

Note You need to log in before you can comment on or make changes to this bug.