summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2016-05-28 14:48:59 -0400
committerJoey Hess2016-05-28 14:48:59 -0400
commita52f7a546def6685be8dba5d7145b1f50aaa35d2 (patch)
treeb31a177091c3697a95c93a7b578b752e5aaad8cd
parentdfd567ec3e71d68bba974c23dd4ae27fed37ec0f (diff)
deal with systemd's KillUserProcesses change
* Systemd: Added killUserProcesses property, which can be reverted to return systemd to its default behavior before version 230 started killing processes like screen sessions. * Systemd: Added logindConfigured property.
-rw-r--r--debian/changelog4
-rw-r--r--joeyconfig.hs3
-rw-r--r--src/Propellor/Property/Systemd.hs27
3 files changed, 34 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 02bf0d1e..0f85ccf0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ propellor (3.0.5) UNRELEASED; urgency=medium
* Modules added for Sbuild and Ccache.
Thanks, Sean Whitton
+ * Systemd: Added killUserProcesses property, which can be reverted
+ to return systemd to its default behavior before version 230 started
+ killing processes like screen sessions.
+ * Systemd: Added logindConfigured property.
-- Joey Hess <id@joeyh.name> Mon, 23 May 2016 11:19:28 -0400
diff --git a/joeyconfig.hs b/joeyconfig.hs
index 20103e61..98c565c5 100644
--- a/joeyconfig.hs
+++ b/joeyconfig.hs
@@ -564,6 +564,9 @@ standardSystemUnhardened suite arch motd = propertyList "standard system" $ prop
-- I use postfix, or no MTA.
& Apt.removed ["exim4", "exim4-daemon-light", "exim4-config", "exim4-base"]
`onChange` Apt.autoRemove
+ -- At least until system integration catches up, revert
+ -- systemd 230's behavior of enabling this property by default.
+ ! Systemd.killUserProcesses
-- This is my standard container setup, Featuring automatic upgrades.
standardContainer :: DebianSuite -> Property (HasInfo + Debian)
diff --git a/src/Propellor/Property/Systemd.hs b/src/Propellor/Property/Systemd.hs
index e5441817..e11c991e 100644
--- a/src/Propellor/Property/Systemd.hs
+++ b/src/Propellor/Property/Systemd.hs
@@ -12,6 +12,7 @@ module Propellor.Property.Systemd (
restarted,
networkd,
journald,
+ logind,
-- * Configuration
installed,
Option,
@@ -20,6 +21,9 @@ module Propellor.Property.Systemd (
-- * Journal
persistentJournal,
journaldConfigured,
+ -- * Logind
+ logindConfigured,
+ killUserProcesses,
-- * Containers and machined
machined,
MachineName,
@@ -127,6 +131,10 @@ networkd = "systemd-networkd"
journald :: ServiceName
journald = "systemd-journald"
+-- | The systemd-logind service.
+logind :: ServiceName
+logind = "systemd-logind"
+
-- | Enables persistent storage of the journal.
persistentJournal :: Property DebianLike
persistentJournal = check (not <$> doesDirectoryExist dir) $
@@ -172,6 +180,25 @@ journaldConfigured option value =
configured "/etc/systemd/journald.conf" option value
`onChange` restarted journald
+-- | Configures logind, restarting it so the changes take effect.
+logindConfigured :: Option -> String -> Property Linux
+logindConfigured option value =
+ configured "/etc/systemd/logind.conf" option value
+ `onChange` restarted logind
+
+-- | Configures whether leftover processes started from the
+-- user's login session are killed after the user logs out.
+--
+-- The default configuration varies depending on the version of systemd.
+--
+-- Revert the property to ensure that screen sessions etc keep running:
+--
+-- > ! killUserProcesses
+killUserProcesses :: RevertableProperty Linux Linux
+killUserProcesses = set "yes" <!> set "no"
+ where
+ set = logindConfigured "KillUserProcesses"
+
-- | Ensures machined and machinectl are installed
machined :: Property Linux
machined = withOS "machined installed" $ \w o ->