2024-09-25 04:51:20 +02:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
|
|
|
|
use esmith::Build::CreateLinks qw(:all);
|
|
|
|
use esmith::Build::Backup qw(:all);
|
2024-10-16 04:12:08 +02:00
|
|
|
my $event;
|
|
|
|
|
|
|
|
# email-conf - console-save, bootstrap-console-save, domain-create, domain-delete,
|
|
|
|
# ip-change, email-update, host-create, host-delete, host-modify, post-upgrade
|
|
|
|
# rcpthosts template was in smeserver qpsmtpd, and not used if qpsmtpd in use anymore
|
|
|
|
|
|
|
|
foreach (qw(
|
|
|
|
main.cf
|
|
|
|
master.cf
|
|
|
|
transport
|
|
|
|
virtual
|
2024-11-18 04:25:49 +01:00
|
|
|
sasl_passwd
|
2024-12-20 06:36:26 +01:00
|
|
|
generic
|
2024-11-18 04:25:49 +01:00
|
|
|
))
|
2024-10-16 04:12:08 +02:00
|
|
|
{
|
2024-11-18 04:25:49 +01:00
|
|
|
templates2events("/etc/postfix/$_", qw(
|
2024-10-16 04:12:08 +02:00
|
|
|
console-save
|
|
|
|
bootstrap-console-save
|
|
|
|
domain-create
|
|
|
|
domain-delete
|
|
|
|
ip-change
|
|
|
|
email-update
|
2024-11-18 04:25:49 +01:00
|
|
|
group-create
|
|
|
|
group-modify
|
|
|
|
group-delete
|
2024-10-16 04:12:08 +02:00
|
|
|
host-create
|
|
|
|
host-delete
|
|
|
|
host-modify
|
|
|
|
post-upgrade
|
|
|
|
smeserver-postfix-update
|
2024-11-18 04:25:49 +01:00
|
|
|
user-create
|
|
|
|
user-modify
|
|
|
|
user-delete
|
|
|
|
user-modify-admin
|
2024-10-16 04:12:08 +02:00
|
|
|
));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-11-18 04:25:49 +01:00
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for ssl-update event:
|
|
|
|
# write config files and create startup link
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "ssl-update";
|
|
|
|
templates2events("/etc/postfix/ssl/postfix.pem", $event);
|
|
|
|
|
2024-10-16 04:12:08 +02:00
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for console-save event:
|
|
|
|
# write config files and create startup link
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "console-save";
|
2024-11-18 04:25:49 +01:00
|
|
|
templates2events("/etc/postfix/ssl/postfix.pem", $event);
|
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
2024-10-16 04:12:08 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for bootstrap-console-save event:
|
|
|
|
# write config files and create startup link
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "bootstrap-console-save";
|
|
|
|
|
|
|
|
# TODO alternative ? event_link("qmail-update-user", $event, "55");
|
2024-11-18 04:25:49 +01:00
|
|
|
event_link('conf-postfix', $event, '04');
|
|
|
|
templates2events("/etc/postfix/ssl/postfix.pem", $event);
|
2024-10-16 04:12:08 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for domain-create event:
|
|
|
|
# rewrite config files and restart server
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "domain-create";
|
|
|
|
|
2024-11-18 04:25:49 +01:00
|
|
|
templates2events("/etc/postfix/ssl/postfix.pem", $event);
|
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for domain-modify event:
|
|
|
|
# rewrite config files and restart server
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "domain-modify";
|
|
|
|
|
|
|
|
templates2events("/etc/postfix/ssl/postfix.pem", $event);
|
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
2024-10-16 04:12:08 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for domain-delete event:
|
|
|
|
# rewrite config files and restart server
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "domain-delete";
|
|
|
|
|
2024-11-18 04:25:49 +01:00
|
|
|
templates2events("/etc/postfix/ssl/postfix.pem", $event);
|
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
2024-10-16 04:12:08 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for email-update event:
|
|
|
|
# email parameters have been changed in the e-smith
|
|
|
|
# manager; update system security, rewrite email config
|
|
|
|
# files, configure other system files (crontab is the
|
|
|
|
# important one), and restart server
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "email-update";
|
|
|
|
|
2024-11-18 04:25:49 +01:00
|
|
|
templates2events("/etc/postfix/ssl/postfix.pem", $event);
|
2024-10-16 04:12:08 +02:00
|
|
|
# TODO alternative ? event_link("qmail-update-user", $event, "03");
|
2024-11-18 04:25:49 +01:00
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
2024-10-16 04:12:08 +02:00
|
|
|
safe_symlink("adjust", "root/etc/e-smith/events/$event/services2adjust/masq");
|
|
|
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/smtp-auth-proxy");
|
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for group-create event:
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "group-create";
|
|
|
|
|
|
|
|
# TODO alternative ? safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/$event/S55email-assign");
|
2024-11-18 04:25:49 +01:00
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
|
|
|
# TODO need to reload postfix and expand /etc/postfix/virtual
|
2024-10-16 04:12:08 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for group-delete event:
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "group-delete";
|
|
|
|
|
|
|
|
# TODO alternative ? safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/$event/S55email-assign");
|
2024-11-18 04:25:49 +01:00
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
|
|
|
# TODO need to reload postfix and expand /etc/postfix/virtual
|
|
|
|
|
2024-10-16 04:12:08 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for group-modify event:
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "group-modify";
|
|
|
|
|
|
|
|
# TODO alternative ? safe_symlink("/var/qmail/bin/qmail-newu", "root/etc/e-smith/events/$event/S55email-assign");
|
2024-11-18 04:25:49 +01:00
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
2024-10-16 04:12:08 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for user-create event:
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "user-create";
|
|
|
|
|
|
|
|
# TODO alternative ? event_link("qmail-update-user", $event, "20");
|
2024-11-18 04:25:49 +01:00
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
2024-10-16 04:12:08 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for user-modify event
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "user-modify";
|
|
|
|
|
|
|
|
# TODO alternative ? event_link("qmail-update-user", $event, "20");
|
2024-11-18 04:25:49 +01:00
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
2024-10-16 04:12:08 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for user-modify-admin event
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "user-modify-admin";
|
|
|
|
|
|
|
|
# TODO alternative ? event_link("qmail-update-user", $event, "20");
|
2024-11-18 04:25:49 +01:00
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
2024-10-16 04:12:08 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for user-delete event
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "user-delete";
|
|
|
|
|
2024-11-18 04:25:49 +01:00
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
2024-10-16 04:12:08 +02:00
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for ip-up event:
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "ip-up";
|
|
|
|
|
|
|
|
# TODO alternative ? event_link("qmail-ipup", $event, "20");
|
|
|
|
|
|
|
|
#--------------------------------------------------
|
|
|
|
# actions for ip-change event:
|
|
|
|
#--------------------------------------------------
|
|
|
|
$event = "ip-change";
|
|
|
|
|
2024-11-18 04:25:49 +01:00
|
|
|
templates2events("/etc/postfix/ssl/postfix.pem", $event);
|
|
|
|
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
2024-10-16 04:12:08 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2024-09-25 04:51:20 +02:00
|
|
|
|
|
|
|
# our event specific for updating with yum without reboot
|
|
|
|
$event = 'smeserver-postfix-update';
|
|
|
|
#add here the path to your templates needed to expand
|
|
|
|
#see the /etc/systemd/system-preset/49-koozali.preset should be present for systemd integration on all you yum update event
|
|
|
|
|
|
|
|
# Maybe need ths in here as well:
|
|
|
|
# /etc/dar/DailyBackup.dcf - if backup requested
|
|
|
|
|
|
|
|
foreach my $file (qw(
|
|
|
|
/etc/systemd/system-preset/49-koozali.preset
|
|
|
|
))
|
|
|
|
{
|
|
|
|
templates2events( $file, $event );
|
|
|
|
};
|
2024-11-18 04:25:49 +01:00
|
|
|
|
|
|
|
templates2events("/etc/postfix/ssl/postfix.pem", $event);
|
|
|
|
|
2024-09-25 04:51:20 +02:00
|
|
|
#action needed in case we have a systemd unit
|
2024-11-18 04:25:49 +01:00
|
|
|
event_link('conf-postfix', $event, '04');
|
2024-09-25 04:51:20 +02:00
|
|
|
event_link('systemd-default', $event, '10');
|
|
|
|
event_link('systemd-reload', $event, '50');
|
2024-10-16 04:12:08 +02:00
|
|
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/postfix");
|
2024-11-18 04:25:49 +01:00
|
|
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/qpsmtpd");
|
|
|
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/sqpsmtpd");
|
|
|
|
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/uqpsmtpd");
|
2024-09-25 04:51:20 +02:00
|
|
|
|
2024-10-16 04:12:08 +02:00
|
|
|
#Backup files
|
2024-09-25 04:51:20 +02:00
|
|
|
# backup_includes("smeserver-postfix", qw(
|
|
|
|
# files(s) to be backed up
|
|
|
|
#));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|