wmdeit-cf-wmdelib/opendkim.cf

108 lines
2.5 KiB
CFEngine3
Raw Normal View History

2023-10-12 18:22:21 +00:00
#
# opendkim
#
bundle agent opendkim(cfg_param)
{
vars:
2023-10-28 12:03:57 +00:00
"service_name" string => "opendkim";
2023-10-12 18:22:21 +00:00
debian::
"pkgs" slist => {"opendkim"};
"uid" string => "opendkim";
"gid" string => "opendkim";
"cfg_file" string => "/etc/opendkim.conf";
"pid_file" string => "/run/opendkim/opendkim.pid";
2023-10-28 12:03:57 +00:00
centos::
"pkgs" slist => {"opendkim"};
"uid" string => "opendkim";
"gid" string => "opendkim";
"cfg_file" string => "/etc/opendkim.conf";
"pid_file" string => "/run/opendkim/opendkim.pid";
2023-10-12 18:22:21 +00:00
freebsd::
"pkgs" slist => {"opendkim"};
"uid" string => "mailnull";
"gid" string => "mailnull";
"cfg_file" string => "/usr/local/etc/mail/opendkim.conf";
"pid_file" string => "/var/run/opendkim.pid";
2023-11-06 08:21:57 +00:00
"service_name" string => "milter-opendkim";
2023-10-12 18:22:21 +00:00
any::
"default_cfg" data => '{
"uid": "$(uid)",
"gid": "$(gid)",
"milter_sock": "inet:4711@localhost",
"mynetworks": ["127.0.0.1"],
"pid_file": "$(pid_file)",
"domains":["*"]
}';
"cfg" data => mergedata(@(opendkim.default_cfg),@(opendkim.cfg_param));
"mynetworks_len" int => length(data_expand(@(cfg[mynetworks])));
"mynetworks_head" string => "$(cfg[mynetworks][0])";
"mynetworks_tail" slist => sublist(data_expand(@(cfg[mynetworks])),"tail",int(eval("$(mynetworks_len) - 1","math","infix")));
methods:
2023-10-28 12:03:57 +00:00
"any" usebundle => opendkim_systemd_overrides,
handle => "opendkim_overrides_done";
"any" usebundle => wmde_install_packages(@(opendkim.pkgs),"opendkim");
"any" usebundle => wmde_service("$(service_name)","opendkim_kept","opendkim_repaired"),
depends_on => {
"opendkim_overrides_done",
"opendkim_pkgs_installed",
"opendkim_cfg_done"
};
2023-10-12 18:22:21 +00:00
files:
"$(opendkim.cfg_file)"
create => "true",
edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/opendkim.conf.mustache",
template_method => "mustache",
2023-10-28 12:03:57 +00:00
template_data => bundlestate("opendkim"),
classes => if_repaired("opendkim_repaired"),
handle => "opendkim_cfg_done";
2023-10-12 18:22:21 +00:00
reports:
}
2023-10-28 12:03:57 +00:00
bundle agent opendkim_systemd_overrides
{
files:
2023-11-06 08:21:57 +00:00
freebsd::
"/etc/rc.conf.d/milteropendkim"
create=>"true",
content=>'
milteropendkim_uid="$(opendkim.cfg[uid])"
milteropendkim_gid="$(opendkim.cfg[gid])"
';
2023-10-28 12:03:57 +00:00
centos::
"/etc/systemd/system/opendkim.service.d/override.conf"
create => "true",
content => "
[Service]
User=root
Group=root
",
classes => if_repaired("opendkim_repaired"),
handle => "opendkim_systemd_override_created";
commands:
centos&opendkim_repaired::
"/usr/bin/systemctl"
args => "daemon-reload",
depends_on => {"opendkim_systemd_override_created"};
}