Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add server/location_acl argument #1491

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions manifests/resource/location.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
# Locations to allow connections from.
# @param location_deny
# Locations to deny connections from.
# @param location_acl
# Specifies location ACL name in nginx::conf_dir/conf.d/${location_acl}.acl.
# @param www_root
# Specifies the location on disk for files to be read from. Cannot be set in
# conjunction with $proxy
Expand Down Expand Up @@ -269,6 +271,7 @@
Optional[Enum['any', 'all']] $location_satisfy = undef,
Optional[Array] $location_allow = undef,
Optional[Array] $location_deny = undef,
Optional[String] $location_acl = undef,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose the name can't be an empty string

Suggested change
Optional[String] $location_acl = undef,
Optional[String[1]] $location_acl = undef,

Also maybe the user must be able to overwrite the default path nginx::conf_dir/conf.d ?

Optional[Boolean] $stub_status = undef,
Optional[Variant[String, Array]] $raw_prepend = undef,
Optional[Variant[String, Array]] $raw_append = undef,
Expand Down
7 changes: 7 additions & 0 deletions manifests/resource/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@
# @param location_satisfy
# Allows access if all (all) or at least one (any) of the auth modules allow
# access.
# @param server_acl
# Specifies server ACL name in nginx::conf_dir/conf.d/${server_acl}.acl.
# @param location_allow
# Locations to allow connections from.
# @param location_deny
# Locations to deny connections from.
# @param location_acl
# Specifies location ACL name in nginx::conf_dir/conf.d/${location_acl}.acl.
# @param ipv6_enable
# value to enable/disable IPv6 support (false|true). Module will check to see
# if IPv6 support exists on your system before enabling.
Expand Down Expand Up @@ -290,8 +294,10 @@
Variant[Array[Stdlib::Absolutepath], Stdlib::Absolutepath] $listen_unix_socket = '/var/run/nginx.sock',
Optional[String] $listen_unix_socket_options = undef,
Optional[Enum['any', 'all']] $location_satisfy = undef,
Optional[String] $server_acl = undef,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here:

Suggested change
Optional[String] $server_acl = undef,
Optional[String[1]] $server_acl = undef,

Array $location_allow = [],
Array $location_deny = [],
Optional[String] $location_acl = undef,
Boolean $ipv6_enable = false,
Variant[Array, String] $ipv6_listen_ip = '::',
Stdlib::Port $ipv6_listen_port = $listen_port,
Expand Down Expand Up @@ -507,6 +513,7 @@
ssl_only => $ssl_only,
location => '/',
location_satisfy => $location_satisfy,
location_acl => $location_acl,
location_allow => $location_allow,
location_deny => $location_deny,
proxy => $proxy,
Expand Down
3 changes: 3 additions & 0 deletions templates/server/location_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
deny <%= deny_rule %>;
<%- end -%>
<% end -%>
<% if @location_acl -%>
include <%= scope['::nginx::config::conf_dir'] %>/conf.d/<%= @location_acl -%>.acl;
<% end -%>
<% if @absolute_redirect -%>
absolute_redirect <%= @absolute_redirect %>;
<% end -%>
Expand Down
3 changes: 3 additions & 0 deletions templates/server/server_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ server {
<% Array(@raw_prepend).each do |line| -%>
<%= line %>
<% end %>
<% if @server_acl -%>
include <%= scope['::nginx::config::conf_dir'] %>/conf.d/<%= @server_acl -%>.acl;
<% end -%>
<% if @root -%>
root <%= @root %>;
<% end -%>
Expand Down
3 changes: 3 additions & 0 deletions templates/server/server_ssl_header.erb
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ server {
<% Array(@raw_prepend).each do |line| -%>
<%= line %>
<% end -%>
<% if @server_acl -%>
include <%= scope['::nginx::config::conf_dir'] %>/conf.d/<%= @server_acl -%>.acl;
<% end -%>
<% if @root -%>
root <%= @root %>;
<% end -%>
Expand Down