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