diff options
| author | Joey Hess <joeyh@joeyh.name> | 2015-12-14 14:54:51 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2015-12-14 14:54:51 -0400 |
| commit | 81f35a5f8df6907dba394b028d2c7bcbf18cdc5f (patch) | |
| tree | d871093402608f9e43a1cfa23c52f2019b3f00f7 /src/Propellor/Property | |
| parent | ea1b7f15af0fd277ec5431d034b6aecaa45a8d72 (diff) | |
| parent | b67c39f990ef0ccf465280e0ecdcbff85b94857c (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'src/Propellor/Property')
| -rw-r--r-- | src/Propellor/Property/User.hs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/Propellor/Property/User.hs b/src/Propellor/Property/User.hs index ea88a1b3..c9c91a77 100644 --- a/src/Propellor/Property/User.hs +++ b/src/Propellor/Property/User.hs @@ -18,6 +18,30 @@ accountFor user@(User u) = check nohomedir go , u ] +systemAccountFor :: User -> Property NoInfo +systemAccountFor user@(User u) = systemAccountFor' user Nothing (Just (Group u)) + +systemAccountFor' :: User -> Maybe FilePath -> Maybe Group -> Property NoInfo +systemAccountFor' (User u) mhome mgroup = check nouser go + `describe` ("system account for " ++ u) + where + nouser = isNothing <$> catchMaybeIO (getUserEntryForName u) + go = cmdProperty "adduser" $ + [ "--system" ] + ++ + "--home" : maybe + ["/nonexistent", "--no-create-home"] + ( \h -> [ h ] ) + mhome + ++ + maybe [] ( \(Group g) -> ["--ingroup", g] ) mgroup + ++ + [ "--shell", "/usr/bin/nologin" + , "--disabled-login" + , "--disabled-password" + , u + ] + -- | Removes user home directory!! Use with caution. nuked :: User -> Eep -> Property NoInfo nuked user@(User u) _ = check hashomedir go @@ -131,7 +155,7 @@ hasDesktopGroups user@(User u) = property desc $ do desc = "user " ++ u ++ " is in standard desktop groups" -- This list comes from user-setup's debconf -- template named "passwd/user-default-groups" - desktopgroups = + desktopgroups = [ "audio" , "cdrom" , "dip" |
