mailx commandline broken after recent bsd-mailx security update
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
bootmail (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
bsd-mailx recently had a security update that completely removes support for specifying classic sendmail options after "--" on the command line. See http://
The update breaks the way Bootmail (and probably quite a few other scripts) constructs its mail messages. Currently it looks like this:
print_mail_text | sed -e "s/[^[:print:]]//g" | rootsign | mail -s "$subject" "$recipients" -- -F "Bootmail" -f "$FROM_MAIL"
The part after "--", i.e. the switches -F and -f, is now no longer supported by bsd-mailx and results in "bad address syntax" error messages in /var/log/mail.log:
Jan 26 16:20:09 example01 postfix/
I reported a bug against bsd-mailx in https:/
To fix this in Bootmail I propose using the "-a" commandline switch to set additional mail headers. Something like this:
print_mail_text | sed -e "s/[^[:print:]]//g" | rootsign | mail -s "$subject" -a "From: Bootmail <${FROM_MAIL}>" "$recipients"
This has the advantage that it works with (probably) all bsd-mailx versions and most other mailx variants as well, including those that never supported specifying sendmail options.
I have implemented the proposed fix in our infrastructure by having Puppet modify the /usr/sbin/bootmail script and change the last line as specified above to use the "-a" option for setting the From: header:
print_mail_text | sed -e "s/[^[:print:]]//g" | rootsign | mail -s "$subject" -a "From: Bootmail <${FROM_MAIL}>" "$recipients"
Works well, FWIW.