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