summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess2015-09-29 10:33:21 -0400
committerJoey Hess2015-09-29 10:33:21 -0400
commitaad21db651a8b23e8bfa0eb2e4c9d0e3fa76d962 (patch)
tree67fe537271f1fd2412551de4ceed1f59459094f1 /src
parentfe54ed07fa28df41fc2fba85bb2b166e76d1d89e (diff)
parentd9bfd1eb50b8ac3f7621be238eb69833a6e4539a (diff)
Merge branch 'joeyconfig'
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Property/Aiccu.hs2
-rw-r--r--src/Propellor/Property/Logcheck.hs33
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"]