Buglet: Hostname Domain Name vs Email Domain for two settings: administrator and email_reply_address

Problem: Two email addresses are constructed by default as foreman is installed / initialized, they make the assumption that the foreman server’s domain name is the same and an organization’s email domain.

Our system haves name of the form: {hostname}.{site}.{domain}.net.au
Our Email System uses email addresses of the form: {username}@{domain}.net.au

A default foreman-installer invocation on a blank system, or one with --foreman-email-smtp-domain "{domain}.net.au" provided, will configure two email address settings (administrator and email_reply_address), with {username}@{site}.{domain}.net.au

While I don’t believe --foreman-email-smtp-domain "{domain}.net.au" is the correct installer option, as it part of a set of options for configuring Foreman’s interactions with an SMTP server.

It seems reasonable to me that a user should be able to configure an organsation’s email domain correctly during setup. As shown below, I have a a workaround for this, and hence my classification of this issue as a buglet. I have also identified the code which makes these email addresses, but I don’t have the knowledge to know how to fix the issue at a code level, or how or if I should be trying to override the SETTINGS[:domain] option (and I personally don’t think that would be a good approach). But I though I should report it, if only to make the community aware of the issue.

Expected outcome: Email Addresses of the Form: {username}@{domain}.net.au

Workaround:

hammer settings list | grep \@
hammer settings set --name  administrator \
                    --value "root@${EMAIL_DOMAIN}"
hammer settings set --name  email_reply_address \
                    --value "foreman-noreply@${EMAIL_DOMAIN}"
hammer settings list | grep \@

Foreman and Proxy versions: 2.1.0rc3

Distribution and version: CentOS 8.2

Other relevant data:

From the foreman git repository, we have:

config/settings.rb
26:unless SETTINGS[:domain] && SETTINGS[:fqdn]
27- require ‘facter’
28: SETTINGS[:domain] ||= Facter.value(:domain) || Facter.value(:hostname)
29- SETTINGS[:fqdn] ||= Facter.value(:fqdn)
30-end

app/models/setting/email.rb
1-class Setting::Email < Setting
2- NON_EMAIL_YAML_SETTINGS = %w(send_welcome_email email_reply_address email_subject_prefix)
3-
4- def self.default_settings
5: domain = SETTINGS[:domain]
6- email_reply_address = “foreman-noreply@#{domain}”

app/models/setting/general.rb
4- def self.default_settings
5- protocol = SETTINGS[:require_ssl] ? ‘https’ : ‘http’
6: domain = SETTINGS[:domain]
7- administrator = “root@#{domain}”