diff options
Diffstat (limited to 'src/Propellor')
| -rw-r--r-- | src/Propellor/Property/Aiccu.hs | 2 | ||||
| -rw-r--r-- | src/Propellor/Property/Logcheck.hs | 33 |
2 files changed, 34 insertions, 1 deletions
diff --git a/src/Propellor/Property/Aiccu.hs b/src/Propellor/Property/Aiccu.hs index e8aaa7bb..c49805b0 100644 --- a/src/Propellor/Property/Aiccu.hs +++ b/src/Propellor/Property/Aiccu.hs @@ -46,5 +46,5 @@ hasConfig t u = prop `onChange` restarted property "aiccu configured" . writeConfig writeConfig :: (((PrivDataField, PrivData) -> Propellor Result) -> Propellor Result) -> Propellor Result writeConfig getpassword = getpassword $ ensureProperty . go - go (Password _, p) = confPath `File.hasContentProtected` config u t p + go (Password u', p) = confPath `File.hasContentProtected` config u' t p go (f, _) = error $ "Unexpected type of privdata: " ++ show f diff --git a/src/Propellor/Property/Logcheck.hs b/src/Propellor/Property/Logcheck.hs new file mode 100644 index 00000000..83045dcc --- /dev/null +++ b/src/Propellor/Property/Logcheck.hs @@ -0,0 +1,33 @@ +module Propellor.Property.Logcheck ( + ReportLevel (Workstation, Server, Paranoid), + defaultPrefix, + ignoreFilePath, + ignoreLines, + installed, +) where + +import Propellor +import qualified Propellor.Property.Apt as Apt +import qualified Propellor.Property.File as File + +data ReportLevel = Workstation | Server | Paranoid +type Service = String + +instance Show ReportLevel where + show Workstation = "workstation" + show Server = "server" + show Paranoid = "paranoid" + +-- The common prefix used by default in syslog lines. +defaultPrefix :: String +defaultPrefix = "^\\w{3} [ :[:digit:]]{11} [._[:alnum:]-]+ " + +ignoreFilePath :: ReportLevel -> Service -> FilePath +ignoreFilePath t n = "/etc/logcheck/ignore.d." ++ (show t) </> n + +ignoreLines :: ReportLevel -> Service -> [String] -> Property NoInfo +ignoreLines t n ls = (ignoreFilePath t n) `File.containsLines` ls + `describe` ("logcheck ignore lines for " ++ n ++ "(" ++ (show t) ++ ")") + +installed :: Property NoInfo +installed = Apt.installed ["logcheck"] |
