Skip to content

Commit 561f612

Browse files
Merge pull request #923 from pfrest/next_patch
v2.8.4 Features & Fixes
2 parents c185795 + 68cbfdb commit 561f612

2 files changed

Lines changed: 65 additions & 37 deletions

File tree

‎pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/FirewallRule.inc‎

Lines changed: 43 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class FirewallRule extends Model {
3535
public StringField $descr;
3636
public BooleanField $disabled;
3737
public BooleanField $log;
38+
public StringField $dscp;
3839
public StringField $tag;
3940
public StringField $statetype;
4041
public BooleanField $tcp_flags_any;
@@ -138,8 +139,8 @@ class FirewallRule extends Model {
138139
'unreach',
139140
],
140141
many: true,
141-
conditions: ['protocol' => 'icmp'],
142142
verbose_name: 'ICMP Types',
143+
conditions: ['protocol' => 'icmp'],
143144
help_text: 'Th ICMP subtypes this rule applies to. This field is only applicable when ' .
144145
'`ipprotocol` is `inet` and `protocol` is `icmp`.',
145146
);
@@ -153,10 +154,10 @@ class FirewallRule extends Model {
153154
allow_alias: true,
154155
allow_range: true,
155156
allow_null: true,
157+
verbose_name: 'Source Port',
156158
internal_name: 'port',
157159
internal_namespace: 'source',
158160
conditions: ['protocol' => ['tcp', 'udp', 'tcp/udp']],
159-
verbose_name: 'Source Port',
160161
help_text: 'The source port this rule applies to. Set to `null` to allow any source port.',
161162
);
162163
$this->destination = new FilterAddressField(
@@ -169,10 +170,10 @@ class FirewallRule extends Model {
169170
allow_alias: true,
170171
allow_range: true,
171172
allow_null: true,
173+
verbose_name: 'Destination Port',
172174
internal_name: 'port',
173175
internal_namespace: 'destination',
174176
conditions: ['protocol' => ['tcp', 'udp', 'tcp/udp']],
175-
verbose_name: 'Destination Port',
176177
help_text: 'The destination port this rule applies to. Set to `null` to allow any destination port.',
177178
);
178179
$this->descr = new StringField(
@@ -192,9 +193,36 @@ class FirewallRule extends Model {
192193
help_text: 'Enable or disable logging of traffic that matches this rule.',
193194
);
194195
$this->dscp = new StringField(
195-
default: '',
196-
choices: ['af11', 'af12', 'af13', 'af21', 'af22', 'af23', 'af31', 'af32', 'af33', 'af41', 'af42', 'af43', 'VA', 'EF', 'cs1', 'cs2', 'cs3', 'cs4', 'cs5', 'cs6', 'cs7', '0x01', '0x02', '0x04'],
196+
default: null,
197+
choices: [
198+
'',
199+
'af11',
200+
'af12',
201+
'af13',
202+
'af21',
203+
'af22',
204+
'af23',
205+
'af31',
206+
'af32',
207+
'af33',
208+
'af41',
209+
'af42',
210+
'af43',
211+
'VA',
212+
'EF',
213+
'cs1',
214+
'cs2',
215+
'cs3',
216+
'cs4',
217+
'cs5',
218+
'cs6',
219+
'cs7',
220+
'0x01',
221+
'0x02',
222+
'0x04',
223+
],
197224
allow_empty: true,
225+
allow_null: true,
198226
verbose_name: 'DSCP',
199227
help_text: 'The DSCP value this firewall rule should match.',
200228
);
@@ -212,28 +240,28 @@ class FirewallRule extends Model {
212240
);
213241
$this->tcp_flags_any = new BooleanField(
214242
default: false,
215-
internal_name: 'tcpflags_any',
216243
verbose_name: 'TCP Flags Any',
244+
internal_name: 'tcpflags_any',
217245
help_text: 'Allow any TCP flags.',
218246
);
219247
$this->tcp_flags_out_of = new StringField(
220248
default: null,
221249
choices: ['fin', 'syn', 'rst', 'psh', 'ack', 'urg', 'ece', 'cwr'],
222250
allow_null: true,
223251
many: true,
252+
verbose_name: 'TCP Flags Out Of',
224253
internal_name: 'tcpflags2',
225254
conditions: ['tcp_flags_any' => false],
226-
verbose_name: 'TCP Flags Out Of',
227255
help_text: 'The TCP flags that can be set for this rule to match.',
228256
);
229257
$this->tcp_flags_set = new StringField(
230258
default: null,
231259
choices: ['fin', 'syn', 'rst', 'psh', 'ack', 'urg', 'ece', 'cwr'],
232260
allow_null: true,
233261
many: true,
262+
verbose_name: 'TCP Flags Set',
234263
internal_name: 'tcpflags1',
235264
conditions: ['tcp_flags_any' => false],
236-
verbose_name: 'TCP Flags Set',
237265
help_text: 'The TCP flags that must be set for this rule to match.',
238266
);
239267
$this->gateway = new ForeignModelField(
@@ -292,16 +320,16 @@ class FirewallRule extends Model {
292320
$this->quick = new BooleanField(
293321
default: false,
294322
indicates_true: 'yes',
295-
conditions: ['floating' => true],
296323
verbose_name: 'Quick',
324+
conditions: ['floating' => true],
297325
help_text: 'Apply this action to traffic that matches this rule immediately. This field only applies ' .
298326
'to floating firewall rules.',
299327
);
300328
$this->direction = new StringField(
301329
default: 'any',
302330
choices: ['any', 'in', 'out'],
303-
conditions: ['floating' => true],
304331
verbose_name: 'Direction',
332+
conditions: ['floating' => true],
305333
help_text: 'The direction of traffic this firewall rule applies to. This field only applies to ' .
306334
'floating firewall rules.',
307335
);
@@ -318,43 +346,43 @@ class FirewallRule extends Model {
318346
allow_null: true,
319347
editable: false,
320348
read_only: true,
321-
internal_name: 'associated-rule-id',
322349
verbose_name: 'Associated Rule ID',
350+
internal_name: 'associated-rule-id',
323351
help_text: 'The internal rule ID for the NAT rule associated with this rule.',
324352
);
325353
$this->created_time = new UnixTimeField(
326354
editable: false,
327355
read_only: true,
328356
auto_add_now: true,
357+
verbose_name: 'Created Time',
329358
internal_name: 'time',
330359
internal_namespace: 'created',
331-
verbose_name: 'Created Time',
332360
help_text: 'The unix timestamp of when this firewall rule was original created.',
333361
);
334362
$this->created_by = new StringField(
335363
default: "{$this->client->username}@{$this->client->ip_address} (API)",
336364
editable: false,
337365
read_only: true,
366+
verbose_name: 'Created By',
338367
internal_name: 'username',
339368
internal_namespace: 'created',
340-
verbose_name: 'Created By',
341369
help_text: 'The username and IP of the user who originally created this firewall rule.',
342370
);
343371
$this->updated_time = new UnixTimeField(
344372
read_only: true,
345373
auto_add_now: true,
346374
auto_update_now: true,
375+
verbose_name: 'Updated Time',
347376
internal_name: 'time',
348377
internal_namespace: 'updated',
349-
verbose_name: 'Updated Time',
350378
help_text: 'The unix timestamp of when this firewall rule was original created.',
351379
);
352380
$this->updated_by = new StringField(
353381
default: "{$this->client->username}@{$this->client->ip_address} (API)",
354382
read_only: true,
383+
verbose_name: 'Updated By',
355384
internal_name: 'username',
356385
internal_namespace: 'updated',
357-
verbose_name: 'Updated By',
358386
help_text: 'The username and IP of the user who last updated this firewall rule.',
359387
);
360388

‎pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/LogSettings.inc‎

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class LogSettings extends Model {
6262
);
6363
$this->reverseorder = new BooleanField(
6464
default: false,
65-
internal_name: 'reverse', # We can't use 'reverse' as the field name because it is a reserved field name
66-
verbose_name: 'Reverse Order',
65+
verbose_name: 'Reverse Order', # We can't use 'reverse' as the field name because it is a reserved field name
66+
internal_name: 'reverse',
6767
help_text: 'Reverse the order of log entries.',
6868
);
6969
$this->nentries = new IntegerField(
@@ -123,7 +123,7 @@ class LogSettings extends Model {
123123
$this->logfilesize = new IntegerField(
124124
default: 512000,
125125
minimum: 100000,
126-
maximum: 2147483648,
126+
maximum: PHP_INT_MAX,
127127
verbose_name: 'Log File Size',
128128
help_text: 'The maximum size of the log file in kilobytes.',
129129
);
@@ -142,126 +142,126 @@ class LogSettings extends Model {
142142
);
143143
$this->enableremotelogging = new BooleanField(
144144
default: false,
145-
internal_name: 'enable',
146145
verbose_name: 'Enable Remote Logging',
146+
internal_name: 'enable',
147147
help_text: 'Enable remote logging.',
148148
);
149149
$this->ipprotocol = new StringField(
150150
default: 'ipv4',
151151
choices: ['ipv4', 'ipv6'],
152-
conditions: ['enableremotelogging' => true],
153152
verbose_name: 'IP Protocol',
153+
conditions: ['enableremotelogging' => true],
154154
help_text: 'The IP protocol to use for remote logging.',
155155
);
156156
$this->sourceip = new InterfaceField(
157157
default: '',
158158
allow_localhost_interface: true,
159159
allow_custom: [''],
160160
allow_empty: true,
161-
conditions: ['enableremotelogging' => true],
162161
verbose_name: 'Source IP',
162+
conditions: ['enableremotelogging' => true],
163163
help_text: 'The interface to use as the source IP address for remote logging.',
164164
);
165165
$this->remoteserver = new StringField(
166166
default: null,
167167
allow_null: true,
168+
verbose_name: 'Remote Server',
168169
conditions: ['enableremotelogging' => true],
169170
validators: [new IPAddressValidator(allow_fqdn: true, allow_port: true)],
170-
verbose_name: 'Remote Server',
171171
help_text: 'The first remote syslog server to send log entries to.',
172172
);
173173
$this->remoteserver2 = new StringField(
174174
default: null,
175175
allow_null: true,
176+
verbose_name: 'Remote Server 2',
176177
conditions: ['enableremotelogging' => true, '!remoteserver' => null],
177178
validators: [new IPAddressValidator(allow_fqdn: true, allow_port: true)],
178-
verbose_name: 'Remote Server 2',
179179
help_text: 'The second remote syslog server to send log entries to.',
180180
);
181181
$this->remoteserver3 = new StringField(
182182
default: null,
183183
allow_null: true,
184+
verbose_name: 'Remote Server 3',
184185
conditions: ['enableremotelogging' => true, '!remoteserver' => null, '!remoteserver2' => null],
185186
validators: [new IPAddressValidator(allow_fqdn: true, allow_port: true)],
186-
verbose_name: 'Remote Server 3',
187187
help_text: 'The third remote syslog server to send log entries to.',
188188
);
189189
$this->logall = new BooleanField(
190190
default: false,
191-
conditions: ['enableremotelogging' => true],
192191
verbose_name: 'Log All',
192+
conditions: ['enableremotelogging' => true],
193193
help_text: 'Log everything to the remote syslog server(s).',
194194
);
195195
$this->filter = new BooleanField(
196196
default: false,
197-
conditions: ['enableremotelogging' => true, '!logall' => true],
198197
verbose_name: 'Filter',
198+
conditions: ['enableremotelogging' => true, '!logall' => true],
199199
help_text: 'Log filter events to the remote syslog server(s).',
200200
);
201201
$this->dhcp = new BooleanField(
202202
default: false,
203-
conditions: ['enableremotelogging' => true, '!logall' => true],
204203
verbose_name: 'DHCP',
204+
conditions: ['enableremotelogging' => true, '!logall' => true],
205205
help_text: 'Log DHCP events to the remote syslog server(s).',
206206
);
207207
$this->auth = new BooleanField(
208208
default: false,
209-
conditions: ['enableremotelogging' => true, '!logall' => true],
210209
verbose_name: 'Auth',
210+
conditions: ['enableremotelogging' => true, '!logall' => true],
211211
help_text: 'Log authentication events to the remote syslog server(s).',
212212
);
213213
$this->portalauth = new BooleanField(
214214
default: false,
215-
conditions: ['enableremotelogging' => true, '!logall' => true],
216215
verbose_name: 'Portal Auth',
216+
conditions: ['enableremotelogging' => true, '!logall' => true],
217217
help_text: 'Log captive portal authentication events to the remote syslog server(s).',
218218
);
219219
$this->vpn = new BooleanField(
220220
default: false,
221-
conditions: ['enableremotelogging' => true, '!logall' => true],
222221
verbose_name: 'VPN',
222+
conditions: ['enableremotelogging' => true, '!logall' => true],
223223
help_text: 'Log VPN events to the remote syslog server(s).',
224224
);
225225
$this->dpinger = new BooleanField(
226226
default: false,
227-
conditions: ['enableremotelogging' => true, '!logall' => true],
228227
verbose_name: 'Dpinger',
228+
conditions: ['enableremotelogging' => true, '!logall' => true],
229229
help_text: 'Log gateway monitoring events to the remote syslog server(s).',
230230
);
231231
$this->hostapd = new BooleanField(
232232
default: false,
233-
conditions: ['enableremotelogging' => true, '!logall' => true],
234233
verbose_name: 'Host APD',
234+
conditions: ['enableremotelogging' => true, '!logall' => true],
235235
help_text: 'Log wireless authentication events to the remote syslog server(s).',
236236
);
237237
$this->system = new BooleanField(
238238
default: false,
239-
conditions: ['enableremotelogging' => true, '!logall' => true],
240239
verbose_name: 'System',
240+
conditions: ['enableremotelogging' => true, '!logall' => true],
241241
help_text: 'Log system events to the remote syslog server(s).',
242242
);
243243
$this->resolver = new BooleanField(
244244
default: false,
245-
conditions: ['enableremotelogging' => true, '!logall' => true],
246245
verbose_name: 'Resolver',
246+
conditions: ['enableremotelogging' => true, '!logall' => true],
247247
help_text: 'Log DNS resolver events to the remote syslog server(s).',
248248
);
249249
$this->ppp = new BooleanField(
250250
default: false,
251-
conditions: ['enableremotelogging' => true, '!logall' => true],
252251
verbose_name: 'PPP',
252+
conditions: ['enableremotelogging' => true, '!logall' => true],
253253
help_text: 'Log PPP events to the remote syslog server(s).',
254254
);
255255
$this->routing = new BooleanField(
256256
default: false,
257-
conditions: ['enableremotelogging' => true, '!logall' => true],
258257
verbose_name: 'Routing',
258+
conditions: ['enableremotelogging' => true, '!logall' => true],
259259
help_text: 'Log routing events to the remote syslog server(s).',
260260
);
261261
$this->ntpd = new BooleanField(
262262
default: false,
263-
conditions: ['enableremotelogging' => true, '!logall' => true],
264263
verbose_name: 'NTPd',
264+
conditions: ['enableremotelogging' => true, '!logall' => true],
265265
help_text: 'Log NTP events to the remote syslog server(s).',
266266
);
267267

0 commit comments

Comments
 (0)