Saltstack Official Apache Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
6.7KB

  1. {% import_yaml "apache/osfingermap.yaml" as osfingermap %}
  2. {% import_yaml "apache/modsecurity.yaml" as modsec %}
  3. {% set apache = salt['grains.filter_by']({
  4. 'Gentoo': {
  5. 'server': 'www-servers/apache',
  6. 'service': 'apache2',
  7. 'user': 'apache',
  8. 'group': 'apache',
  9. 'configfile': '/etc/apache2/httpd.conf',
  10. 'mod_wsgi': 'www-apache/mod_wsgi',
  11. 'mod_fcgid': 'www-apache/mod_fcgid',
  12. 'vhostdir': '/etc/apache2/vhosts.d',
  13. 'confdir': '/etc/conf.d/apache2',
  14. 'confext': '.conf',
  15. 'default_site': 'default',
  16. 'default_site_ssl': 'default-ssl',
  17. 'logdir': '/var/log/apache2',
  18. 'logrotatedir': '/etc/logrotate.d/apache2',
  19. 'wwwdir': '/var/www',
  20. },
  21. 'Debian': {
  22. 'server': 'apache2',
  23. 'service': 'apache2',
  24. 'user': 'www-data',
  25. 'group': 'www-data',
  26. 'configfile': '/etc/apache2/apache2.conf',
  27. 'portsfile': '/etc/apache2/ports.conf',
  28. 'mod_wsgi': 'libapache2-mod-wsgi',
  29. 'mod_php5': 'libapache2-mod-php5',
  30. 'mod_perl2': 'libapache2-mod-perl2',
  31. 'mod_fcgid': 'libapache2-mod-fcgid',
  32. 'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb',
  33. 'mod_xsendfile': 'libapache2-mod-xsendfile',
  34. 'mod_fastcgi': 'libapache2-mod-fastcgi',
  35. 'mod_geoip': 'libapache2-mod-geoip',
  36. 'mod_geoip_database': 'geoip-database',
  37. 'vhostdir': '/etc/apache2/sites-available',
  38. 'confdir': '/etc/apache2/conf-available',
  39. 'confext': '.conf',
  40. 'default_site': 'default',
  41. 'default_site_ssl': 'default-ssl',
  42. 'logdir': '/var/log/apache2',
  43. 'logrotatedir': '/etc/logrotate.d/apache2',
  44. 'wwwdir': '/srv',
  45. },
  46. 'RedHat': {
  47. 'server': 'httpd',
  48. 'service': 'httpd',
  49. 'user': 'apache',
  50. 'group': 'apache',
  51. 'configfile': '/etc/httpd/conf/httpd.conf',
  52. 'mod_ssl': 'mod_ssl',
  53. 'mod_wsgi': 'mod_wsgi',
  54. 'conf_mod_wsgi': '/etc/httpd/conf.d/wsgi.conf',
  55. 'mod_php5': 'php',
  56. 'mod_fcgid': 'mod_fcgid',
  57. 'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm',
  58. 'mod_geoip': 'mod_geoip',
  59. 'mod_geoip_database': 'GeoIP',
  60. 'vhostdir': '/etc/httpd/vhosts.d',
  61. 'confdir': '/etc/httpd/conf.d',
  62. 'confext': '.conf',
  63. 'default_site': 'default',
  64. 'default_site_ssl': 'default-ssl',
  65. 'logdir': '/var/log/httpd',
  66. 'logrotatedir': '/etc/logrotate.d/httpd',
  67. 'wwwdir': '/var/www',
  68. 'default_charset': 'UTF-8',
  69. 'use_require': False,
  70. 'moddir': '/etc/httpd/conf.modules.d',
  71. },
  72. 'Suse': {
  73. 'server': 'apache2',
  74. 'service': 'apache2',
  75. 'user': 'wwwrun',
  76. 'group': 'www',
  77. 'configfile': '/etc/apache2/httpd.conf',
  78. 'mod_wsgi': 'apache2-mod_wsgi',
  79. 'mod_php5': 'apache2-mod_php5',
  80. 'mod_fcgid': 'apache2-mod_fcgid',
  81. 'vhostdir': '/etc/apache2/vhosts.d',
  82. 'confdir': '/etc/apache2/conf.d',
  83. 'confext': '.conf',
  84. 'default_site': 'vhost.template',
  85. 'default_site_ssl': 'vhost-ssl.template',
  86. 'logdir': '/var/log/apache2',
  87. 'wwwdir': '/srv/www',
  88. },
  89. 'FreeBSD': {
  90. 'server': 'apache24',
  91. 'service': 'apache24',
  92. 'user': 'www',
  93. 'group': 'www',
  94. 'configfile': '/usr/local/etc/apache24/httpd.conf',
  95. 'portsfile': '/usr/local/etc/apache24/ports.conf',
  96. 'mod_php5': 'mod_php56',
  97. 'mod_perl2': 'ap24-mod_perl2',
  98. 'mod_wsgi': 'ap24-mod_wsgi3',
  99. 'vhostdir': '/usr/local/etc/apache24/Includes',
  100. 'confdir': '/usr/local/etc/apache24/extra',
  101. 'modulesdir': '/usr/local/etc/apache24/modules.d',
  102. 'global_document_root': '/usr/local/www/apache24/data',
  103. 'confext': '',
  104. 'default_site': 'default',
  105. 'default_site_ssl': 'default-ssl',
  106. 'logdir': '/var/log/',
  107. 'wwwdir': '/usr/local/www/apache24/',
  108. },
  109. 'Arch': {
  110. 'server': 'apache',
  111. 'service': 'httpd',
  112. 'user': 'http',
  113. 'group': 'http',
  114. 'configfile': '/etc/httpd/conf/httpd.conf',
  115. 'mod_wsgi': 'mod_wsgi',
  116. 'vhostdir': '/etc/httpd/conf/vhosts',
  117. 'confdir': '/etc/httpd/conf/extra',
  118. 'modulesdir': '/usr/lib/httpd/modules',
  119. 'confext': '.conf',
  120. 'logdir': '/var/log/httpd',
  121. 'wwwdir': '/srv/http',
  122. 'default_site': 'default',
  123. 'default_site_ssl': 'default-ssl',
  124. },
  125. }, merge=salt['grains.filter_by']({
  126. 'precise': {
  127. 'confext': '',
  128. 'default_site': 'default',
  129. 'default_site_ssl': 'default-ssl',
  130. },
  131. 'trusty': {
  132. 'confext': '.conf',
  133. 'default_site': '000-default.conf',
  134. 'default_site_ssl': 'default-ssl.conf',
  135. },
  136. 'utopic': {
  137. 'confext': '.conf',
  138. 'default_site': '000-default.conf',
  139. 'default_site_ssl': 'default-ssl.conf',
  140. },
  141. 'vivid': {
  142. 'confext': '.conf',
  143. 'default_site': '000-default.conf',
  144. 'default_site_ssl': 'default-ssl.conf',
  145. },
  146. 'wily': {
  147. 'confext': '.conf',
  148. 'default_site': '000-default.conf',
  149. 'default_site_ssl': 'default-ssl.conf',
  150. },
  151. 'xenial': {
  152. 'confext': '.conf',
  153. 'default_site': '000-default.conf',
  154. 'default_site_ssl': 'default-ssl.conf',
  155. },
  156. 'yakkety': {
  157. 'confext': '.conf',
  158. 'default_site': '000-default.conf',
  159. 'default_site_ssl': 'default-ssl.conf',
  160. },
  161. 'zesty': {
  162. 'confext': '.conf',
  163. 'default_site': '000-default.conf',
  164. 'default_site_ssl': 'default-ssl.conf',
  165. },
  166. 'artful': {
  167. 'confext': '.conf',
  168. 'default_site': '000-default.conf',
  169. 'default_site_ssl': 'default-ssl.conf',
  170. },
  171. 'jessie': {
  172. 'wwwdir': '/var/www',
  173. 'confext': '.conf',
  174. 'default_site': '000-default.conf',
  175. 'default_site_ssl': 'default-ssl.conf',
  176. },
  177. 'stretch': {
  178. 'wwwdir': '/var/www',
  179. 'confext': '.conf',
  180. 'default_site': '000-default.conf',
  181. 'default_site_ssl': 'default-ssl.conf',
  182. },
  183. 'buster': {
  184. 'wwwdir': '/var/www',
  185. 'confext': '.conf',
  186. 'default_site': '000-default.conf',
  187. 'default_site_ssl': 'default-ssl.conf',
  188. },
  189. }, grain='oscodename', merge=salt['grains.filter_by'](
  190. osfingermap
  191. , grain='osfinger', merge=salt['pillar.get']('apache:lookup')))) %}
  192. {% set modsecurity = salt['grains.filter_by'](
  193. modsec
  194. , grain='os_family', merge=salt['pillar.get']('apache:mod_security')) or {} %}
  195. {# merge the os family/codename mod_sec's specific data over the defaults #}
  196. {% do apache.update({ 'mod_security': modsecurity }) %}