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

Not getting response for config_get or rule_get #27

Closed mugdha-adhav closed 6 years ago

mugdha-adhav commented 6 years ago

Hi, My API call for system_stats, config_reload, etc are working fine but it fails for config_get and rule_get. In the logs I can see the request reaches pfsense and also it is a valid request, but after about a min it says authentication failed 401 Unauthorized because of timeout. This is my request: curl -k -s -X GET -H "fauxapi-auth: ${fauxapi_auth}" http://${fauxapi_host}/fauxapi/v1/?action=rule_get

Note: Just to add, I am using http instead of https because I was getting certificate issues with https.
ndejong commented 6 years ago

Thanks for the report, could you provide:-

On 17 Jul 2018, at 13:55, mugdhaadhav notifications@github.com wrote:

Hi, My API call for system_stats, config_reload, etc are working fine but it fails for config_get and rule_get. In the logs I can see the request reaches pfsense and also it is a valid request, but after about a min it says authentication failed 401 Unauthorized because of timeout. This is my request: curl -k -s -X GET -H "fauxapi-auth: ${fauxapi_auth}" http://${fauxapi_host}/fauxapi/v1/?action=rule_get

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ndejong/pfsense_fauxapi/issues/27, or mute the thread https://github.com/notifications/unsubscribe-auth/AAM2KgGb5D9Sc9CFsCxfCf7Cy3GL17GQks5uHXxSgaJpZM4VSOar .

mugdha-adhav commented 6 years ago

Hi, Pfsense Version: 2.4.3 FauxAPI Version: 1.3_1

Attaching the output for clog /var/log/system.log | grep fauxapi

It's taking too long for sending response so its failing I suppose. Thanks for quick reply.

pf2 pf

ndejong commented 6 years ago

Please add a __debug=true parameter to your curl request, this will provide a lot more detail into what's going on

For example, based on your original-post, the curl request you might send would look like this:-

curl -k -s -X GET -H "fauxapi-auth: ${fauxapi_auth}" http://${fauxapi_host}/fauxapi/v1/?action=rule_get&__debug=true

For reference, the debug documentation is found here:-

mugdha-adhav commented 6 years ago

Hi, I tried this earlier as well, but debug=true parameter doesn't work. The request is sent but it waits till timestamp goes out of bounds and then sends, authentication error. Getting the same error as above on all requests(including the ones working before) after using debug=true.

ndejong commented 6 years ago

Please check that system time on your pfSense host and the host you are sending curl requests from are in sync - what you are describing sounds very much like the auth token is failing because the timestamps are not within 60s of one another - N

On 19 Jul 2018, at 18:08, mugdhaadhav notifications@github.com wrote:

Hi, I tried this earlier as well, but debug=true parameter doesn't work. The request is sent but it waits till timestamp goes out of bounds and then sends, authentication error. Getting the same error as above on all requests(including the ones working before) after using debug=true.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ndejong/pfsense_fauxapi/issues/27#issuecomment-406225730, or mute the thread https://github.com/notifications/unsubscribe-auth/AAM2KpQqFlY6rYB75gfHTnQhw_iBXbSLks5uIFqFgaJpZM4VSOar .

mugdha-adhav commented 6 years ago

Hi, Thanks for you help and quick response. I figured out the issue. The request was failing due to the network proxy.