summaryrefslogtreecommitdiff
path: root/cfengine/cf.services.harden
blob: e8678fde59b5ea1ffd063005d45e574369186c8a (plain)
  1. control:
  2.     AddInstallable = ( install_logcheck )
  3. logcheck = ( /etc/logcheck )
  4. # $type indicates machine type (workstation or server). Used for logcheck paths
  5. Standalone:: type = ( workstation )
  6. !Standalone:: type = ( server )
  7. groups:
  8. install_logcheck = ( '/usr/bin/test ! -e /usr/sbin/logcheck' )
  9. #Define classes according to the installed MTA
  10. runs_postfix = ( '/usr/bin/test -e /usr/sbin/postfix' )
  11. editfiles:
  12. # AIDE section
  13. { /etc/aide/aide.conf
  14. #
  15. # Devices = p+i+n+u+g+s+b+md5+sha1
  16. #
  17. # Ignore ctime - some devices change ctime when used (ttySx with hylafax)
  18. #
  19. BeginGroupIfNoLineMatching "^[[:blank:]]*Devices[[:blank:]]*=.*"
  20. Append "Devices = p+i+n+u+g+s+b+md5+sha1 # Added by cfengine"
  21. EndGroup
  22. LocateLineMatching "^[[:blank:]]*Devices[[:blank:]]*=.*"
  23. BeginGroupIfNoLineMatching "^[[:blank:]]*Devices[[:blank:]]*=[[:blank:]][\+pinugsbmd5sha1]*([[:blank:]]+(#.*)?)?"
  24. ReplaceLineWith "Devices = p+i+n+u+g+s+b+md5+sha1 # Edited by cfengine"
  25. EndGroup
  26. #
  27. # #/var/log...
  28. #
  29. # Ignore logfiles - Aide can't handle rotation
  30. #
  31. HashCommentLinesMatching "^/var/log.*"
  32. #
  33. # !/dev/xconsole
  34. # !/dev/core
  35. # !/dev/ttyS*
  36. #
  37. LocateLineMatching "^[[:blank:]]*\!/dev/.*"
  38. CatchAbort
  39. BeginGroupIfNoLineMatching "^[[:blank:]]*\!/dev/.*"
  40. GotoLastLine
  41. EndGroup
  42. DeleteLinesMatching "^\!/dev/xconlsole # Added by cfengine"
  43. BeginGroupIfNoLineMatching "^[[:blank:]]*\!/dev/xconsole([[:blank:]]+(#.*)?)?"
  44. InsertLine "!/dev/xconsole # Added by cfengine"
  45. EndGroup
  46. BeginGroupIfNoLineMatching "^[[:blank:]]*\!/dev/core([[:blank:]]+(#.*)?)?"
  47. InsertLine "!/dev/core # Added by cfengine"
  48. EndGroup
  49. BeginGroupIfNoLineMatching "^[[:blank:]]*\!/dev/ttyS\*([[:blank:]]+(#.*)?)?"
  50. InsertLine "!/dev/ttyS* # Added by cfengine"
  51. EndGroup
  52. }
  53. ## logcheck section
  54. { /etc/integrit/integrit.conf
  55. #
  56. # Uncomment suggested defaults
  57. #
  58. SetCommentStart "# "
  59. SetCommentEnd ""
  60. UnCommentLinesMatching "^# root=/"
  61. UnCommentLinesMatching "^# known=/var/lib/integrit/.*"
  62. UnCommentLinesMatching "^# current=/var/lib/integrit/.*"
  63. UnCommentLinesMatching "^# !/cdrom"
  64. UnCommentLinesMatching "^# !/dev"
  65. UnCommentLinesMatching "^# !/etc"
  66. UnCommentLinesMatching "^# !/floppy"
  67. UnCommentLinesMatching "^# !/home"
  68. UnCommentLinesMatching "^# !/lost\+found"
  69. UnCommentLinesMatching "^# !/mnt"
  70. UnCommentLinesMatching "^# !/proc"
  71. UnCommentLinesMatching "^# !/root"
  72. UnCommentLinesMatching "^# !/tmp"
  73. UnCommentLinesMatching "^# !/var"
  74. UnCommentLinesMatching "^# =/usr/include"
  75. UnCommentLinesMatching "^# =/usr/X11R6/include"
  76. UnCommentLinesMatching "^# =/usr/doc"
  77. UnCommentLinesMatching "^# =/usr/info"
  78. UnCommentLinesMatching "^# =/usr/share"
  79. UnCommentLinesMatching "^# =/usr/X11R6/man"
  80. UnCommentLinesMatching "^# =/usr/X11R6/lib/X11/fonts"
  81. UnCommentLinesMatching "^# !/usr/local"
  82. UnCommentLinesMatching "^# !/usr/src"
  83. AppendIfNoSuchLine "!/initrd"
  84. AppendIfNoSuchLine "!/.journal"
  85. AppendIfNoSuchLine "!/usr/local"
  86. AppendIfNoSuchLine "!/usr/src"
  87. AppendIfNoSuchLine "!/dev/cpu/mtrr"
  88. }
  89. { /etc/cron.daily/integrit
  90. #
  91. # Uncomment defaults
  92. #
  93. SetCommentStart " # ! "
  94. SetCommentEnd ""
  95. UnCommentLinesMatching " # ! if .*"
  96. UnCommentLinesMatching " # ! fi"
  97. }
  98. ## logcheck section
  99. # FIXME: Put all files into $(LocalCommon)/logcheck/ignore.d.$(type)/local to support post-woody logcheck
  100. copy:
  101. #The linktype is necessary for links to be replaced with files.
  102. any::
  103. $(LocalCommon)/logcheck/ignore.d.$(type)/local dest=$(logcheck)/ignore.d/local linktype=copy
  104. $(LocalCommon)/logcheck/violations.ignore.d/local dest=$(logcheck)/violations.ignore.d/local linktype=copy
  105. # NameServer::
  106. # $(LocalCommon)/logcheck/ignore.d.$(type)/bind dest=$(logcheck)/ignore.d/local-bind linktype=copy
  107. # $(LocalCommon)/logcheck/violations.ignore.d/bind dest=$(logcheck)/violations.ignore.d/local-bind linktype=copy
  108. #
  109. # FileServer::
  110. # $(LocalCommon)/logcheck/ignore.d.$(type)/samba dest=$(logcheck)/ignore.d/local-samba linktype=copy
  111. # $(LocalCommon)/logcheck/ignore.d.$(type)/netatalk dest=$(logcheck)/ignore.d/local-netatalk linktype=copy
  112. # $(LocalCommon)/logcheck/violations.ignore.d/samba dest=$(logcheck)/violations.ignore.d/local-samba linktype=copy
  113. #
  114. # DHCPServer::
  115. # $(LocalCommon)/logcheck/ignore.d.$(type)/dhcp dest=$(logcheck)/ignore.d/local-dhcp linktype=copy
  116. # $(LocalCommon)/logcheck/ignore.d.$(type)/dhcp3-common dest=$(logcheck)/ignore.d/local-dhcp3-common linktype=copy
  117. #
  118. # WWWServer::
  119. #
  120. # FTPServer::
  121. # $(LocalCommon)/logcheck/ignore.d.$(type)/proftpd dest=$(logcheck)/ignore.d/local-proftpd linktype=copy
  122. # $(LocalCommon)/logcheck/violations.ignore.d/proftpd dest=$(logcheck)/violations.ignore.d/local-proftpd linktype=copy
  123. #
  124. # IMAPServer::
  125. # $(LocalCommon)/logcheck/ignore.d.$(type)/uw-imap dest=$(logcheck)/ignore.d/local-uw-imap linktype=copy
  126. #
  127. # SpamAssServer::
  128. # $(LocalCommon)/logcheck/ignore.d.$(type)/spamassassin dest=$(logcheck)/ignore.d/local-spamassassin linktype=copy
  129. #
  130. # runs_postfix::
  131. # $(LocalCommon)/logcheck/ignore.d.$(type)/postfix dest=$(logcheck)/ignore.d/local-postfix linktype=copy
  132. # $(LocalCommon)/logcheck/violations.ignore.d/postfix dest=$(logcheck)/violations.ignore.d/local-postfix linktype=copy
  133. #
  134. # any::
  135. # $(LocalCommon)/logcheck/ignore.d.$(type)/ssh dest=$(logcheck)/ignore.d/local-ssh linktype=copy
  136. # $(LocalCommon)/logcheck/violations.ignore.d/ssh dest=$(logcheck)/violations.ignore.d/local-ssh linktype=copy
  137. #
  138. ##links:
  139. ## any::
  140. ## # Set logcheck machine type (workstation or server)
  141. ## $(logcheck)/ignore.d ->! $(logcheck)/ignore.d.$(type)
  142. ## $(logcheck)/logcheck.ignore ->! $(logcheck)/logcheck.ignore.$(type)
  143. shellcommands:
  144. install_logcheck::
  145. # Install logcheck if not installed already
  146. "/usr/bin/yes no | /usr/bin/apt-get -q=2 install logcheck"