From 56908948a2f1c4b0743b88d9c06b518555c97778 Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Tue, 26 Nov 2024 14:48:10 +0100 Subject: [PATCH] maildir created by salt, remove pac-slices --- .../de/hsadmin/mods/pac/PacProcessorFactory.java | 1 + .../hsadmin/mods/user/UnixUserProcessorFactory.java | 12 ++---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/qserv/src/main/java/de/hsadmin/mods/pac/PacProcessorFactory.java b/qserv/src/main/java/de/hsadmin/mods/pac/PacProcessorFactory.java index 6ade622..d2d2e65 100644 --- a/qserv/src/main/java/de/hsadmin/mods/pac/PacProcessorFactory.java +++ b/qserv/src/main/java/de/hsadmin/mods/pac/PacProcessorFactory.java @@ -98,6 +98,7 @@ public class PacProcessorFactory implements EntityProcessorFactory { createUnlinkSiteProc(pac.getName() + ".hostsharing.net"), createHiveDNSRemoveProcessor(domainName), createAccountingRulesProc(), + new ShellProcessor("rm -rf '/etc/systemd/system/pacs-" + pac.getName() + ".slice'"), new ShellProcessor("salt-call state.sls pacs >/dev/null 2>&1")), "remove packet"); final Config config = Config.getInstance(); for (String queueName : config.getProperty("queues.dns").split(",")) { diff --git a/qserv/src/main/java/de/hsadmin/mods/user/UnixUserProcessorFactory.java b/qserv/src/main/java/de/hsadmin/mods/user/UnixUserProcessorFactory.java index 28089be..f21514a 100644 --- a/qserv/src/main/java/de/hsadmin/mods/user/UnixUserProcessorFactory.java +++ b/qserv/src/main/java/de/hsadmin/mods/user/UnixUserProcessorFactory.java @@ -28,7 +28,6 @@ public class UnixUserProcessorFactory implements EntityProcessorFactory { + ":" + user.getComment() + ":" + user.getHomedir() + ":" + user.getShell() + "\n")); appendSetHomeACLProcessor(aCP, user); - appendMakeMaildirProcessor(aCP, user); aCP.appendProcessor(new ShellProcessor("salt-call state.sls pacs >/dev/null 2>&1")); return aCP; } @@ -56,6 +55,7 @@ public class UnixUserProcessorFactory implements EntityProcessorFactory { public Processor createDeleteProcessor(EntityManager em, T entity) { UnixUser user = (UnixUser) entity; String uid = user.getName(); + long userId = user.getUserId(); String pac = user.getPac().getName(); if (uid != null && uid.length() > 4) { Processor killProcessesProc = new ShellProcessor("killall -TERM -u " + uid + " && sleep 5 && killall -KILL -u " + uid + " && sleep 5 || true"); @@ -70,6 +70,7 @@ public class UnixUserProcessorFactory implements EntityProcessorFactory { proc.appendProcessor(new ShellProcessor("rm -f '/var/mail/" + uid + "'")); proc.appendProcessor(new ShellProcessor("rm -f '/var/lib/systemd/linger/" + uid + "'")); proc.appendProcessor(new ShellProcessor("rm -rf '/home/storage/" + pac + "/users/" + ( uid.length() > 6 ? uid.substring(6) : '_' ) + "/'")); + proc.appendProcessor(new ShellProcessor("rm -rf '/etc/systemd/system/user@" + userId + ".service.d'")); proc.appendProcessor(new ShellProcessor("salt-call state.sls pacs >/dev/null 2>&1")); return proc; } @@ -80,13 +81,4 @@ public class UnixUserProcessorFactory implements EntityProcessorFactory { aCP.appendProcessor(new ShellProcessor("chmod 700 " + user.getHomedir())); } - private void appendMakeMaildirProcessor(CompoundProcessor aCP, UnixUser user) { - aCP.appendProcessor( - new ShellProcessor( - "su -l " + user.getName() + " -s \"/bin/bash\" -c \"maildirmake.dovecot " + - user.getHomedir() + "/Maildir" + - "\"" - )); - } - }