Adding user accounts to Local DB via a Captive Portal web form

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements

Adding user accounts to Local DB via a Captive Portal web form

L4 Transporter

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

1 accepted solution

Accepted Solutions

L3 Networker

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.

View solution in original post

3 REPLIES 3

L3 Networker

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.

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.

When you get it working, please share a sanitized version on DevCenter!

  • 1 accepted solution
  • 3393 Views
  • 3 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

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!