ndejong / pfsense_fauxapi

REST based API interface for pfSense 2.3.x and 2.4.x to facilitate devops
Apache License 2.0
354 stars 61 forks source link

Keep Getting Error after trying to use Patch_config #38

Closed RamiBadrPRo closed 5 years ago

RamiBadrPRo commented 5 years ago

I tried to use FauxApi's patch_config , passing to it a json as data, Here's the actual command :

curl -X POST --silent --insecure -L --header "fauxapi-auth: <fauxapi-auth-val>" --header "Content-Type: application/json" --data @patch.json "http://192.168.100.2/fauxapi/v1/?action=config_patch"

The reason for -L is to allow forwarding (due to the pfsense having been moved) , The is dynamically generated (the problem is not related to authentication).

The error i keep getting is : PHP ERROR: Type: 4096, File: /etc/inc/fauxapi/fauxapi_pfsense_interface.inc, Line: 135, Message: Argument 2 passed to fauxapi\v1\fauxApiPfsenseInterface::array_merge_recursive_distinct() must be of the type array, null given, called in /etc/inc/fauxapi/fauxapi_pfsense_interface.inc on line 121 and defined @ 2018-10-27 01:39:36

To be sure. the file patch.json is existing in the same path where i'm running the command, and has a valid json of a new list of CA's

RamiBadrPRo commented 5 years ago

Just to double down on this, The issue has been resolved, for future reference, the problem was with the redirection, it didn't redirect the file sent for some reason, I fixed the redirection issue by changing the protocol from http to https and it now functions properly. Still, i think there should be some data validation in order for this not to occur next time.