Skip to content

Commit 1481f82

Browse files
authored
Merge pull request #28 from CheckPointSW/advanced-proxy-settings
add advanced proxy settings - additional instructions blocks, custom headers, redirect to https and access log
2 parents c0537bb + 3f16e03 commit 1481f82

File tree

26 files changed

+1816
-273
lines changed

26 files changed

+1816
-273
lines changed

docs/resources/inext_log_trigger.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ provider "inext" {
3030
3131
resource "inext_log_trigger" "mytrigger" {
3232
name = "mytrigger"
33-
acesss_control_allow_events = false
34-
acesss_control_drop_events = true
33+
access_control_allow_events = false
34+
access_control_drop_events = true
3535
threat_prevention_detect_events = true
3636
threat_prevention_prevent_events = true
3737
web_body = false
@@ -46,13 +46,13 @@ resource "inext_log_trigger" "mytrigger" {
4646
log_to_agent = false
4747
log_to_cef = false
4848
cef_ip_address = "10.0.0.1"
49-
cef_port_num = 2000
49+
cef_port = 2000
5050
cef_protocol = "TCP" # enum of ["TCP", "UDP"]
5151
log_to_cloud = true
5252
log_to_syslog = true
5353
syslog_ip_address = "10.10.10.10"
5454
syslog_protocol = "TCP" # enum of ["TCP", "UDP"]
55-
syslog_port_num = 5004
55+
syslog_port = 5004
5656
compliance_violations = true
5757
compliance_warnings = true
5858
verbosity = "Standard" # enum of ["Minimal", "Standard", "Extended"]

docs/resources/inext_web_api_asset.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,19 @@ resource "inext_web_api_asset" "my-webapi-asset" {
6363
type = "client"
6464
enable = true
6565
}
66+
additional_instructions_blocks {
67+
filename = "location.json"
68+
filename_type = ".json"
69+
data = "location data"
70+
type = "location_instructions"
71+
enable = true
72+
}
73+
redirect_to_https = "true"
74+
access_log = "true"
75+
custom_headers {
76+
name = "header1"
77+
value = "value1"
78+
}
6679
}
6780
```
6881

@@ -76,21 +89,27 @@ resource "inext_web_api_asset" "my-webapi-asset" {
7689

7790
### Optional
7891

92+
- `access_log` (Boolean) Advanced Proxy Setting - Activate access log on gateway.
93+
- `additional_instructions_blocks` (Block Set) The additional instructions blocks settings - location or server blocks (see [below for nested schema](#nestedblock--additional_instructions_blocks))
7994
- `behaviors` (Set of String) behaviors used by the asset
95+
- `custom_headers` (Block Set) Advanced Proxy Settings - The custom headers settings (see [below for nested schema](#nestedblock--custom_headers))
8096
- `mtls` (Block Set) The MTLS settings (see [below for nested schema](#nestedblock--mtls))
8197
- `practice` (Block Set) The practices used by the asset (see [below for nested schema](#nestedblock--practice))
8298
- `profiles` (Set of String) Profiles linked to the asset
8399
- `proxy_setting` (Block Set) Settings for the proxy (see [below for nested schema](#nestedblock--proxy_setting))
100+
- `redirect_to_https` (Boolean) Advanced Proxy Setting - Redirect incoming HTTP requests to the same URL using HTTPS. (The configured application URLs for this asset must include both the HTTP and the HTTPS version of each URL)
84101
- `source_identifier` (Block Set) Defines how the source identifier values of the asset are retrieved (see [below for nested schema](#nestedblock--source_identifier))
85102
- `state` (String)
86103
- `tags` (Block Set) The tags used by the asset (see [below for nested schema](#nestedblock--tags))
87104
- `upstream_url` (String) The URL of the application's backend server to which the reverse proxy redirects the relevant traffic sent to the exposed URL
88105

89106
### Read-Only
90107

108+
- `access_log_id` (String)
91109
- `asset_type` (String)
92110
- `category` (String)
93111
- `class` (String)
112+
- `custom_headers_id` (String)
94113
- `family` (String)
95114
- `group` (String)
96115
- `id` (String, Sensitive) The ID of this resource.
@@ -100,9 +119,44 @@ resource "inext_web_api_asset" "my-webapi-asset" {
100119
- `main_attributes` (String)
101120
- `order` (String)
102121
- `read_only` (Boolean)
122+
- `redirect_to_https_id` (String)
103123
- `sources` (String)
104124
- `urls_ids` (Set of String)
105125

126+
<a id="nestedblock--additional_instructions_blocks"></a>
127+
### Nested Schema for `additional_instructions_blocks`
128+
129+
Required:
130+
131+
- `type` (String) The type of the additional instructions block - location_instructions or server_instructions
132+
133+
Optional:
134+
135+
- `data` (String, Sensitive) The instructions block data
136+
- `enable` (Boolean) Whether the instructions block is enabled
137+
- `filename` (String) The name of the instructions block file
138+
- `filename_type` (String) The type of the instructions block file - .json, .yml
139+
140+
Read-Only:
141+
142+
- `data_id` (String)
143+
- `enable_id` (String)
144+
- `filename_id` (String)
145+
146+
147+
<a id="nestedblock--custom_headers"></a>
148+
### Nested Schema for `custom_headers`
149+
150+
Required:
151+
152+
- `name` (String)
153+
- `value` (String)
154+
155+
Read-Only:
156+
157+
- `header_id` (String)
158+
159+
106160
<a id="nestedblock--mtls"></a>
107161
### Nested Schema for `mtls`
108162

docs/resources/inext_web_api_practice.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ resource "inext_web_api_practice" "my-webapi-practice" {
6060
allow_file_size_limit = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
6161
file_size_limit = 10
6262
file_size_limit_unit = "MB" # enum of ["Bytes","KB", "MB", "GB"]
63-
file_without_name = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
63+
files_without_name = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
6464
required_archive_extraction = true
6565
archive_file_size_limit = 100
6666
archive_file_size_limit_unit = "MB" # enum of ["Bytes","KB", "MB", "GB"]

docs/resources/inext_web_app_asset.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,19 @@ resource "inext_web_app_asset" "my-webapp-asset" {
6363
type = "client"
6464
enable = true
6565
}
66+
additional_instructions_blocks {
67+
filename = "location.json"
68+
filename_type = ".json"
69+
data = "location data"
70+
type = "location_instructions"
71+
enable = true
72+
}
73+
redirect_to_https = "true"
74+
access_log = "true"
75+
custom_headers {
76+
name = "header1"
77+
value = "value1"
78+
}
6679
}
6780
```
6881

@@ -76,21 +89,27 @@ resource "inext_web_app_asset" "my-webapp-asset" {
7689

7790
### Optional
7891

92+
- `access_log` (Boolean) Advanced Proxy Setting - Activate access log on gateway.
93+
- `additional_instructions_blocks` (Block Set) The additional instructions blocks settings - location or server blocks (see [below for nested schema](#nestedblock--additional_instructions_blocks))
7994
- `behaviors` (Set of String) behaviors used by the asset
95+
- `custom_headers` (Block Set) Advanced Proxy Settings - The custom headers settings (see [below for nested schema](#nestedblock--custom_headers))
8096
- `mtls` (Block Set) The mutual TLS settings (see [below for nested schema](#nestedblock--mtls))
8197
- `practice` (Block Set) The practices used by the asset (see [below for nested schema](#nestedblock--practice))
8298
- `profiles` (Set of String) Profiles linked to the asset
8399
- `proxy_setting` (Block Set) Settings for the proxy (see [below for nested schema](#nestedblock--proxy_setting))
100+
- `redirect_to_https` (Boolean) Advanced Proxy Setting - Redirect incoming HTTP requests to the same URL using HTTPS. (The configured application URLs for this asset must include both the HTTP and the HTTPS version of each URL)
84101
- `source_identifier` (Block Set) Defines how the source identifier values of the asset are retrieved (see [below for nested schema](#nestedblock--source_identifier))
85102
- `state` (String)
86103
- `tags` (Block Set) The tags used by the asset (see [below for nested schema](#nestedblock--tags))
87104
- `upstream_url` (String) The URL of the application's backend server to which the reverse proxy redirects the relevant traffic sent to the exposed URL
88105

89106
### Read-Only
90107

108+
- `access_log_id` (String)
91109
- `asset_type` (String)
92110
- `category` (String)
93111
- `class` (String)
112+
- `custom_headers_id` (String)
94113
- `family` (String)
95114
- `group` (String)
96115
- `id` (String, Sensitive) The ID of this resource.
@@ -100,9 +119,44 @@ resource "inext_web_app_asset" "my-webapp-asset" {
100119
- `main_attributes` (String)
101120
- `order` (String)
102121
- `read_only` (Boolean)
122+
- `redirect_to_https_id` (String)
103123
- `sources` (String)
104124
- `urls_ids` (Set of String)
105125

126+
<a id="nestedblock--additional_instructions_blocks"></a>
127+
### Nested Schema for `additional_instructions_blocks`
128+
129+
Required:
130+
131+
- `type` (String) The type of the additional instructions block - location_instructions or server_instructions
132+
133+
Optional:
134+
135+
- `data` (String, Sensitive) The instructions block data
136+
- `enable` (Boolean) Whether the instructions block is enabled
137+
- `filename` (String) The name of the instructions block file
138+
- `filename_type` (String) The type of the instructions block file - .json, .yml
139+
140+
Read-Only:
141+
142+
- `data_id` (String)
143+
- `enable_id` (String)
144+
- `filename_id` (String)
145+
146+
147+
<a id="nestedblock--custom_headers"></a>
148+
### Nested Schema for `custom_headers`
149+
150+
Required:
151+
152+
- `name` (String)
153+
- `value` (String)
154+
155+
Read-Only:
156+
157+
- `header_id` (String)
158+
159+
106160
<a id="nestedblock--mtls"></a>
107161
### Nested Schema for `mtls`
108162

docs/resources/inext_web_app_practice.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ resource "inext_web_app_practice" "my-webapp-practice" {
6464
allow_file_size_limit = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
6565
file_size_limit = 10
6666
file_size_limit_unit = "MB" # enum of ["Bytes","KB", "MB", "GB"]
67-
file_without_name = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
67+
files_without_name = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
6868
required_archive_extraction = true
6969
archive_file_size_limit = 100
7070
archive_file_size_limit_unit = "MB" # enum of ["Bytes","KB", "MB", "GB"]

examples/provider/web-api-practice.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ resource "inext_web_api_practice" "test" {
2929
allow_file_size_limit = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
3030
file_size_limit = 10
3131
file_size_limit_unit = "MB" # enum of ["Bytes","KB", "MB", "GB"]
32-
file_without_name = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
32+
files_without_name = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
3333
required_archive_extraction = true
3434
archive_file_size_limit = 100
3535
archive_file_size_limit_unit = "MB" # enum of ["Bytes","KB", "MB", "GB"]

examples/provider/web-app-practice.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ resource "inext_web_app_practice" "test" {
3333
allow_file_size_limit = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
3434
file_size_limit = 10
3535
file_size_limit_unit = "MB" # enum of ["Bytes","KB", "MB", "GB"]
36-
file_without_name = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
36+
files_without_name = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
3737
required_archive_extraction = true
3838
archive_file_size_limit = 100
3939
archive_file_size_limit_unit = "MB" # enum of ["Bytes","KB", "MB", "GB"]

examples/resources/inext_log_trigger/resource.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ provider "inext" {
1515

1616
resource "inext_log_trigger" "mytrigger" {
1717
name = "mytrigger"
18-
acesss_control_allow_events = false
19-
acesss_control_drop_events = true
18+
access_control_allow_events = false
19+
access_control_drop_events = true
2020
threat_prevention_detect_events = true
2121
threat_prevention_prevent_events = true
2222
web_body = false
@@ -31,13 +31,13 @@ resource "inext_log_trigger" "mytrigger" {
3131
log_to_agent = false
3232
log_to_cef = false
3333
cef_ip_address = "10.0.0.1"
34-
cef_port_num = 2000
34+
cef_port = 2000
3535
cef_protocol = "TCP" # enum of ["TCP", "UDP"]
3636
log_to_cloud = true
3737
log_to_syslog = true
3838
syslog_ip_address = "10.10.10.10"
3939
syslog_protocol = "TCP" # enum of ["TCP", "UDP"]
40-
syslog_port_num = 5004
40+
syslog_port = 5004
4141
compliance_violations = true
4242
compliance_warnings = true
4343
verbosity = "Standard" # enum of ["Minimal", "Standard", "Extended"]

examples/resources/inext_web_api_asset/resource.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,17 @@ resource "inext_web_api_asset" "my-webapi-asset" {
4848
type = "client"
4949
enable = true
5050
}
51+
additional_instructions_blocks {
52+
filename = "location.json"
53+
filename_type = ".json"
54+
data = "location data"
55+
type = "location_instructions"
56+
enable = true
57+
}
58+
redirect_to_https = "true"
59+
access_log = "true"
60+
custom_headers {
61+
name = "header1"
62+
value = "value1"
63+
}
5164
}

examples/resources/inext_web_api_practice/resource.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ resource "inext_web_api_practice" "my-webapi-practice" {
4545
allow_file_size_limit = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
4646
file_size_limit = 10
4747
file_size_limit_unit = "MB" # enum of ["Bytes","KB", "MB", "GB"]
48-
file_without_name = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
48+
files_without_name = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
4949
required_archive_extraction = true
5050
archive_file_size_limit = 100
5151
archive_file_size_limit_unit = "MB" # enum of ["Bytes","KB", "MB", "GB"]

examples/resources/inext_web_app_asset/resource.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,17 @@ resource "inext_web_app_asset" "my-webapp-asset" {
4848
type = "client"
4949
enable = true
5050
}
51+
additional_instructions_blocks {
52+
filename = "location.json"
53+
filename_type = ".json"
54+
data = "location data"
55+
type = "location_instructions"
56+
enable = true
57+
}
58+
redirect_to_https = "true"
59+
access_log = "true"
60+
custom_headers {
61+
name = "header1"
62+
value = "value1"
63+
}
5164
}

examples/resources/inext_web_app_practice/resource.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ resource "inext_web_app_practice" "my-webapp-practice" {
4949
allow_file_size_limit = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
5050
file_size_limit = 10
5151
file_size_limit_unit = "MB" # enum of ["Bytes","KB", "MB", "GB"]
52-
file_without_name = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
52+
files_without_name = "AccordingToPractice" # enum of ["Detect", "Prevent", "Inactive", "AccordingToPractice"]
5353
required_archive_extraction = true
5454
archive_file_size_limit = 100
5555
archive_file_size_limit_unit = "MB" # enum of ["Bytes","KB", "MB", "GB"]

internal/models/web-api-asset/input.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package models
22

3-
import "strings"
3+
import (
4+
"fmt"
5+
"strings"
6+
)
47

58
// SourceIdentifierInput represents the api input for creating a source identifier field in the web API asset
69
type SourceIdentifierInput struct {
@@ -111,3 +114,22 @@ func (mtlsInputs MTLSSchemas) ToIndicatorMap() map[string]MTLSSchema {
111114

112115
return mTLSs
113116
}
117+
118+
func (blockInputs BlockSchemas) ToIndicatorMap() map[string]BlockSchema {
119+
blocks := make(map[string]BlockSchema)
120+
for _, block := range blockInputs {
121+
blocks[block.Type] = block
122+
}
123+
124+
return blocks
125+
}
126+
127+
func (customHeadersInputs CustomHeadersSchemas) ToIndicatorMap() map[string]CustomHeaderSchema {
128+
customHeaders := make(map[string]CustomHeaderSchema)
129+
for _, customHeader := range customHeaders {
130+
nameAndValue := fmt.Sprintf("%s:%s", customHeader.Name, customHeader.Value)
131+
customHeaders[nameAndValue] = customHeader
132+
}
133+
134+
return customHeaders
135+
}

0 commit comments

Comments
 (0)