Saltstack Official Apache Formula
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

11 роки тому
11 роки тому
11 роки тому
11 роки тому
11 роки тому
11 роки тому
11 роки тому
11 роки тому
11 роки тому
10 роки тому
11 роки тому
11 роки тому
11 роки тому
9 роки тому
8 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. # ``apache`` formula configuration:
  2. apache:
  3. # By default apache restart/reload states run (false skips)
  4. manage_service_states: True
  5. # lookup section overrides ``map.jinja`` values
  6. lookup:
  7. server: apache2
  8. service: apache2
  9. user: some_system_user
  10. group: some_system_group
  11. vhostdir: /etc/apache2/sites-available
  12. confdir: /etc/apache2/conf.d
  13. confext: .conf
  14. logdir: /var/log/apache2
  15. wwwdir: /srv/apache2
  16. # apache version (generally '2.2' or '2.4')
  17. version: '2.2'
  18. # ``apache.mod_wsgi`` formula additional configuration:
  19. mod_wsgi: mod_wsgi
  20. # Default value for AddDefaultCharset in RedHat configuration
  21. default_charset: 'UTF-8'
  22. global:
  23. # global apache directives
  24. AllowEncodedSlashes: 'On'
  25. name_virtual_hosts:
  26. - interface: '*'
  27. port: 80
  28. - interface: '*'
  29. port: 443
  30. # ``apache.vhosts`` formula additional configuration:
  31. sites:
  32. example.net:
  33. template_file: salt://apache/vhosts/minimal.tmpl
  34. example.com: # must be unique; used as an ID declaration in Salt.
  35. enabled: True
  36. template_file: salt://apache/vhosts/standard.tmpl # or minimal.tmpl or redirect.tmpl or proxy.tmpl
  37. ####################### DEFAULT VALUES BELOW ############################
  38. # NOTE: the values below are simply default settings that *can* be
  39. # overridden and are not required in order to use this formula to create
  40. # vhost entries.
  41. #
  42. # Do not copy the values below into your Pillar unless you intend to
  43. # modify these vaules.
  44. ####################### DEFAULT VALUES BELOW ############################
  45. template_engine: jinja
  46. interface: '*'
  47. port: '80'
  48. exclude_listen_directive: True # Do not add a Listen directive in httpd.conf
  49. ServerName: example.com # uses the unique ID above unless specified
  50. ServerAlias: www.example.com
  51. ServerAdmin: webmaster@example.com
  52. LogLevel: warn
  53. ErrorLog: /path/to/logs/example.com-error.log # E.g.: /var/log/apache2/example.com-error.log
  54. CustomLog: /path/to/logs/example.com-access.log # E.g.: /var/log/apache2/example.com-access.log
  55. DocumentRoot: /path/to/www/dir/example.com # E.g., /var/www/example.com
  56. SSLCertificateFile: /etc/ssl/mycert.pem # if ssl is desired
  57. SSLCertificateKeyFile: /etc/ssl/mycert.pem.key # if key for cert is needed or in an extra file
  58. SSLCertificateChainFile: /etc/ssl/mycert.chain.pem # if you require a chain of server certificates file
  59. Directory:
  60. # "default" is a special case; Adds ``/path/to/www/dir/example.com``
  61. # E.g.: /var/www/example.com
  62. default:
  63. Options: -Indexes +FollowSymLinks
  64. Order: allow,deny # For Apache < 2.4
  65. Allow: from all # For apache < 2.4
  66. Require: all granted # For apache > 2.4.
  67. AllowOverride: None
  68. Formula_Append: |
  69. Additional config as a
  70. multi-line string here
  71. 80-proxyexample.com:
  72. template_file: salt://apache/vhosts/redirect.tmpl
  73. ServerName: www.proxyexample.com
  74. ServerAlias: www.proxyexample.com
  75. RedirectSource: '/'
  76. RedirectTarget: 'https://www.proxyexample.com/'
  77. DocumentRoot: /var/www/proxy
  78. 443-proxyexample.com:
  79. template_file: salt://apache/vhosts/proxy.tmpl
  80. ServerName: www.proxyexample.com
  81. ServerAlias: www.proxyexample.com
  82. interface: '*'
  83. port: '443'
  84. DocumentRoot: /var/www/proxy
  85. Rewrite: |
  86. RewriteRule ^/webmail$ /webmail/ [R]
  87. RewriteRule ^/webmail(.*) http://mail.example.com$1 [P,L]
  88. RewriteRule ^/vicescws(.*) http://svc.example.com:92$1 [P,L]
  89. SSLCertificateFile: /etc/httpd/ssl/example.com.crt
  90. SSLCertificateKeyFile: /etc/httpd/ssl/example.com.key
  91. SSLCertificateChainFile: /etc/httpd/ssl/example.com.cer
  92. SSLCertificateFile_content: |
  93. -----BEGIN CERTIFICATE-----
  94. MIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL
  95. MAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC
  96. VU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx
  97. NDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD
  98. TjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu
  99. ZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j
  100. V14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj
  101. gbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA
  102. FFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE
  103. CBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS
  104. BgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE
  105. BQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju
  106. Wm7DCfrPNGVwFWUQOmsPue9rZBgO
  107. -----END CERTIFICATE-----
  108. SSLCertificateKeyFile_content: |
  109. -----BEGIN PRIVATE KEY-----
  110. MIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL
  111. MAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC
  112. VU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx
  113. NDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD
  114. TjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu
  115. ZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j
  116. V14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj
  117. gbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA
  118. FFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE
  119. CBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS
  120. BgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE
  121. BQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju
  122. Wm7DCfrPNGVwFWUQOmsPue9rZBgO
  123. -----END PRIVATE KEY-----
  124. SSLCertificateChainFile_content: |
  125. -----BEGIN CERTIFICATE-----
  126. MIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL
  127. MAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC
  128. VU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx
  129. NDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD
  130. TjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu
  131. ZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j
  132. V14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj
  133. gbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA
  134. FFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE
  135. CBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS
  136. BgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE
  137. BQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju
  138. Wm7DCfrPNGVwFWUQOmsPue9rZBgO
  139. -----END CERTIFICATE-----
  140. -----BEGIN CERTIFICATE-----
  141. MIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL
  142. MAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC
  143. VU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx
  144. NDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD
  145. TjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu
  146. ZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j
  147. V14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj
  148. gbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA
  149. FFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE
  150. CBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS
  151. BgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE
  152. BQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju
  153. Wm7DCfrPNGVwFWUQOmsPue9rZBgO
  154. -----END CERTIFICATE-----
  155. ProxyRequests: 'Off'
  156. ProxyPreserveHost: 'On'
  157. ProxyRoute:
  158. example prod proxy route:
  159. ProxyPassSource: '/'
  160. ProxyPassTarget: 'http://prod.example.com:85/'
  161. ProxyPassTargetOptions: 'connectiontimeout=10 timeout=90'
  162. ProxyPassReverseSource: '/'
  163. ProxyPassReverseTarget: 'http://prod.example.com:85/'
  164. example webmail proxy route:
  165. ProxyPassSource: '/webmail/'
  166. ProxyPassTarget: 'http://mail.example.com/'
  167. ProxyPassTargetOptions: 'connectiontimeout=10 timeout=90'
  168. ProxyPassReverseSource: '/webmail/'
  169. ProxyPassReverseTarget: 'http://mail.example.com/'
  170. example service proxy route:
  171. ProxyPassSource: '/svc/'
  172. ProxyPassTarget: 'http://svc.example.com:92/'
  173. ProxyPassTargetOptions: 'connectiontimeout=10 timeout=90'
  174. ProxyPassReverseSource: '/svc/'
  175. ProxyPassReverseTarget: 'http://svc.example.com:92/'
  176. Location:
  177. /:
  178. Require: False
  179. Formula_Append: |
  180. SecRuleRemoveById 981231
  181. SecRuleRemoveById 981173
  182. /error:
  183. Require: 'all granted'
  184. /docs:
  185. Order: allow,deny # For Apache < 2.4
  186. Allow: from all # For apache < 2.4
  187. Require: all granted # For apache > 2.4.
  188. Formula_Append: |
  189. Additional config as a
  190. multi-line string here
  191. LocationMatch:
  192. '^[.\\/]+([Ww][Ee][Bb][Mm][Aa][Ii][Ll])[.\\/]':
  193. Require: False
  194. Formula_Append: |
  195. RequestHeader set Host mail.example.com
  196. '^[.\\/]+([Ss][Vv][Cc])[.\\/]':
  197. Require: False
  198. Formula_Append: |
  199. Require ip 123.123.13.6 84.24.25.74
  200. Proxy_control:
  201. '*':
  202. AllowAll: False
  203. AllowCountry:
  204. - DE
  205. AllowIP:
  206. - 12.5.25.32
  207. - 12.5.25.33
  208. Alias:
  209. /docs: /usr/share/docs
  210. Formula_Append: |
  211. Additional config as a
  212. multi-line string here
  213. # ``apache.debian_full`` formula additional configuration:
  214. register-site:
  215. # any name as an array index, and you can duplicate this section
  216. UNIQUE_VALUE_HERE:
  217. name: 'my name'
  218. path: 'salt://path/to/sites-available/conf/file'
  219. state: 'enabled'
  220. # Optional - use managed file as Jinja Template
  221. #template: true
  222. #defaults:
  223. # custom_var: "default value"
  224. modules:
  225. enabled: # List modules to enable
  226. - ldap
  227. - ssl
  228. disabled: # List modules to disable
  229. - rewrite
  230. # KeepAlive: Whether or not to allow persistent connections (more than
  231. # one request per connection). Set to "Off" to deactivate.
  232. keepalive: 'On'
  233. security:
  234. # can be Full | OS | Minimal | Minor | Major | Prod
  235. # where Full conveys the most information, and Prod the least.
  236. ServerTokens: Prod
  237. # ``apache.mod_remoteip`` formula additional configuration:
  238. mod_remoteip:
  239. RemoteIPHeader: X-Forwarded-For
  240. RemoteIPTrustedProxy:
  241. - 10.0.8.0/24
  242. - 127.0.0.1
  243. # ``apache.mod_security`` formula additional configuration:
  244. mod_security:
  245. crs_install: True
  246. # If not set, default distro's configuration is installed as is
  247. manage_config: True
  248. sec_rule_engine: 'On'
  249. sec_request_body_access: 'On'
  250. sec_request_body_limit: '14000000'
  251. sec_request_body_no_files_limit: '114002'
  252. sec_request_body_in_memory_limit: '114002'
  253. sec_request_body_limit_action: 'Reject'
  254. sec_pcre_match_limit: '15000'
  255. sec_pcre_match_limit_recursion: '15000'
  256. sec_debug_log_level: '3'
  257. rules:
  258. enabled:
  259. modsecurity_crs_10_setup.conf:
  260. rule_set: ''
  261. enabled: True
  262. modsecurity_crs_20_protocol_violations.conf:
  263. rule_set: 'base_rules'
  264. enabled: False
  265. custom_rule_files:
  266. # any name as an array index, and you can duplicate this section
  267. UNIQUE_VALUE_HERE:
  268. file: 'my name'
  269. path: 'salt://path/to/modsecurity/custom/file'
  270. enabled: True