ssl is optional now

This commit is contained in:
Tobias Herre 2023-10-31 17:25:32 +01:00
parent 7d3d409c55
commit 30300d06d9
1 changed files with 51 additions and 28 deletions

View File

@ -4,6 +4,8 @@
bundle agent dovecot(cfg) bundle agent dovecot(cfg)
{ {
classes:
"use_ssl" expression => strcmp("$(cfg[ssl])","true");
vars: vars:
freebsd:: freebsd::
"cfg_dir" string => "/usr/local/etc/dovecot"; "cfg_dir" string => "/usr/local/etc/dovecot";
@ -49,13 +51,8 @@ vars:
"submission_cert" string => "$(cfg_dir)/private/submission.crt"; "submission_cert" string => "$(cfg_dir)/private/submission.crt";
"service_name" string => "dovecot"; "service_name" string => "dovecot";
use_ssl::
"service_deps" slist => {
methods:
"any" usebundle => wmde_install_packages(@(pkgs),"dovecot");
"any" usebundle => wmde_service("$(service_name)","dovecot_kept","dovecot_repaired"),
depends_on => {
"dovecot_pkgs_installed", "dovecot_pkgs_installed",
"dovecot_cfg_created", "dovecot_cfg_created",
"dovecot_imap_key_installed", "dovecot_imap_key_installed",
@ -63,7 +60,19 @@ methods:
"dovecot_submission_key_installed", "dovecot_submission_key_installed",
"dovecot_submission_cert_installed", "dovecot_submission_cert_installed",
}; };
services: !use_ssl::
"service_deps" slist => {
"dovecot_pkgs_installed",
"dovecot_cfg_created",
};
methods:
"any" usebundle => wmde_install_packages(@(pkgs),"dovecot");
"any" usebundle => wmde_service("$(service_name)","dovecot_kept","dovecot_repaired"),
depends_on => @(service_deps);
files: files:
"$(cfg_dir)/." "$(cfg_dir)/."
@ -81,34 +90,41 @@ files:
handle => "dovecot_cfg_created", handle => "dovecot_cfg_created",
edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/dovecot/dovecot.conf.mustache"; edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/dovecot/dovecot.conf.mustache";
"$(imap_cert)" use_ssl::
handle => "dovecot_imap_cert_installed",
classes => if_repaired(dovecot_repaired),
copy_from => local_dcp( execresult( "/usr/bin/readlink -qfn $(cfg[imap_cert])","noshell" )),
perms => mog("600","root","root");
"$(imap_key)" "$(imap_cert)"
handle => "dovecot_imap_key_installed", handle => "dovecot_imap_cert_installed",
classes => if_repaired(dovecot_repaired), classes => if_repaired(dovecot_repaired),
copy_from => local_dcp( execresult( "/usr/bin/readlink -qfn $(cfg[imap_key])","noshell" )), copy_from => local_dcp( execresult( "/usr/bin/readlink -qfn $(cfg[imap_cert])","noshell" )),
perms => mog("600","root","root"); perms => mog("600","root","root");
"$(submission_cert)" "$(imap_key)"
handle => "dovecot_submission_cert_installed", handle => "dovecot_imap_key_installed",
classes => if_repaired(dovecot_repaired), classes => if_repaired(dovecot_repaired),
copy_from => local_dcp( execresult( "/usr/bin/readlink -qfn $(cfg[submission_cert])","noshell" )), copy_from => local_dcp( execresult( "/usr/bin/readlink -qfn $(cfg[imap_key])","noshell" )),
perms => mog("600","root","root"); perms => mog("600","root","root");
"$(submission_key)" "$(submission_cert)"
handle => "dovecot_submission_key_installed", handle => "dovecot_submission_cert_installed",
classes => if_repaired(dovecot_repaired), classes => if_repaired(dovecot_repaired),
copy_from => local_dcp( execresult( "/usr/bin/readlink -qfn $(cfg[submission_key])","noshell" )), copy_from => local_dcp( execresult( "/usr/bin/readlink -qfn $(cfg[submission_cert])","noshell" )),
perms => mog("600","root","root"); perms => mog("600","root","root");
"$(submission_key)"
handle => "dovecot_submission_key_installed",
classes => if_repaired(dovecot_repaired),
copy_from => local_dcp( execresult( "/usr/bin/readlink -qfn $(cfg[submission_key])","noshell" )),
perms => mog("600","root","root");
reports: reports:
use_ssl::
"USE_SSL: TRUE";
!use_ssl::
"USE_SSL: FALSE";
# "IMAP_CERT: $(imap_cert)"; # "IMAP_CERT: $(imap_cert)";
# #
# dovecot_kept:: # dovecot_kept::
@ -135,3 +151,10 @@ files:
} }
bundle agent install_dovecot_pkgs
{
methods:
"any" usebundle => wmde_install_packages(@(dovecot.pkgs),"dovecot");
}