Giter Site home page Giter Site logo

Comments (6)

ndejong avatar ndejong commented on August 18, 2024 1

You should be able to specify the port as part of the host after a : mark as per standard URL formats - fair enough though, this is not stated in the documentation anywhere so unless it occurs to you it might be difficult to discover it

For example:-

pfsense_address = '192.168.1.1'
pfsense_port = 12345
fauxapi_host = '{}:{}'.format(pfsense_address, pfsense_port)

For the sake of future people reading this thread - there is currently no fauxapi_port parameter in the pfsense-fauxapi Python library - https://github.com/ndejong/pfsense_fauxapi_client_python

I'll hold out on #49 for the time being unless there is a major issue I'm not seeing myself.

from pfsense_fauxapi.

ndejong avatar ndejong commented on August 18, 2024

Hmm - the error looks to be a strong hint here - are you sure your pfsense instance is located at address 192.168.1.1 on port 443 ? Perhaps check with curl or a browser first

from pfsense_fauxapi.

nomodz4real avatar nomodz4real commented on August 18, 2024

Ahh, good point, is there a way to specify the port to communicate on?

Edit: I found the way to reference the port when calling PfsenseFauxapi()

from pfsense_fauxapi.

nomodz4real avatar nomodz4real commented on August 18, 2024

I was able to get past the port issue (I believe) by doing the following:

fauxapi_host=sys.argv[1]
fauxapi_apikey=os.getenv('FAUXAPI_APIKEY')
fauxapi_apisecret=os.getenv('FAUXAPI_APISECRET')
fauxapi_port=sys.argv[2]

FauxapiLib = PfsenseFauxapi(fauxapi_host, fauxapi_port, fauxapi_apikey, fauxapi_apisecret, debug=True)

where sys.argv[2] is the port number my pfsense listens on. Having done so I no longer get the timeout but get the following error. Not sure if the way I refer to the port is incorrect or if my pfsense running http with a self signed cert is the issue.

OSError: Could not find a suitable TLS CA certificate bundle, invalid path: 3yU3jutN7X258YpRtsTA13CAKY2NTN872Is02EXqKGz3l27AF4S5XTIQEhRn

Any ideas?

Edit: Unsure why the first code is not formatting correctly, so apologies. also the path is my key so perhaps the port variable 'fauxapi_port' is in the wrong place, gonna try and play around with that.

from pfsense_fauxapi.

nomodz4real avatar nomodz4real commented on August 18, 2024

Looking at the code base I didn't see a way to specify the port so I set my pfsense back to 443 for now, I will raise a separate issue for the port specification parameter capabilities.

The program is able to contact the server with the following code:

FauxapiLib = PfsenseFauxapi(fauxapi_host, fauxapi_apikey, fauxapi_apisecret, debug=True)

But I am now getting an authentication failed message, I made sure to try exporting my environment variables as follows:

export FAUXAPI_APIKEY=PFFAapi
export FAUXAPI_APISECRET=3yU3jutN7X258YpRtsTA13CAKY2NTN872Is02EXqKGz3l27AF4S5XTIQEhRn

Here is the error I receive.

PfsenseFauxapi.PfsenseFauxapi.PfsenseFauxapiException: ('Unable to complete system_stats() request', {'callid': '5cf3049c7b523', 'message': 'authentication failed'})

from pfsense_fauxapi.

nomodz4real avatar nomodz4real commented on August 18, 2024

Thanks for that update, I closed out #49 as your suggestion worked perfectly.

I am going to close this issue out now as my authentication issue was resolved by properly formatting the api key in addition to the secret.

I used
echo PFFAhead /dev/urandom | base64 -w0 | tr -d /+= | head -c 20``

for the key and
echo head /dev/urandom | base64 -w0 | tr -d /+= | head -c 60``

for the secret per the documentation and am now able to get a response and returns to my calls. Thanks for all the help @ndejong !

Tl;Dr My issue was due to not specifying the correct port and how to do this was shown above and I am now up and running.

from pfsense_fauxapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.