smeserver-postfix/createlinks

221 lines
7.6 KiB
Plaintext
Raw Permalink Normal View History

2024-09-25 04:51:20 +02:00
#!/usr/bin/perl -w
use esmith::Build::CreateLinks qw(:all);
use esmith::Build::Backup qw(:all);
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
sasl_passwd
))
{
templates2events("/etc/postfix/$_", qw(
console-save
bootstrap-console-save
domain-create
domain-delete
ip-change
email-update
group-create
group-modify
group-delete
host-create
host-delete
host-modify
post-upgrade
smeserver-postfix-update
user-create
user-modify
user-delete
user-modify-admin
));
}
#--------------------------------------------------
# actions for ssl-update event:
# write config files and create startup link
#--------------------------------------------------
$event = "ssl-update";
templates2events("/etc/postfix/ssl/postfix.pem", $event);
#--------------------------------------------------
# actions for console-save event:
# write config files and create startup link
#--------------------------------------------------
$event = "console-save";
templates2events("/etc/postfix/ssl/postfix.pem", $event);
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# 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");
event_link('conf-postfix', $event, '04');
templates2events("/etc/postfix/ssl/postfix.pem", $event);
#--------------------------------------------------
# actions for domain-create event:
# rewrite config files and restart server
#--------------------------------------------------
$event = "domain-create";
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");
#--------------------------------------------------
# actions for domain-delete event:
# rewrite config files and restart server
#--------------------------------------------------
$event = "domain-delete";
templates2events("/etc/postfix/ssl/postfix.pem", $event);
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# 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";
templates2events("/etc/postfix/ssl/postfix.pem", $event);
# TODO alternative ? event_link("qmail-update-user", $event, "03");
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
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");
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
# TODO need to reload postfix and expand /etc/postfix/virtual
#--------------------------------------------------
# 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");
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
# TODO need to reload postfix and expand /etc/postfix/virtual
#--------------------------------------------------
# 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");
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# actions for user-create event:
#--------------------------------------------------
$event = "user-create";
# TODO alternative ? event_link("qmail-update-user", $event, "20");
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# actions for user-modify event
#--------------------------------------------------
$event = "user-modify";
# TODO alternative ? event_link("qmail-update-user", $event, "20");
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# actions for user-modify-admin event
#--------------------------------------------------
$event = "user-modify-admin";
# TODO alternative ? event_link("qmail-update-user", $event, "20");
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# actions for user-delete event
#--------------------------------------------------
$event = "user-delete";
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
#--------------------------------------------------
# actions for ip-up event:
#--------------------------------------------------
$event = "ip-up";
# TODO alternative ? event_link("qmail-ipup", $event, "20");
#--------------------------------------------------
# actions for ip-change event:
#--------------------------------------------------
$event = "ip-change";
templates2events("/etc/postfix/ssl/postfix.pem", $event);
safe_symlink("reload", "root/etc/e-smith/events/$event/services2adjust/postfix");
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 );
};
templates2events("/etc/postfix/ssl/postfix.pem", $event);
2024-09-25 04:51:20 +02:00
#action needed in case we have a systemd unit
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');
safe_symlink("restart", "root/etc/e-smith/events/$event/services2adjust/postfix");
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
#Backup files
2024-09-25 04:51:20 +02:00
# backup_includes("smeserver-postfix", qw(
# files(s) to be backed up
#));