diff --git a/resources/providers/config.rb b/resources/providers/config.rb index 0c546e4..e4128ec 100644 --- a/resources/providers/config.rb +++ b/resources/providers/config.rb @@ -754,6 +754,8 @@ webui_hosts = new_resource.hosts routes = local_routes() cdomain = new_resource.cdomain + nginx_segment_max_timeout = new_resource.nginx_segment_max_timeout + nginx_segment_file_size = new_resource.nginx_segment_file_size service 'nginx' do service_name 'nginx' @@ -767,7 +769,7 @@ group 'nginx' mode '0644' cookbook 'webui' - variables(webui_hosts: webui_hosts, webui_port: webui_port, cdomain: cdomain) + variables(webui_hosts: webui_hosts, webui_port: webui_port, cdomain: cdomain, nginx_segment_file_size: nginx_segment_file_size, nginx_segment_max_timeout: nginx_segment_max_timeout) notifies :restart, 'service[nginx]' end diff --git a/resources/resources/config.rb b/resources/resources/config.rb index cf113c8..804aacd 100644 --- a/resources/resources/config.rb +++ b/resources/resources/config.rb @@ -19,6 +19,8 @@ attribute :auth_mode, kind_of: String, default: 'database' attribute :webui_version, kind_of: String attribute :redborder_version, kind_of: String +attribute :nginx_segment_file_size, kind_of: String, default: '512' +attribute :nginx_segment_max_timeout, kind_of: String, default: '90' attribute :user_sensor_map, kind_of: String, default: '' attribute :s3_secrets, kind_of: Hash, default: {} attribute :s3_malware_secrets, kind_of: Hash, default: {} diff --git a/resources/templates/default/webui.conf.erb b/resources/templates/default/webui.conf.erb index b197733..32af7ae 100644 --- a/resources/templates/default/webui.conf.erb +++ b/resources/templates/default/webui.conf.erb @@ -61,6 +61,54 @@ server { proxy_cache_valid 404 1m; } + location /monitor/export_segments { + proxy_redirect http://webui /; + proxy_pass http://webui; + + client_max_body_size <%= @nginx_segment_file_size %>m; + proxy_connect_timeout <%= @nginx_segment_max_timeout %>; + proxy_send_timeout <%= @nginx_segment_max_timeout %>; + proxy_read_timeout <%= @nginx_segment_max_timeout %>; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_pass_request_headers on; + } + + location /monitor/import_segments { + proxy_redirect http://webui /; + proxy_pass http://webui; + + client_max_body_size <%= @nginx_segment_file_size %>m; + proxy_connect_timeout <%= @nginx_segment_max_timeout %>; + proxy_send_timeout <%= @nginx_segment_max_timeout %>; + proxy_read_timeout <%= @nginx_segment_max_timeout %>; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_pass_request_headers on; + } + + location /monitor/bulk_delete_segments { + proxy_redirect http://webui /; + proxy_pass http://webui; + + client_max_body_size <%= @nginx_segment_file_size %>m; + proxy_connect_timeout <%= @nginx_segment_max_timeout %>; + proxy_send_timeout <%= @nginx_segment_max_timeout %>; + proxy_read_timeout <%= @nginx_segment_max_timeout %>; + + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_pass_request_headers on; + } + location / { proxy_redirect http://webui /; proxy_pass http://webui;