- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
06-29-2012 09:11 AM
I was wondering if there's a way to create a web form on the Captive Portal so that a user could create their own account and have it added to the PAN Local DB via an API?
Thanks,
Jeff
07-02-2012 11:09 AM
The captive portal response page can only be a single page, however it might be technically possible to create that page with a javascript powered form that could add a user to the local DB. It looks like the API call you'd use would be this:
/api/?type=config&action=set&xpath=/config/shared/local-user-database/user/entry[@name='joeuser']&element=<phash>$1$shsipcfw$qQcH/MlxYG1ucCdhTkkMs/</phash>
Of course you'll notice that the above command contains a phash, which we can also generate via the API
/api/?type=op&cmd=<request><password-hash><password>test</password></password-hash></request>
Note that both of the above api calls work as-is if you are currently logged in to the firewall as a superuser. For a js form you wouldn't be, so you would need to generate an API key and use it in your calls.
As always, even with obfuscation the API key is potentially extractable and could be used for other purposes, so it's best to ensure that this is only used in a trusted environment.
07-02-2012 11:09 AM
The captive portal response page can only be a single page, however it might be technically possible to create that page with a javascript powered form that could add a user to the local DB. It looks like the API call you'd use would be this:
/api/?type=config&action=set&xpath=/config/shared/local-user-database/user/entry[@name='joeuser']&element=<phash>$1$shsipcfw$qQcH/MlxYG1ucCdhTkkMs/</phash>
Of course you'll notice that the above command contains a phash, which we can also generate via the API
/api/?type=op&cmd=<request><password-hash><password>test</password></password-hash></request>
Note that both of the above api calls work as-is if you are currently logged in to the firewall as a superuser. For a js form you wouldn't be, so you would need to generate an API key and use it in your calls.
As always, even with obfuscation the API key is potentially extractable and could be used for other purposes, so it's best to ensure that this is only used in a trusted environment.
07-02-2012 01:40 PM
Thank you very much! Tried it from my browser and it worked great! Now just need to test it out with a CP Response Page.
07-03-2012 09:15 AM
When you get it working, please share a sanitized version on DevCenter!
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!