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

Reply
Highlighted
L4 Transporter

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

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

Tags (2)
L3 Networker

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

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.

L4 Transporter

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

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.

L3 Networker

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

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

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 Live Community as a whole!

The Live Community thanks you for your participation!