Documentation about the ncm-sendmail component
Ncm-sendmail-1.6 component
2 Functions:
1)The first check if the service is running,
2) The second function restarts the service.
(Both can be implemented with the notify/require parameters in puppet manifests)
Declaring the parameters (e.g my $cfgfilecf='/etc/mail/sendmail.cf';)
Configure state:
$tree
|-- manifests
| |-- config.pp
| |-- init.pp
| |-- install.pp
| |-- local-users.pp
| |-- newaliases.pp
| |-- params.pp
| `-- service.pp
`-- templates
|-- local-users.erb
`-- sendmail.mc.erb
[Parameters]
$smart_host_enable=true,
$smart_host='cern.ch',
$accept_external_mail='true',
$masquerade_enable='true',
$user_domain='mail.cern.ch',
$local_relay_enable=true,
$local_users_file='/etc/mail/local-users',
$afs_forward_support=true
$sendmailmc_file = '/etc/mail/sendmail.mc'
$sendmailcf_file = '/etc/mail/sendmail.cf'
$file_group = 'root'
- Modifying the sendmail configuration file
- masquerade_enable = true -->(put-line) MASQUERADE_AS(`<%= @user_domain
%>')
- masquerade_enable = true -->(put-line) FEATURE(masquerade_envelope)dnl
- accept_external_mail = true -->(put-line) DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
- local_relay_enable = true -->(put-line) define(`LOCAL_RELAY',`<%= @user_domain
%>')dnl ,LOCAL_USER_FILE(`<%= @local_users_file
%>')dnl
- afs_forward_support = true -->(put-line) define(`confFORWARD_PATH',`$z/public/.forward.$w:$z/public/.forward:$z/.forward.$w:$z/.forward')dnl
Install the packages: 'sendmail', 'sendmail-cf', 'm4'
Configure the module ( the manifest is ready e.g: Generate sendmail configuration file)
And
- Trying to guess all the non-afs users in the machine(default = root)
- try to open the /etc/login.defs if failed hardcode the min/max local uid between 500 - 60000 ( <- this needs to be reviewed , Jarek)
- Puppet approach of newaliases(does the same thing with sendmail component but better) if /etc/aliases.db is more recent, 0 if /etc/aliases is more recent 1 or aliases.db is absent and then it runs the newaliases command
Things to be done
- How hiera plays with masterless approach
- how i can extract the landb lib in order to have the landb_owner(s)
Unconfigure State
Just put the default values..
example:
$lcm --configure sendmail
[INFO] masquerade as host: mail.cern.ch
[INFO] masquerading header and envelope
[INFO] unqualified users relayed via mail.cern.ch
[INFO] will guess the list of local users for unqualified relay
[INFO] exception list for unqualified relay in /etc/mail/local-users: local-user,root
[INFO] using smarthost: cern.ch
[INFO] sendmail listening options not configured
[INFO] looking for .forward in: $z/public/.forward.$w:$z/public/.forward:$z/.forward.$w:$z/.forward
[INFO] converted sendmail config /etc/mail/sendmail.mc -> /etc/mail/sendmail.cf
[INFO] service sendmail is running
[INFO] service sendmail has been restarted
[OK] Sendmail configured
$lcm --unconfigure sendmail
updated /etc/mail/sendmail.mc
updated /etc/mail/sendmail.mc
updated /etc/mail/sendmail.mc
updated /etc/mail/sendmail.mc
updated /etc/mail/sendmail.mc
updated /etc/mail/sendmail.mc
[INFO] converted sendmail config /etc/mail/sendmail.mc -> /etc/mail/sendmail.cf
[INFO] service sendmail is running
[INFO] service sendmail has been restarted
[OK] Sendmail unconfigured
[INFO] configure on component sendmail executed, 0 errors, 0 warnings