summaryrefslogtreecommitdiff
path: root/proftpd/proftpd_stricter.cf
blob: 1ea05288a870c0002ad445b2541486acbda8b857 (plain)
  1. #! /usr/bin/cfengine -qf
  2. control:
  3. OutputPrefix = ("${cf_prefix}")
  4. AddInstallable = ( proftpd_reload )
  5. actionsequence = (
  6. editfiles
  7. shellcommands
  8. processes
  9. )
  10. editfiles:
  11. { /etc/proftpd.conf
  12. DefineClasses "proftpd_reload"
  13. #
  14. # LsDefaultOptions -> ListOptions
  15. #
  16. # (Replace everywhere, as the daemon fails if the
  17. # deprecated option exists)
  18. #
  19. ResetSearch "1"
  20. ReplaceAll "LsDefaultOptions" With "ListOptions"
  21. #
  22. # (Make sure (remaining) cfengine hacks happens outside
  23. # of virtual hosts)
  24. #
  25. ResetSearch "1"
  26. BeginGroupIfNoSuchLine "# BEGIN CFENGINE"
  27. BeginGroupIfNoLineMatching "^[[:blank:]]*VirtualHost[[:blank:]].*"
  28. Append ""
  29. Append "# BEGIN CFENGINE"
  30. Append "# END CFENGINE (no virtual hosts above this line, please!)"
  31. EndGroup
  32. BeginGroupIfNoLineMatching "^# BEGIN CFENGINE.*"
  33. LocateLineMatching "^[[:blank:]]*VirtualHost[[:blank:]]"
  34. IncrementPointer "-1"
  35. InsertLine ""
  36. InsertLine "# BEGIN CFENGINE"
  37. InsertLine "# END CFENGINE (no virtual hosts above this line, please!)"
  38. InsertLine ""
  39. EndGroup
  40. EndGroup
  41. #
  42. # (Later options override earlier ones, so care only
  43. # about our own area from here on)
  44. #
  45. AbortAtLineMatching "^# END CFENGINE.*$"
  46. #
  47. # ListOptions "-la"
  48. #
  49. CatchAbort
  50. ResetSearch "1"
  51. LocateLineMatching "^# BEGIN CFENGINE"
  52. # WarnIfNoLineMatching "^[[:blank:]]*ListOptions[[:blank:]].*"
  53. BeginGroupIfNoLineMatching "^[[:blank:]]*ListOptions[[:blank:]].*"
  54. # LocateLineMatching "^# BEGIN CFENGINE"
  55. # InsertLine 'ListOptions "-la"'
  56. InsertLine "DefaultRooddddt ~"
  57. EndGroup
  58. CatchAbort
  59. ResetSearch "1"
  60. LocateLineMatching "^# BEGIN CFENGINE"
  61. LocateLineMatching "^[[:blank:]]*ListOptions[[:blank:]].*"
  62. BeginGroupIfNoLineMatching '^[[:blank:]]*ListOptions[[:blank:]]"-la"([[:blank:]]+(#.*)?)?$'
  63. ReplaceLineWith 'ListOptions "-la"'
  64. EndGroup
  65. CatchAbort
  66. #
  67. # DefaultRoot ~
  68. #
  69. ResetSearch "1"
  70. LocateLineMatching "^# BEGIN CFENGINE"
  71. WarnIfNoLineMatching "^[[:blank:]]*DefaultRoot[[:blank:]].*"
  72. BeginGroupIfNoLineMatching "^[[:blank:]]*DefaultRoot[[:blank:]].*"
  73. # LocateLineMatching "^# BEGIN CFENGINE"
  74. InsertLine 'DefaultRoot ~'
  75. EndGroup
  76. CatchAbort
  77. ResetSearch "1"
  78. LocateLineMatching "^# BEGIN CFENGINE"
  79. LocateLineMatching "^[[:blank:]]*DefaultRoot[[:blank:]].*"
  80. BeginGroupIfNoLineMatching "^[[:blank:]]*DefaultRoot[[:blank:]]+~$"
  81. ReplaceLineWith 'DefaultRoot ~'
  82. EndGroup
  83. CatchAbort
  84. #
  85. UnsetAbort "^# END CFENGINE.*$"
  86. }
  87. processes:
  88. "proftpd" restart "/etc/init.d/proftpd restart"
  89. shellcommands:
  90. proftpd_reload::
  91. "/etc/init.d/proftpd force-reload"