summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog1
-rw-r--r--propellor.cabal1
-rw-r--r--src/Propellor/Property/Aiccu.hs2
-rw-r--r--src/Propellor/Property/Logcheck.hs33
4 files changed, 36 insertions, 1 deletions
diff --git a/debian/changelog b/debian/changelog
index 41f1435c..4d269021 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ propellor (2.8.1) UNRELEASED; urgency=medium
* Guard against power loss etc when building propellor, by updating
the executable atomically.
+ * Added Logcheck module, contributed by Jelmer Vernooij.
-- Joey Hess <id@joeyh.name> Fri, 25 Sep 2015 09:21:41 -0400
diff --git a/propellor.cabal b/propellor.cabal
index f111174c..5cf5f2c8 100644
--- a/propellor.cabal
+++ b/propellor.cabal
@@ -105,6 +105,7 @@ Library
Propellor.Property.Rsync
Propellor.Property.List
Propellor.Property.LightDM
+ Propellor.Property.Logcheck
Propellor.Property.Scheduled
Propellor.Property.Service
Propellor.Property.Ssh
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"]