Skip to content

Commit 74e9c96

Browse files
Merge pull request #248 from jaredhendrickson13/v143
v1.4.3 Features & Fixes
2 parents be712a7 + d31167f commit 74e9c96

22 files changed

Lines changed: 3769 additions & 5629 deletions

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,19 @@ are made preventing the need for a reboot. All this results in the fastest, safe
1010

1111
# Requirements
1212

13-
- pfSense CE 2.5.0 and pfSense Plus 22.01 or later on AMD64 systems are supported. (older pfSense versions may be compatible with older versions of pfSense API)
13+
<details>
14+
<summary>Supported pfSense Versions</summary>
15+
16+
- pfSense Plus 22.05 (AMD64)
17+
- pfSense Plus 22.01 (AMD64)
18+
- pfSense CE 2.6.0 (AMD64)
19+
- pfSense CE 2.5.2 (AMD64)
20+
- pfSense CE 2.5.1 (AMD64)
21+
- pfSense CE 2.5.0 (AMD64)
22+
---
23+
24+
</details>
25+
1426
- pfSense API requires a local user account in pfSense. The same permissions required to make configurations in the
1527
webConfigurator are required to make calls to the API endpoints.
1628
- While not an enforced requirement, it is **strongly** recommended that you configure pfSense to use HTTPS instead of
@@ -21,7 +33,7 @@ are made preventing the need for a reboot. All this results in the fastest, safe
2133
To install pfSense API, simply run the following command from the pfSense shell:<br>
2234

2335
```
24-
pkg add https://github.com/jaredhendrickson13/pfsense-api/releases/latest/download/pfSense-2.5-pkg-API.txz && /etc/rc.restart_webgui
36+
pkg add https://github.com/jaredhendrickson13/pfsense-api/releases/latest/download/pfSense-2.6-pkg-API.txz && /etc/rc.restart_webgui
2537
```
2638

2739
<br>
@@ -52,8 +64,9 @@ pfsense-api revert v1.1.7
5264

5365
### Notes:
5466

55-
- To install the pfSense CE 2.6 package, simply change the `2.5` in the install URL to `2.6`.
56-
- To install the pfSense Plus 22.01 package, simply change the `2.5` in the install URL `22.01`.
67+
- While not always necessary, it's recommended to change the installation command to reference the package built for your
68+
version of pfSense. You can check the [releases page](https://github.com/jaredhendrickson13/pfsense-api/releases)
69+
for available versions.
5770
- In order for pfSense to apply some required web server changes, it is required to restart the webConfigurator after
5871
installing the package.
5972
- If you do not have shell access to pfSense, you can still install via the webConfigurator by navigating to '

pfSense-pkg-API/files/etc/inc/api/endpoints/APIInterfaceApply.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ class APIInterfaceApply extends APIEndpoint {
2020
$this->url = "/api/v1/interface/apply";
2121
}
2222

23+
protected function get() {
24+
return (new APIInterfaceApplyRead())->call();
25+
}
26+
2327
protected function post() {
2428
return (new APIInterfaceApplyCreate())->call();
2529
}

pfSense-pkg-API/files/etc/inc/api/endpoints/APIServicesUnboundApply.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ class APIServicesUnboundApply extends APIEndpoint {
2020
$this->url = "/api/v1/services/unbound/apply";
2121
}
2222

23+
protected function get() {
24+
return (new APIServicesUnboundApplyRead())->call();
25+
}
26+
2327
protected function post() {
2428
return (new APIServicesUnboundApplyCreate())->call();
2529
}

pfSense-pkg-API/files/etc/inc/api/framework/APIResponse.inc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ function get($id, $data=[], $all=false) {
103103
"return" => $id,
104104
"message" => "Failed to connect to upstream package repositories",
105105
],
106+
14 => [
107+
"status" => "accepted",
108+
"code" => 202,
109+
"return" => $id,
110+
"message" => "Request was successful and is processing in the background",
111+
],
106112

107113
// 1000-1999 reserved for /system API calls
108114
1000 => [

pfSense-pkg-API/files/etc/inc/api/framework/APITools.inc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ function sort_nat_rules($top=false, $data=null, $field=null) {
359359
}
360360

361361
# Input a physical interface ID, or a descriptive interface name, and return the pfSense interface ID (lan,wan,optx)
362-
function get_pfsense_if_id($interface, $include_carp=false) {
362+
function get_pfsense_if_id($interface, $include_carp=false, $include_ipsec=false) {
363363
# Variables
364364
global $config;
365365
# Loop through our config and check each interface for a physical ID match
@@ -399,6 +399,11 @@ function get_pfsense_if_id($interface, $include_carp=false) {
399399
}
400400
}
401401
}
402+
403+
# Only include the default IPsec interface (enc0) if explicitly requested
404+
if ($include_ipsec and $interface === "enc0") {
405+
return $interface;
406+
}
402407
}
403408

404409
# Check if input is valid for rule source and destination

0 commit comments

Comments
 (0)