Captive Portal Upload



  • Hi,

    Is there any by by which I can upload the Captive Portal File using PHP or any Script instead of PFSense -> Services -> Captive Portal and then Manually Uploaded Portal Page Contents.

    PFSense build that I am using is 2.2.4

    Sincere Thanks,

    Ameet Parse



  • @SmartCodar:

    Is there any by by which I can upload the Captive Portal File using PHP or any Script instead of PFSense -> Services -> Captive Portal and then Manually Uploaded Portal Page Contents.

    This "PFSense -> Services -> Captive Portal and then Manually Uploaded Portal Page Contents"
    IS a PHP page that let you upload the page and does all the work needed to insert it in the system.
    What about reusing it to make yours ?



  • @Gertjan:

    @SmartCodar:

    Is there any by by which I can upload the Captive Portal File using PHP or any Script instead of PFSense -> Services -> Captive Portal and then Manually Uploaded Portal Page Contents.

    This "PFSense -> Services -> Captive Portal and then Manually Uploaded Portal Page Contents"
    IS a PHP page that let you upload the page and does all the work needed to insert it in the system.
    What about reusing it to make yours ?

    Thanks for quick reply,

    Basically I need to Upload the Captive Portal Page pro-grammatically. For example when PFSense System is rebooted. is there any way where I need to copy my Captive Portal Page Content file? I have tried to copy in \var\etc but it wont worked. Is there any additional step I need to do

    Thanks,

    Ameet Parse



  • @SmartCodar:

    Basically I need to Upload the Captive Portal Page pro-grammatically.

    …..
    For example when PFSense System is rebooted. is there any way where I need to copy my Captive Portal Page Content file? I have tried to copy in \var\etc but it wont worked. Is there any additional step I need to do

    From how I understand it, when pfSense reboots, using PHP a script, use wget/ftp/curl/what-ever to 'import' a new html file, and write_config() it.
    See here https://github.com/pfsense/pfsense/blob/master/src/usr/local/www/services_captiveportal.php#L447

    The other way around: create a script (it can be on any device that can access pfSense**)  that accepts a $POST, so you can send ove new file - put it in the config,  write_config() and restart the captive portal service.

    ** if needed, you can decide to skip the entire GUI login protection. Remember, its PHP, your free to do what you want ;)



  • @Gertjan:

    Thanks,

    Can you please let me know which config file I need to use? Also does Write_Config can be called using a Cron? I mean without doing login or Authentication.
    @SmartCodar:

    Basically I need to Upload the Captive Portal Page pro-grammatically.

    …..
    For example when PFSense System is rebooted. is there any way where I need to copy my Captive Portal Page Content file? I have tried to copy in \var\etc but it wont worked. Is there any additional step I need to do

    From how I understand it, when pfSense reboots, using PHP a script, use wget/ftp/curl/what-ever to 'import' a new html file, and write_config() it.
    See here https://github.com/pfsense/pfsense/blob/master/src/usr/local/www/services_captiveportal.php#L447

    The other way around: create a script (it can be on any device that can access pfSense**)  that accepts a $POST, so you can send ove new file - put it in the config,  write_config() and restart the captive portal service.

    ** if needed, you can decide to skip the entire GUI login protection. Remember, its PHP, your free to do what you want ;)



  • @SmartCodar:

    @Gertjan:

    Thanks Gertjan this worked very well
    Thanks,

    Can you please let me know which config file I need to use? Also does Write_Config can be called using a Cron? I mean without doing login or Authentication.
    @SmartCodar:

    Basically I need to Upload the Captive Portal Page pro-grammatically.

    …..
    For example when PFSense System is rebooted. is there any way where I need to copy my Captive Portal Page Content file? I have tried to copy in \var\etc but it wont worked. Is there any additional step I need to do

    From how I understand it, when pfSense reboots, using PHP a script, use wget/ftp/curl/what-ever to 'import' a new html file, and write_config() it.
    See here https://github.com/pfsense/pfsense/blob/master/src/usr/local/www/services_captiveportal.php#L447

    The other way around: create a script (it can be on any device that can access pfSense**)  that accepts a $POST, so you can send ove new file - put it in the config,  write_config() and restart the captive portal service.

    ** if needed, you can decide to skip the entire GUI login protection. Remember, its PHP, your free to do what you want ;)


Log in to reply