Comments (6)
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.
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.
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.
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.
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.
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 PFFA
head /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)
- Wake On LAN via fauxapi
- Allow UNIX timestamp auth HOT 1
- Kill states after enabling of rule HOT 1
- pfSense 2.4.4-p3 - URL table alias updating broken (simple fix) HOT 2
- Not executing commands until web browser refresh HOT 8
- Example to add new users and move to member groups HOT 1
- make firewall rule with python fauxapi HOT 2
- pfsense 2.5.x official repo? HOT 3
- Set timeout HOT 3
- fetch : bad request HOT 1
- Instruction Update HOT 2
- config_set does update but new Virtual IP is not added HOT 1
- apikey_value generation HOT 7
- Hash is marked as invalid unless lowercase
- Need to use GUI to save freeradius ?
- List of supported items for config_item_set
- Authentication failed, even though credentials were added HOT 1
- function_call: service_control_stop($name, $extras) not working
- authentication failed HOT 4
- cleanup_backupcache() seems to be missing in 24.03
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pfsense_fauxapi.