This repository was archived by the owner on Oct 21, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #179 from Alfresco/develop
Add hsts header correctly
- Loading branch information
Showing
3 changed files
with
71 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,107 @@ | ||
# This file was generated by chef-alfresco | ||
|
||
# General Configurations: global, timeouts | ||
<% node['haproxy']['general_config'].each do |line| -%> | ||
<%= line %> | ||
global | ||
<% if node['haproxy']['general_config'] -%> | ||
<% node['haproxy']['general_config'].each do |line| -%> | ||
<%= line %> | ||
<% end -%> | ||
<% end -%> | ||
# Log format | ||
<%= node['haproxy']['logformat'] %> | ||
|
||
# Frontends | ||
defaults | ||
<% if node['haproxy']['default_config'] -%> | ||
<% node['haproxy']['default_config'].each do |line| -%> | ||
<%= line %> | ||
<% end -%> | ||
<% end -%> | ||
|
||
<% if node['haproxy']['frontends'] -%> | ||
# Frontends | ||
<% node['haproxy']['frontends'].each do |frontendName,frontend| -%> | ||
# START frontend <%= frontendName %> | ||
frontend <%= frontendName %> | ||
<% if frontend['entries'] -%> | ||
<% frontend['entries'].each do |entry| -%> | ||
<%= entry %> | ||
<%= entry %> | ||
<% end -%> | ||
<% end -%> | ||
<% if frontend['headers'] -%> | ||
<% frontend['headers'].each do |header| -%> | ||
<%= header %> | ||
<%= header %> | ||
<% end -%> | ||
<% end -%> | ||
# Backend ACLs | ||
<% if frontend['acls'] -%> | ||
|
||
# Backend ACLs | ||
<% frontend['acls'].each do |backendName,acls| -%> | ||
<% if acls -%> | ||
<% acls.each do |acl| -%> | ||
acl is_<%= backendName %> <%= acl %> | ||
acl is_<%= backendName %> <%= acl %> | ||
<% end -%> | ||
<% end -%> | ||
<% end -%> | ||
<% end -%> | ||
# Free formed ACLs | ||
<% if frontend['acl_lines'] -%> | ||
|
||
# Free formed ACLs | ||
<% frontend['acl_lines'].each do |acl| -%> | ||
acl <%= acl %> | ||
acl <%= acl %> | ||
<% end -%> | ||
<% end -%> | ||
# Other Configurations | ||
<% if frontend['other_config'] -%> | ||
|
||
# Other Configurations | ||
<% frontend['other_config'].each do |other_config| -%> | ||
<%= other_config %> | ||
<%= other_config %> | ||
<% end -%> | ||
<% end -%> | ||
# Redirects | ||
<% if frontend['redirects'] -%> | ||
|
||
# Redirects | ||
<% frontend['redirects'].each do |redirect| -%> | ||
<%= redirect %> | ||
<%= redirect %> | ||
<% end -%> | ||
<% end -%> | ||
# Use backends | ||
<% if frontend['acls'] -%> | ||
|
||
# Use backends | ||
<% frontend['acls'].each do |backendName,acls| -%> | ||
use_backend <%= backendName %> if is_<%= backendName %> | ||
use_backend <%= backendName %> if is_<%= backendName %> | ||
<% end -%> | ||
<% end -%> | ||
# Default Backend | ||
default_backend <%= node['haproxy']['default_backend'] %> | ||
# END frontend <%= frontendName %> | ||
|
||
# Default Backend | ||
default_backend <%= node['haproxy']['default_backend'] %> | ||
|
||
<% end -%> | ||
<% end -%> | ||
|
||
# Backends | ||
|
||
<% if @haproxy_backends -%> | ||
# Backends | ||
<% @haproxy_backends.each do |roleName,role| -%> | ||
# START <%= roleName %> backend | ||
backend <%= roleName %> | ||
<% if role['entries'] -%> | ||
<% role['entries'].each do |entry| -%> | ||
<%= entry %> | ||
<%= entry %> | ||
<% end -%> | ||
<% end -%> | ||
<% if role['balanced'] -%> | ||
balance leastconn | ||
cookie JSESSIONID prefix | ||
balance leastconn | ||
cookie JSESSIONID prefix | ||
<% end -%> | ||
<% if role['secure_entries'] -%> | ||
<% role['secure_entries'].each do |secure_entry| -%> | ||
<%= secure_entry %> | ||
<%= secure_entry %> | ||
<% end -%> | ||
<% end -%> | ||
|
||
<% if role['ordered_az'] -%> | ||
<% role['ordered_az'].each do |az| -%> | ||
<% az['id'].each do |instanceName,instance| -%> | ||
# Instance <%= instanceName %>, az <%= instance['az'] %> | ||
server <%= instanceName %> <%= instance['ip'] %>:<%= role['port'] %> <%= instance['options'] %> | ||
|
||
# Instance <%= instanceName %>, az <%= instance['az'] %> | ||
server <%= instanceName %> <%= instance['ip'] %>:<%= role['port'] %> <%= instance['options'] %> | ||
<% end -%> | ||
<% end -%> | ||
<% end -%> | ||
# END <%= roleName %> backend | ||
|
||
<% end -%> | ||
<% end -%> | ||
|
||
<% if node['haproxy']['enable_ssl_header'] -%> | ||
# Changes to header responses | ||
<%= node['haproxy']['ssl_header'] %> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
control "alfresco-04" do | ||
impact 0.5 | ||
title "HA Proxy Configuration Check" | ||
|
||
describe file('/etc/haproxy/haproxy.cfg') do | ||
it { should exist } | ||
it { should be_file } | ||
its('content') { should match 'http-response set-header Strict-Transport-Security' } | ||
end | ||
end |