From d0b3ae3969fb46e20b57d0b7cc0c2191ddd44c60 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 15 Jul 2017 17:23:05 -0400 Subject: releasing package propellor version 4.3.4 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index e7ec04bc..a60c5f18 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -propellor (4.3.4) UNRELEASED; urgency=medium +propellor (4.3.4) unstable; urgency=medium * Propellor.Property.Versioned: New module which allows different versions of a property or host to be written down in a propellor config @@ -6,7 +6,7 @@ propellor (4.3.4) UNRELEASED; urgency=medium * LightDM.autoLogin: Use [Seat:*] rather than the old [SeatDefaults]. The new name has been supported since lightdm 1.15. - -- Joey Hess Thu, 13 Jul 2017 15:52:24 -0400 + -- Joey Hess Sat, 15 Jul 2017 17:22:53 -0400 propellor (4.3.3) unstable; urgency=medium -- cgit v1.2.3 From cb885b8a925fcaaec3e3685fc5cd4c369593afef Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 16 Jul 2017 12:10:34 -0400 Subject: Propellor.Property.Timezone: New module, contributed by Sean Whitton. --- debian/changelog | 6 ++++++ doc/todo/merge_request:_Timezone.hs.mdwn | 2 ++ .../comment_1_9cfb5e48940e58f2064cbb5edf462c06._comment | 15 +++++++++++++++ propellor.cabal | 1 + 4 files changed, 24 insertions(+) create mode 100644 doc/todo/merge_request:_Timezone.hs/comment_1_9cfb5e48940e58f2064cbb5edf462c06._comment (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index a60c5f18..517151d8 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +propellor (4.3.5) UNRELEASED; urgency=medium + + * Propellor.Property.Timezone: New module, contributed by Sean Whitton. + + -- Joey Hess Sun, 16 Jul 2017 12:07:15 -0400 + propellor (4.3.4) unstable; urgency=medium * Propellor.Property.Versioned: New module which allows different diff --git a/doc/todo/merge_request:_Timezone.hs.mdwn b/doc/todo/merge_request:_Timezone.hs.mdwn index 3f67da2c..a8ba3eae 100644 --- a/doc/todo/merge_request:_Timezone.hs.mdwn +++ b/doc/todo/merge_request:_Timezone.hs.mdwn @@ -5,3 +5,5 @@ Adds `Timezone.configured`. I think that this works fine on stretch, but on Jessie there is some oddness. For example, if you set the timezone of a host to `US/Arizona`, the apt reconfiguration will put `America/Phoenix` in /etc/timezone, resulting in the property reporting a change every time that it is run. I think this is harmless. --spwhitton + +> [[merged|done]] --[[Joey]] diff --git a/doc/todo/merge_request:_Timezone.hs/comment_1_9cfb5e48940e58f2064cbb5edf462c06._comment b/doc/todo/merge_request:_Timezone.hs/comment_1_9cfb5e48940e58f2064cbb5edf462c06._comment new file mode 100644 index 00000000..026b13de --- /dev/null +++ b/doc/todo/merge_request:_Timezone.hs/comment_1_9cfb5e48940e58f2064cbb5edf462c06._comment @@ -0,0 +1,15 @@ +[[!comment format=mdwn + username="joey" + subject="""comment 1""" + date="2017-07-16T15:57:20Z" + content=""" +I generally consider properties that do work every time to be a minor bug. + +I wonder if it would be better to preseed tzdata rather than writing the +config file. I observe the same substitution from eg, US/Eastern to +America/New_York in the file when reconfiguring noninteractively, +but reconfiguring interactively I can select US/Eastern and that gets +into the file. + +Anyway, merged as this is certianly a good starting point. +"""]] diff --git a/propellor.cabal b/propellor.cabal index 733dda3e..43a3ab5e 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -150,6 +150,7 @@ Library Propellor.Property.Sudo Propellor.Property.Systemd Propellor.Property.Systemd.Core + Propellor.Property.Timezone Propellor.Property.Tor Propellor.Property.Unbound Propellor.Property.User -- cgit v1.2.3 From b6d650730be9369b89623f46cb773dcc880630cb Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 Jul 2017 12:42:31 -0400 Subject: Propellor.Property.Sudo.enabledFor: Made revertable (minor API change) This commit was sponsored by Henrik Riomar on Patreon. --- debian/changelog | 4 +++- propellor.cabal | 2 +- src/Propellor/Property/Sudo.hs | 24 +++++++++++++++++------- 3 files changed, 21 insertions(+), 9 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index 517151d8..d70018cc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ -propellor (4.3.5) UNRELEASED; urgency=medium +propellor (4.4.0) UNRELEASED; urgency=medium * Propellor.Property.Timezone: New module, contributed by Sean Whitton. + * Propellor.Property.Sudo.enabledFor: Made revertable. + (minor API change) -- Joey Hess Sun, 16 Jul 2017 12:07:15 -0400 diff --git a/propellor.cabal b/propellor.cabal index 43a3ab5e..d4417578 100644 --- a/propellor.cabal +++ b/propellor.cabal @@ -1,5 +1,5 @@ Name: propellor -Version: 4.3.4 +Version: 4.4.0 Cabal-Version: >= 1.20 License: BSD2 Maintainer: Joey Hess diff --git a/src/Propellor/Property/Sudo.hs b/src/Propellor/Property/Sudo.hs index 45ab8af2..1614801d 100644 --- a/src/Propellor/Property/Sudo.hs +++ b/src/Propellor/Property/Sudo.hs @@ -9,23 +9,33 @@ import Propellor.Property.User -- | Allows a user to sudo. If the user has a password, sudo is configured -- to require it. If not, NOPASSWORD is enabled for the user. -enabledFor :: User -> Property DebianLike -enabledFor user@(User u) = go `requires` Apt.installed ["sudo"] +enabledFor :: User -> RevertableProperty DebianLike DebianLike +enabledFor user@(User u) = setup `requires` Apt.installed ["sudo"] cleanup where - go :: Property UnixLike - go = property' desc $ \w -> do + setup :: Property UnixLike + setup = property' desc $ \w -> do locked <- liftIO $ isLockedPassword user ensureProperty w $ fileProperty desc (modify locked . filter (wanted locked)) - "/etc/sudoers" - desc = u ++ " is sudoer" + sudoers + where + desc = u ++ " is sudoer" + + cleanup :: Property DebianLike + cleanup = tightenTargets $ + fileProperty desc (filter notuserline) sudoers + where + desc = u ++ " is not sudoer" + + sudoers = "/etc/sudoers" sudobaseline = u ++ " ALL=(ALL:ALL)" + notuserline l = not (sudobaseline `isPrefixOf` l) sudoline True = sudobaseline ++ " NOPASSWD:ALL" sudoline False = sudobaseline ++ " ALL" wanted locked l -- TOOD: Full sudoers file format parse.. - | not (sudobaseline `isPrefixOf` l) = True + | notuserline l = True | "NOPASSWD" `isInfixOf` l = locked | otherwise = True modify locked ls -- cgit v1.2.3 From 1522d270077abad43a6d8d7fea2bd8163ed912fd Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 Jul 2017 12:51:40 -0400 Subject: Propellor.Property.LightDM.autoLogin: Made revertable. * Propellor.Property.LightDM.autoLogin: Made revertable. (minor API change) * Propellor.Property.Conffile: Added lacksIniSetting. This commit was sponsored by Jack Hill on Patreon. --- debian/changelog | 3 +++ src/Propellor/Property/ConfFile.hs | 14 ++++++++++++++ src/Propellor/Property/LightDM.hs | 14 +++++++++----- 3 files changed, 26 insertions(+), 5 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index d70018cc..e8b0358c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,9 @@ propellor (4.4.0) UNRELEASED; urgency=medium * Propellor.Property.Timezone: New module, contributed by Sean Whitton. * Propellor.Property.Sudo.enabledFor: Made revertable. (minor API change) + * Propellor.Property.LightDM.autoLogin: Made revertable. + (minor API change) + * Propellor.Property.Conffile: Added lacksIniSetting. -- Joey Hess Sun, 16 Jul 2017 12:07:15 -0400 diff --git a/src/Propellor/Property/ConfFile.hs b/src/Propellor/Property/ConfFile.hs index ce092ec9..76d52bd9 100644 --- a/src/Propellor/Property/ConfFile.hs +++ b/src/Propellor/Property/ConfFile.hs @@ -9,6 +9,7 @@ module Propellor.Property.ConfFile ( IniSection, IniKey, containsIniSetting, + lacksIniSetting, hasIniSection, lacksIniSection, iniFileContains, @@ -93,6 +94,19 @@ containsIniSetting f (header, key, value) = adjustIniSection go (l:ls) = if isKeyVal l then confline : ls else l : go ls isKeyVal x = (filter (/= ' ') . takeWhile (/= '=')) x `elem` [key, '#':key] +-- | Removes a key=value setting from a section of an .ini file. +-- Note that the section heading is left in the file, so this is not a +-- perfect reversion of containsIniSetting. +lacksIniSetting :: FilePath -> (IniSection, IniKey, String) -> Property UnixLike +lacksIniSetting f (header, key, value) = adjustIniSection + (f ++ " section [" ++ header ++ "] lacks " ++ key ++ "=" ++ value) + header + (filter (/= confline)) + id + f + where + confline = key ++ "=" ++ value + -- | Ensures that a .ini file exists and contains a section -- with a given key=value list of settings. hasIniSection :: FilePath -> IniSection -> [(IniKey, String)] -> Property UnixLike diff --git a/src/Propellor/Property/LightDM.hs b/src/Propellor/Property/LightDM.hs index 44f0e9f0..d471d314 100644 --- a/src/Propellor/Property/LightDM.hs +++ b/src/Propellor/Property/LightDM.hs @@ -10,8 +10,12 @@ installed :: Property DebianLike installed = Apt.installed ["lightdm"] -- | Configures LightDM to skip the login screen and autologin as a user. -autoLogin :: User -> Property DebianLike -autoLogin (User u) = "/etc/lightdm/lightdm.conf" `ConfFile.containsIniSetting` - ("Seat:*", "autologin-user", u) - `describe` "lightdm autologin" - `requires` installed +autoLogin :: User -> RevertableProperty DebianLike DebianLike +autoLogin (User u) = (setup cleanup) + `describe` ("lightdm autologin for " ++ u) + where + cf = "/etc/lightdm/lightdm.conf" + setting = ("Seat:*", "autologin-user", u) + setup = cf `ConfFile.containsIniSetting` setting + `requires` installed + cleanup = tightenTargets $ cf `ConfFile.lacksIniSetting` setting -- cgit v1.2.3 From 23d49eab939314edd4bfe4e762faaefd5966420e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 17 Jul 2017 12:55:05 -0400 Subject: releasing package propellor version 4.4.0 --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'debian') diff --git a/debian/changelog b/debian/changelog index e8b0358c..986dfd75 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -propellor (4.4.0) UNRELEASED; urgency=medium +propellor (4.4.0) unstable; urgency=medium * Propellor.Property.Timezone: New module, contributed by Sean Whitton. * Propellor.Property.Sudo.enabledFor: Made revertable. @@ -7,7 +7,7 @@ propellor (4.4.0) UNRELEASED; urgency=medium (minor API change) * Propellor.Property.Conffile: Added lacksIniSetting. - -- Joey Hess Sun, 16 Jul 2017 12:07:15 -0400 + -- Joey Hess Mon, 17 Jul 2017 12:55:02 -0400 propellor (4.3.4) unstable; urgency=medium -- cgit v1.2.3