diff -Nur e-smith-packetfilter-2.6.0.old/createlinks e-smith-packetfilter-2.6.0/createlinks --- e-smith-packetfilter-2.6.0.old/createlinks 2007-01-26 20:51:31.000000000 -0500 +++ e-smith-packetfilter-2.6.0/createlinks 2020-11-10 23:23:21.649000000 -0500 @@ -2,7 +2,7 @@ use esmith::Build::CreateLinks qw(:all); -templates2events("/etc/ulogd.conf", qw(post-install post-upgrade)); +templates2events("/etc/ulogd.conf", qw(post-install post-upgrade e-smith-packetfilter-update)); # conf-masq @@ -13,11 +13,12 @@ network-delete remoteaccess-update email-update + e-smith-packetfilter-update )); -foreach (qw(console-save ip-change network-create network-delete remoteaccess-update)) +foreach (qw(console-save ip-change network-create network-delete remoteaccess-update e-smith-packetfilter-update)) { - safe_symlink("adjust", "root/etc/e-smith/events/$_/services2adjust/masq"); + safe_symlink("reload", "root/etc/e-smith/events/$_/services2adjust/masq"); } my %service2order = @@ -29,5 +30,22 @@ foreach my $service (keys %service2order) { - service_link_enhanced($service, $service2order{$service}, 7); +# removed for systemd +# service_link_enhanced($service, $service2order{$service}, 7); } + +#systemd +foreach my $target (qw(multi-user sme-server)) +{ +system('mkdir -p root/usr/lib/systemd/system/'.$target.'.target.wants/'); + +foreach my $unit (qw( + masq.service + )) + { + symlink("../$unit", + "root/usr/lib/systemd/system/$target.target.wants/$unit") + or die "Can't symlink to root/usr/lib/systemd/system/$target.target.wants/$unit: $!"; + } +} + diff -Nur e-smith-packetfilter-2.6.0.old/root/usr/lib/systemd/system/masq.service e-smith-packetfilter-2.6.0/root/usr/lib/systemd/system/masq.service --- e-smith-packetfilter-2.6.0.old/root/usr/lib/systemd/system/masq.service 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-packetfilter-2.6.0/root/usr/lib/systemd/system/masq.service 2020-11-10 23:02:53.426000000 -0500 @@ -0,0 +1,18 @@ +[Unit] +Description=masq, the Koozali SME Server firewall script +Before=network-pre.target +Wants=network-pre.target +Conflicts=iptables.service ip6tables.service ebtables.service ipset.service nftables.service firewalld.service + +[Service] +Type=oneshot +ExecStartPre=/sbin/e-smith/service-status masq +ExecStart=/etc/rc.d/init.d/masq start +ExecStop=/etc/rc.d/init.d/masq stop +ExecReload=/etc/rc.d/init.d/masq adjust +RemainAfterExit=yes + + +[Install] +WantedBy=sme-server.target + diff -Nur e-smith-packetfilter-2.6.0.old/root/usr/lib/systemd/system-preset/80-koozali-packetfilter.preset e-smith-packetfilter-2.6.0/root/usr/lib/systemd/system-preset/80-koozali-packetfilter.preset --- e-smith-packetfilter-2.6.0.old/root/usr/lib/systemd/system-preset/80-koozali-packetfilter.preset 1969-12-31 19:00:00.000000000 -0500 +++ e-smith-packetfilter-2.6.0/root/usr/lib/systemd/system-preset/80-koozali-packetfilter.preset 2020-11-10 23:14:19.958000000 -0500 @@ -0,0 +1 @@ +enable masq.service