Saltstack Official Apache Formula
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

388 行
14KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=yaml
  3. ---
  4. # ``apache`` formula configuration:
  5. apache:
  6. # By default apache restart/reload states run (false skips)
  7. manage_service_states: true
  8. # lookup section overrides ``map.jinja`` values
  9. lookup:
  10. server: apache2
  11. service: apache2
  12. user: some_system_user
  13. group: some_system_group
  14. vhostdir: /etc/apache2/sites-available
  15. confdir: /etc/apache2/conf.d
  16. confext: .conf
  17. logdir: /var/log/apache2
  18. wwwdir: /srv/apache2
  19. # apache version (generally '2.2' or '2.4')
  20. version: '2.2'
  21. # ``apache.mod_wsgi`` formula additional configuration:
  22. mod_wsgi: mod_wsgi
  23. # Default value for AddDefaultCharset in RedHat configuration
  24. default_charset: 'UTF-8'
  25. # Should we enforce DocumentRoot user/group?
  26. # Default: do not enforce
  27. document_root_user: www-data # Force user if specified, leave it default if not
  28. document_root_group: null # Do not enforce group
  29. global:
  30. # global apache directives
  31. AllowEncodedSlashes: 'On'
  32. name_virtual_hosts:
  33. - interface: '*'
  34. port: 80
  35. - interface: '*'
  36. port: 443
  37. # ``apache.vhosts`` formula additional configuration:
  38. sites:
  39. example.net:
  40. template_file: salt://apache/vhosts/minimal.tmpl
  41. example.com: # must be unique; used as an ID declaration in Salt.
  42. enabled: true
  43. # or minimal.tmpl or redirect.tmpl or proxy.tmpl
  44. template_file: salt://apache/vhosts/standard.tmpl
  45. ####################### DEFAULT VALUES BELOW ############################
  46. # NOTE: the values below are simply default settings that *can* be
  47. # overridden and are not required in order to use this formula to create
  48. # vhost entries.
  49. #
  50. # Do not copy the values below into your Pillar unless you intend to
  51. # modify these vaules.
  52. ####################### DEFAULT VALUES BELOW ############################
  53. template_engine: jinja
  54. interface: '*'
  55. port: '80'
  56. exclude_listen_directive: true # Do not add a Listen directive in httpd.conf
  57. ServerName: example.com # uses the unique ID above unless specified
  58. # ServerAlias: www.example.com # Do not add ServerAlias unless defined
  59. ServerAdmin: webmaster@example.com
  60. LogLevel: warn
  61. # E.g.: /var/log/apache2/example.com-error.log
  62. ErrorLog: /path/to/logs/example.com-error.log
  63. # E.g.: /var/log/apache2/example.com-access.log
  64. CustomLog: /path/to/logs/example.com-access.log
  65. # E.g., /var/www/example.com
  66. DocumentRoot: /path/to/www/dir/example.com
  67. # do not enforce user, defaults to lookup:document_root_user
  68. DocumentRootUser: null
  69. # Force group, defaults to lookup:document_root_group
  70. DocumentRootGroup: www-data
  71. # if ssl is desired
  72. SSLCertificateFile: /etc/ssl/mycert.pem
  73. # if key for cert is needed or in an extra file
  74. SSLCertificateKeyFile: /etc/ssl/mycert.pem.key
  75. # if you require a chain of server certificates file
  76. SSLCertificateChainFile: /etc/ssl/mycert.chain.pem
  77. Directory:
  78. # "default" is a special case; uses DocumentRoot value
  79. # E.g.: /var/www/example.com
  80. default:
  81. Options: -Indexes +FollowSymLinks
  82. Order: allow,deny # For Apache < 2.4
  83. Allow: from all # For apache < 2.4
  84. Require: all granted # For apache > 2.4.
  85. AllowOverride: None
  86. Formula_Append: |
  87. Additional config as a
  88. multi-line string here
  89. redirectmatch.com:
  90. # Use RedirectMatch Directive
  91. # - https://httpd.apache.org/docs/2.4/fr/mod/mod_alias.html#redirectmatch
  92. # Require module mod_alias
  93. enabled: true
  94. template_file: salt://apache/vhosts/redirect.tmpl
  95. ServerName: www.redirectmatch.com
  96. ServerAlias: www.redirectmatch.com
  97. RedirectMatch: true
  98. RedirectSource: '^/$'
  99. RedirectTarget: '/subdirectory'
  100. DocumentRoot: /var/www/html/
  101. ErrorLog: ${APACHE_LOG_DIR}/error.log
  102. CustomLog: ${APACHE_LOG_DIR}/access.log
  103. 80-proxyexample.com:
  104. template_file: salt://apache/vhosts/redirect.tmpl
  105. ServerName: www.proxyexample.com
  106. ServerAlias: www.proxyexample.com
  107. RedirectSource: '/'
  108. RedirectTarget: 'https://www.proxyexample.com/'
  109. DocumentRoot: /var/www/proxy
  110. 443-proxyexample.com:
  111. template_file: salt://apache/vhosts/proxy.tmpl
  112. ServerName: www.proxyexample.com
  113. ServerAlias: www.proxyexample.com
  114. interface: '*'
  115. port: '443'
  116. DocumentRoot: /var/www/proxy
  117. Rewrite: |
  118. RewriteRule ^/webmail$ /webmail/ [R]
  119. RewriteRule ^/webmail(.*) http://mail.example.com$1 [P,L]
  120. RewriteRule ^/vicescws(.*) http://svc.example.com:92$1 [P,L]
  121. SSLCertificateFile: /etc/httpd/ssl/example.com.crt
  122. SSLCertificateKeyFile: /etc/httpd/ssl/example.com.key
  123. SSLCertificateChainFile: /etc/httpd/ssl/example.com.cer
  124. SSLCertificateFile_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. SSLCertificateKeyFile_content: |
  141. -----BEGIN PRIVATE KEY-----
  142. MIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL
  143. MAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC
  144. VU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx
  145. NDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD
  146. TjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu
  147. ZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j
  148. V14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj
  149. gbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA
  150. FFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE
  151. CBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS
  152. BgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE
  153. BQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju
  154. Wm7DCfrPNGVwFWUQOmsPue9rZBgO
  155. -----END PRIVATE KEY-----
  156. SSLCertificateChainFile_content: |
  157. -----BEGIN CERTIFICATE-----
  158. MIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL
  159. MAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC
  160. VU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx
  161. NDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD
  162. TjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu
  163. ZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j
  164. V14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj
  165. gbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA
  166. FFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE
  167. CBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS
  168. BgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE
  169. BQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju
  170. Wm7DCfrPNGVwFWUQOmsPue9rZBgO
  171. -----END CERTIFICATE-----
  172. -----BEGIN CERTIFICATE-----
  173. MIICUTCCAfugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJDTjEL
  174. MAkGA1UECBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMC
  175. VU4xFDASBgNVBAMTC0hlcm9uZyBZYW5nMB4XDTA1MDcxNTIxMTk0N1oXDTA1MDgx
  176. NDIxMTk0N1owVzELMAkGA1UEBhMCQ04xCzAJBgNVBAgTAlBOMQswCQYDVQQHEwJD
  177. TjELMAkGA1UEChMCT04xCzAJBgNVBAsTAlVOMRQwEgYDVQQDEwtIZXJvbmcgWWFu
  178. ZzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQCp5hnG7ogBhtlynpOS21cBewKE/B7j
  179. V14qeyslnr26xZUsSVko36ZnhiaO/zbMOoRcKK9vEcgMtcLFuQTWDl3RAgMBAAGj
  180. gbEwga4wHQYDVR0OBBYEFFXI70krXeQDxZgbaCQoR4jUDncEMH8GA1UdIwR4MHaA
  181. FFXI70krXeQDxZgbaCQoR4jUDncEoVukWTBXMQswCQYDVQQGEwJDTjELMAkGA1UE
  182. CBMCUE4xCzAJBgNVBAcTAkNOMQswCQYDVQQKEwJPTjELMAkGA1UECxMCVU4xFDAS
  183. BgNVBAMTC0hlcm9uZyBZYW5nggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEE
  184. BQADQQA/ugzBrjjK9jcWnDVfGHlk3icNRq0oV7Ri32z/+HQX67aRfgZu7KWdI+Ju
  185. Wm7DCfrPNGVwFWUQOmsPue9rZBgO
  186. -----END CERTIFICATE-----
  187. ProxyRequests: 'Off'
  188. ProxyPreserveHost: 'On'
  189. ProxyRoute:
  190. example prod proxy route:
  191. ProxyPassSource: '/'
  192. ProxyPassTarget: 'http://prod.example.com:85/'
  193. ProxyPassTargetOptions: 'connectiontimeout=10 timeout=90'
  194. ProxyPassReverseSource: '/'
  195. ProxyPassReverseTarget: 'http://prod.example.com:85/'
  196. example webmail proxy route:
  197. ProxyPassSource: '/webmail/'
  198. ProxyPassTarget: 'http://mail.example.com/'
  199. ProxyPassTargetOptions: 'connectiontimeout=10 timeout=90'
  200. ProxyPassReverseSource: '/webmail/'
  201. ProxyPassReverseTarget: 'http://mail.example.com/'
  202. example service proxy route:
  203. ProxyPassSource: '/svc/'
  204. ProxyPassTarget: 'http://svc.example.com:92/'
  205. ProxyPassTargetOptions: 'connectiontimeout=10 timeout=90'
  206. ProxyPassReverseSource: '/svc/'
  207. ProxyPassReverseTarget: 'http://svc.example.com:92/'
  208. Location:
  209. /:
  210. Require: false
  211. Formula_Append: |
  212. SecRuleRemoveById 981231
  213. SecRuleRemoveById 981173
  214. /error:
  215. Require: 'all granted'
  216. /docs:
  217. Order: allow,deny # For Apache < 2.4
  218. Allow: from all # For apache < 2.4
  219. Require: all granted # For apache > 2.4.
  220. Formula_Append: |
  221. Additional config as a
  222. multi-line string here
  223. LocationMatch:
  224. '^[.\\/]+([Ww][Ee][Bb][Mm][Aa][Ii][Ll])[.\\/]':
  225. Require: false
  226. Formula_Append: |
  227. RequestHeader set Host mail.example.com
  228. '^[.\\/]+([Ss][Vv][Cc])[.\\/]':
  229. Require: false
  230. Formula_Append: |
  231. Require ip 123.123.13.6 84.24.25.74
  232. Proxy_control:
  233. '*':
  234. AllowAll: false
  235. AllowCountry:
  236. - DE
  237. AllowIP:
  238. - 12.5.25.32
  239. - 12.5.25.33
  240. Alias:
  241. /docs: /usr/share/docs
  242. Formula_Append: |
  243. Additional config as a
  244. multi-line string here
  245. # ``apache.debian_full`` formula additional configuration:
  246. register-site:
  247. # any name as an array index, and you can duplicate this section
  248. UNIQUE_VALUE_HERE:
  249. name: 'my name'
  250. path: 'salt://path/to/sites-available/conf/file'
  251. state: 'enabled'
  252. # Optional - use managed file as Jinja Template
  253. # template: true
  254. # defaults:
  255. # custom_var: "default value"
  256. modules:
  257. enabled: # List modules to enable
  258. - ldap
  259. - ssl
  260. disabled: # List modules to disable
  261. - rewrite
  262. flags:
  263. enabled: # List server flags to enable
  264. - SSL
  265. disabled: # List server flags to disable
  266. - status
  267. # KeepAlive: Whether or not to allow persistent connections (more than
  268. # one request per connection). Set to "Off" to deactivate.
  269. keepalive: 'On'
  270. security:
  271. # can be Full | OS | Minimal | Minor | Major | Prod
  272. # where Full conveys the most information, and Prod the least.
  273. ServerTokens: Prod
  274. # [debian only] configure mod_ssl
  275. ssl:
  276. SSLCipherSuite: 'HIGH:!aNULL'
  277. SSLHonorCipherOrder: 'Off'
  278. SSLProtocol: 'all -SSLv3'
  279. SSLUseStapling: 'Off'
  280. SSLStaplingResponderTimeout: '5'
  281. SSLStaplingReturnResponderErrors: 'Off'
  282. SSLStaplingCache: 'shmcb:/var/run/ocsp(128000)'
  283. # ``apache.mod_remoteip`` formula additional configuration:
  284. mod_remoteip:
  285. RemoteIPHeader: X-Forwarded-For
  286. RemoteIPTrustedProxy:
  287. - 10.0.8.0/24
  288. - 127.0.0.1
  289. # ``apache.mod_security`` formula additional configuration:
  290. mod_security:
  291. crs_install: true
  292. # If not set, default distro's configuration is installed as is
  293. manage_config: true
  294. sec_rule_engine: 'On'
  295. sec_request_body_access: 'On'
  296. sec_request_body_limit: '14000000'
  297. sec_request_body_no_files_limit: '114002'
  298. sec_request_body_in_memory_limit: '114002'
  299. sec_request_body_limit_action: 'Reject'
  300. sec_pcre_match_limit: '15000'
  301. sec_pcre_match_limit_recursion: '15000'
  302. sec_debug_log_level: '3'
  303. rules:
  304. enabled: ~
  305. modsecurity_crs_10_setup.conf:
  306. rule_set: ''
  307. enabled: true
  308. modsecurity_crs_20_protocol_violations.conf:
  309. rule_set: 'base_rules'
  310. enabled: false
  311. custom_rule_files:
  312. # any name as an array index, and you can duplicate this section
  313. UNIQUE_VALUE_HERE:
  314. file: 'my name'
  315. path: 'salt://path/to/modsecurity/custom/file'
  316. enabled: true
  317. mod_ssl:
  318. # set this to true if you want to override your distributions default TLS
  319. # configuration
  320. manage_tls_defaults: false
  321. # This stuff is deliberately not configured via map.jinja resp.
  322. # apache:lookup. We're unable to know sane defaults for each release of
  323. # every distribution.
  324. # See https://github.com/saltstack-formulas/openssh-formula/issues/102 for
  325. # a related discussion Have a look at bettercrypto.org for up-to-date
  326. # settings.
  327. # These are default values:
  328. # yamllint disable-line rule:line-length
  329. 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
  330. # Mitigate the CRIME attack
  331. SSLCompression: 'Off'
  332. SSLProtocol: all -SSLv2 -SSLv3 -TLSv1
  333. SSLHonorCipherOrder: 'On'
  334. SSLOptions: "+StrictRequire"