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

11 роки тому
11 роки тому
11 роки тому
11 роки тому
11 роки тому
11 роки тому
11 роки тому
11 роки тому
11 роки тому
10 роки тому
11 роки тому
11 роки тому
11 роки тому
9 роки тому
8 роки тому
7 роки тому
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  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 # Do not add ServerAlias unless defined
  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. DocumentRootUser: www-data # Force user if specified, leave it default if not
  57. DocumentRootGroup: www-data # Force group if specified, leave it default if not
  58. SSLCertificateFile: /etc/ssl/mycert.pem # if ssl is desired
  59. SSLCertificateKeyFile: /etc/ssl/mycert.pem.key # if key for cert is needed or in an extra file
  60. SSLCertificateChainFile: /etc/ssl/mycert.chain.pem # if you require a chain of server certificates file
  61. Directory:
  62. # "default" is a special case; Adds ``/path/to/www/dir/example.com``
  63. # E.g.: /var/www/example.com
  64. default:
  65. Options: -Indexes +FollowSymLinks
  66. Order: allow,deny # For Apache < 2.4
  67. Allow: from all # For apache < 2.4
  68. Require: all granted # For apache > 2.4.
  69. AllowOverride: None
  70. Formula_Append: |
  71. Additional config as a
  72. multi-line string here
  73. redirectmatch.com:
  74. # Use RedirectMatch Directive https://httpd.apache.org/docs/2.4/fr/mod/mod_alias.html#redirectmatch
  75. # Require module mod_alias
  76. enabled: True
  77. template_file: salt://apache/vhosts/redirect.tmpl
  78. ServerName: www.redirectmatch.com
  79. ServerAlias: www.redirectmatch.com
  80. RedirectMatch: true
  81. RedirectSource: '^/$'
  82. RedirectTarget: '/subdirectory'
  83. DocumentRoot: /var/www/html/
  84. ErrorLog: ${APACHE_LOG_DIR}/error.log
  85. CustomLog: ${APACHE_LOG_DIR}/access.log
  86. 80-proxyexample.com:
  87. template_file: salt://apache/vhosts/redirect.tmpl
  88. ServerName: www.proxyexample.com
  89. ServerAlias: www.proxyexample.com
  90. RedirectSource: '/'
  91. RedirectTarget: 'https://www.proxyexample.com/'
  92. DocumentRoot: /var/www/proxy
  93. 443-proxyexample.com:
  94. template_file: salt://apache/vhosts/proxy.tmpl
  95. ServerName: www.proxyexample.com
  96. ServerAlias: www.proxyexample.com
  97. interface: '*'
  98. port: '443'
  99. DocumentRoot: /var/www/proxy
  100. Rewrite: |
  101. RewriteRule ^/webmail$ /webmail/ [R]
  102. RewriteRule ^/webmail(.*) http://mail.example.com$1 [P,L]
  103. RewriteRule ^/vicescws(.*) http://svc.example.com:92$1 [P,L]
  104. SSLCertificateFile: /etc/httpd/ssl/example.com.crt
  105. SSLCertificateKeyFile: /etc/httpd/ssl/example.com.key
  106. SSLCertificateChainFile: /etc/httpd/ssl/example.com.cer
  107. SSLCertificateFile_content: |
  108. -----BEGIN CERTIFICATE-----
  109. MIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL
  110. MAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC
  111. VU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx
  112. NDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD
  113. TjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu
  114. ZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j
  115. V14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj
  116. gbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA
  117. FFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE
  118. CBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS
  119. BgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE
  120. BQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju
  121. Wm7DCfrPNGVwFWUQOmsPue9rZBgO
  122. -----END CERTIFICATE-----
  123. SSLCertificateKeyFile_content: |
  124. -----BEGIN PRIVATE KEY-----
  125. MIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL
  126. MAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC
  127. VU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx
  128. NDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD
  129. TjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu
  130. ZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j
  131. V14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj
  132. gbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA
  133. FFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE
  134. CBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS
  135. BgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE
  136. BQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju
  137. Wm7DCfrPNGVwFWUQOmsPue9rZBgO
  138. -----END PRIVATE KEY-----
  139. SSLCertificateChainFile_content: |
  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. -----BEGIN CERTIFICATE-----
  156. MIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL
  157. MAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC
  158. VU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx
  159. NDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD
  160. TjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu
  161. ZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j
  162. V14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj
  163. gbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA
  164. FFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE
  165. CBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS
  166. BgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE
  167. BQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju
  168. Wm7DCfrPNGVwFWUQOmsPue9rZBgO
  169. -----END CERTIFICATE-----
  170. ProxyRequests: 'Off'
  171. ProxyPreserveHost: 'On'
  172. ProxyRoute:
  173. example prod proxy route:
  174. ProxyPassSource: '/'
  175. ProxyPassTarget: 'http://prod.example.com:85/'
  176. ProxyPassTargetOptions: 'connectiontimeout=10 timeout=90'
  177. ProxyPassReverseSource: '/'
  178. ProxyPassReverseTarget: 'http://prod.example.com:85/'
  179. example webmail proxy route:
  180. ProxyPassSource: '/webmail/'
  181. ProxyPassTarget: 'http://mail.example.com/'
  182. ProxyPassTargetOptions: 'connectiontimeout=10 timeout=90'
  183. ProxyPassReverseSource: '/webmail/'
  184. ProxyPassReverseTarget: 'http://mail.example.com/'
  185. example service proxy route:
  186. ProxyPassSource: '/svc/'
  187. ProxyPassTarget: 'http://svc.example.com:92/'
  188. ProxyPassTargetOptions: 'connectiontimeout=10 timeout=90'
  189. ProxyPassReverseSource: '/svc/'
  190. ProxyPassReverseTarget: 'http://svc.example.com:92/'
  191. Location:
  192. /:
  193. Require: False
  194. Formula_Append: |
  195. SecRuleRemoveById 981231
  196. SecRuleRemoveById 981173
  197. /error:
  198. Require: 'all granted'
  199. /docs:
  200. Order: allow,deny # For Apache < 2.4
  201. Allow: from all # For apache < 2.4
  202. Require: all granted # For apache > 2.4.
  203. Formula_Append: |
  204. Additional config as a
  205. multi-line string here
  206. LocationMatch:
  207. '^[.\\/]+([Ww][Ee][Bb][Mm][Aa][Ii][Ll])[.\\/]':
  208. Require: False
  209. Formula_Append: |
  210. RequestHeader set Host mail.example.com
  211. '^[.\\/]+([Ss][Vv][Cc])[.\\/]':
  212. Require: False
  213. Formula_Append: |
  214. Require ip 123.123.13.6 84.24.25.74
  215. Proxy_control:
  216. '*':
  217. AllowAll: False
  218. AllowCountry:
  219. - DE
  220. AllowIP:
  221. - 12.5.25.32
  222. - 12.5.25.33
  223. Alias:
  224. /docs: /usr/share/docs
  225. Formula_Append: |
  226. Additional config as a
  227. multi-line string here
  228. # ``apache.debian_full`` formula additional configuration:
  229. register-site:
  230. # any name as an array index, and you can duplicate this section
  231. UNIQUE_VALUE_HERE:
  232. name: 'my name'
  233. path: 'salt://path/to/sites-available/conf/file'
  234. state: 'enabled'
  235. # Optional - use managed file as Jinja Template
  236. #template: true
  237. #defaults:
  238. # custom_var: "default value"
  239. modules:
  240. enabled: # List modules to enable
  241. - ldap
  242. - ssl
  243. disabled: # List modules to disable
  244. - rewrite
  245. # KeepAlive: Whether or not to allow persistent connections (more than
  246. # one request per connection). Set to "Off" to deactivate.
  247. keepalive: 'On'
  248. security:
  249. # can be Full | OS | Minimal | Minor | Major | Prod
  250. # where Full conveys the most information, and Prod the least.
  251. ServerTokens: Prod
  252. # ``apache.mod_remoteip`` formula additional configuration:
  253. mod_remoteip:
  254. RemoteIPHeader: X-Forwarded-For
  255. RemoteIPTrustedProxy:
  256. - 10.0.8.0/24
  257. - 127.0.0.1
  258. # ``apache.mod_security`` formula additional configuration:
  259. mod_security:
  260. crs_install: True
  261. # If not set, default distro's configuration is installed as is
  262. manage_config: True
  263. sec_rule_engine: 'On'
  264. sec_request_body_access: 'On'
  265. sec_request_body_limit: '14000000'
  266. sec_request_body_no_files_limit: '114002'
  267. sec_request_body_in_memory_limit: '114002'
  268. sec_request_body_limit_action: 'Reject'
  269. sec_pcre_match_limit: '15000'
  270. sec_pcre_match_limit_recursion: '15000'
  271. sec_debug_log_level: '3'
  272. rules:
  273. enabled:
  274. modsecurity_crs_10_setup.conf:
  275. rule_set: ''
  276. enabled: True
  277. modsecurity_crs_20_protocol_violations.conf:
  278. rule_set: 'base_rules'
  279. enabled: False
  280. custom_rule_files:
  281. # any name as an array index, and you can duplicate this section
  282. UNIQUE_VALUE_HERE:
  283. file: 'my name'
  284. path: 'salt://path/to/modsecurity/custom/file'
  285. enabled: True
  286. mod_ssl:
  287. # set this to True if you want to override your distributions default TLS configuration
  288. manage_tls_defaults: False
  289. # This stuff is deliberately not configured via map.jinja resp. apache:lookup.
  290. # We're unable to know sane defaults for each release of every distribution.
  291. # See https://github.com/saltstack-formulas/openssh-formula/issues/102 for a related discussion
  292. # Have a look at bettercrypto.org for up-to-date settings.
  293. # These are default values:
  294. SSLCipherSuite: EDH+CAMELLIA:EDH+aRSA:EECDH+aRSA+AESGCM:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH:+CAMELLIA256:+AES256:+CAMELLIA128:+AES128:+SSLv3:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!DSS:!RC4:!SEED:!ECDSA:CAMELLIA256-SHA:AES256-SHA:CAMELLIA128-SHA:AES128-SHA
  295. # Mitigate the CRIME attack
  296. SSLCompression: Off
  297. SSLProtocol: all -SSLv2 -SSLv3 -TLSv1
  298. SSLHonorCipherOrder: On
  299. SSLOptions: "+StrictRequire"