Compare commits

...

12 Commits

11 changed files with 140 additions and 24 deletions

View File

@ -327,7 +327,10 @@ vars:
{
"aliases":[],
"ssl_cert":"certbot",
"doc_root":"$(apache.www_dir)/$(site_param[domain])"
"doc_root":"$(apache.www_dir)/$(site_param[domain])",
"doc_root_options":"Indexes FollowSymLinks",
"php":true,
"php_handler":"application/x-httpd-php"
}
';

View File

@ -34,6 +34,22 @@ vars:
"dovecot-pop3d"
};
centos::
"pkgs" slist => {
"dovecot",
"dovecot-mysql",
};
"cfg_dir" string => "/etc/dovecot";
"dovecot_conf" string => "$(cfg_dir)/dovecot.conf";
"imap_key" string => "$(cfg_dir)/private/imap.key";
"imap_cert" string => "$(cfg_dir)/private/imap.crt";
"submission_key" string => "$(cfg_dir)/private/submission.key";
"submission_cert" string => "$(cfg_dir)/private/submission.crt";
"service_name" string => "dovecot";
methods:
"any" usebundle => wmde_install_packages(@(pkgs),"dovecot");

11
lib.cf
View File

@ -243,15 +243,24 @@ methods:
}
bundle agent install_system_repos
{
classes:
centos::
"centos_9_and_later" expression => isgreaterthan("$(sys.os_version_major)", "8") ;
vars:
"pkgs" slist => {};
centos::
"pkgs" slist => {
"epel-release"
};
commands:
centos_9_and_later::
"/usr/bin/dnf"
inform => "false",
args => "config-manager --set-enabled crb";
methods:
"any" usebundle => wmde_install_packages(@(pkgs),"system_repos");
reports:
}

View File

@ -110,7 +110,11 @@ vars:
"$(mysql.default_datadir)");
type_mariadb::
"install_db_cmd" string => "if [ ! -d $(datadir)/mysql ]; then $(mysql.bin_dir)/mariadb-install-db --user=$(mysql.user)>/dev/null ; fi";
"install_db_exe" string => ifelse(fileexists("$(mysql.bin_dir)/mysql_install_db"),
"$(mysql.bin_dir)/mysql_install_db",
"$(mysql.bin_dir)/mariadb-install-db");
"install_db_cmd" string => "if [ ! -d $(datadir)/mysql ]; then $(install_db_exe) --user=$(mysql.user)>/dev/null ; fi";
type_mysql8::
"install_db_cmd" string => "if [ ! -d $(datadir)/mysql ]; then $(mysql.mysqld_cmd) --initialize-insecure --user=$(mysql.user); fi";
@ -271,7 +275,7 @@ bundle agent create_mysql_backup_cron_job(cfg,file,table_name,run)
classes:
"create_cron" expression => strcmp("$(run)","true");
vars:
"table_exists_cmd" string => '$(mysql.mysql_cmd) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) -e "show tables LIKE \'$(table_name)\'" | grep -q $(table_name)';
"table_exists_cmd" string => '$(mysql.mysql_cmd) -h$(cfg[db_host]) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) -e "show tables LIKE \'$(table_name)\'" | grep -q $(table_name)';
"backup_cmd" string => "$(mysql.mysqldump_cmd) --complete-insert --routines --triggers --single-transaction --max_allowed_packet=512M -h$(cfg[db_host]) -u$(cfg[db_user]) -p$(cfg[db_pass]) $(cfg[db_name]) >$(file)";

View File

@ -5,6 +5,8 @@
bundle agent opendkim(cfg_param)
{
vars:
"service_name" string => "opendkim";
debian::
"pkgs" slist => {"opendkim"};
"uid" string => "opendkim";
@ -12,6 +14,15 @@ vars:
"cfg_file" string => "/etc/opendkim.conf";
#"pid_file" string => "/var/run/opendkim.pid";
"pid_file" string => "/run/opendkim/opendkim.pid";
centos::
"pkgs" slist => {"opendkim"};
"uid" string => "opendkim";
"gid" string => "opendkim";
"cfg_file" string => "/etc/opendkim.conf";
#"pid_file" string => "/var/run/opendkim.pid";
"pid_file" string => "/run/opendkim/opendkim.pid";
freebsd::
"pkgs" slist => {"opendkim"};
"uid" string => "mailnull";
@ -39,23 +50,51 @@ vars:
methods:
"any" usebundle => wmde_install_packages(@(opendkim.pkgs),"opendkim"),
handle => "opendkim_installed";
"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"
};
files:
"$(opendkim.cfg_file)"
create => "true",
edit_template => "$(sys.workdir)/inputs/$(def.wmde_libdir)/templates/opendkim.conf.mustache",
template_method => "mustache",
template_data => bundlestate("opendkim");
# template_data => mergedata(@(opendkim.default_cfg),@(opendkim.cfg));
template_data => bundlestate("opendkim"),
classes => if_repaired("opendkim_repaired"),
handle => "opendkim_cfg_done";
reports:
# "HALLO DIKM";
# "MYLEN: $(mynetworks_len)";
# "HEAD: $(mynetworks_head)";
# "TAIL: $(mynetworks_tail)";
}
bundle agent opendkim_systemd_overrides
{
files:
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"};
}

3
php.cf
View File

@ -15,7 +15,6 @@ vars:
freebsd::
freebsd::
"cli_exe" string => "/usr/local/bin/php";
"pkgs" slist => {
"php$(php.bsdvs)-session",
"php$(php.bsdvs)-zip",
@ -105,6 +104,7 @@ methods:
bundle agent php(settings)
{
vars:
"ini_files" slist => { };
debian::
"version" string => "8.0";
@ -147,6 +147,7 @@ vars:
"apache_f" string => "libphp";
centos::
"cli_exe" string => "/usr/bin/php";
"version" string => "";
"fpm_pkgs" slist => { "php$(version)-fpm" };
"fpm_service_name" string => "php$(version)-fpm";

View File

@ -45,6 +45,29 @@ vars:
"group" string => "postfix";
"mail_owner" string => "postfix";
"postmap_cmd" string => "/usr/sbin/postmap";
centos::
"pkgs" slist => {
"postfix",
"postfix-mysql"
};
"service_name" string => "postfix";
"cfg_dir" string => "/etc/postfix";
"master_cf" string => "/etc/postfix/master.cf";
"main_cf" string => "/etc/postfix/main.cf";
"mailer_conf" string => "/usr/local/etc/mail/mailer.conf";
"mail_group" string => "postdrop";
"daemon_dir" string => "/usr/libexec/postfix/";
"bin_dir" string => "/usr/bin";
"sbin_dir" string => "/usr/sbin";
"queue_dir" string => "/var/spool/postfix";
"db_dir" string => "/var/db";
"user" string => "postfix";
"group" string => "postfix";
"mail_owner" string => "postfix";
"postmap_cmd" string => "/usr/sbin/postmap";
any::
"data_dir" string => "$(db_dir)/postfix";
"maps_dir" string => "$(cfg_dir)/maps";

View File

@ -8,7 +8,7 @@ classes:
"sympa_b";
vars:
debian&sympa_b::
debian::
"lib_dir" string => "/usr/lib/sympa";
"var_lib_dir" string => "/var/lib/sympa";
"share_dir" string => "/usr/share/sympa";
@ -23,6 +23,23 @@ vars:
"sympa"
};
centos::
"lib_dir" string => "/usr/lib/sympa";
"var_lib_dir" string => "/var/lib/sympa";
"share_dir" string => "/usr/share/sympa";
"conf_dir" string => "/etc/sympa";
"sympa_conf" string => "$(conf_dir)/sympa/sympa.conf";
"service_name" string => "sympa";
"wwservice_name" string => "wwsympa";
"wwsympa_socket" string => "/var/run/sympa/wwsympa.socket";
"sympa_pl_cmd" string => "/usr/bin/sympa";
"pkgs" slist => {
"sympa"
};
debian&sympa_s::
"install_dir" string => "/usr/local/sympa";

View File

@ -3,12 +3,16 @@
#
<Directory {{vars.apache_vhost.site.doc_root}}>
AllowOverride all
Options Indexes FollowSymLinks
Options {{ vars.apache_vhost.site.doc_root_options }}
Require all granted
{{#vars.apache_vhost.site.php}}
<FilesMatch ".+(\.php)$">
SetHandler application/x-httpd-php
SetHandler {{vars.apache_vhost.site.php_handler}}
</FilesMatch>
{{/vars.apache_vhost.site.php}}
DirectoryIndex index.php index.html
{{{vars.apache_vhost.site.dir_raw}}}
</Directory>
{{^vars.apache_vhost.site.ssl}}

View File

@ -57,7 +57,7 @@ files:
"$(cfg[install_dir])/public/.htaccess"
copy_from => local_cp("$(cfg[install_dir])/public/.htaccess.dist"),
copy_from => seed_cp("$(cfg[install_dir])/public/.htaccess.dist"),
perms => mog("644","root","root"),
depends_on => {"vimbadmin_untarred"},
handle => "vimbadmin_htaccess_copied";
@ -130,6 +130,9 @@ methods:
"any" usebundle => php_composer;
"any" usebundle => mysql_table_exists(@(cfg),"admin");
vimbadmin_restore_db_file::
"any" usebundle => create_mysql_backup_cron_job(@(cfg),"$(cfg[restore_db_file])","admin","true");
reports:
# "VIMBADMIN $(cfg[restore_db_file])";
@ -147,6 +150,6 @@ reports:
body contain vimbadmin_cmd
{
exec_owner => "www-data";
exec_group => "www-data";
exec_owner => "$(apache.www_user)";
exec_group => "$(apache.www_group)";
}

View File

@ -2,14 +2,11 @@
bundle agent wget
{
vars:
"pkgs" slist => {"wget"};
"pkgs" slist => {"wget","tar"};
"exe" string => "/usr/bin/wget";
freebsd::
"exe" string => "/usr/local/bin/wget";
debian::
"exe" string => "/usr/bin/wget";
}
bundle agent install_wget