Custom CaptivePortal page with PHP/MySQL data capture
-
Hello there,
Firstly apologies if this has been asked before, I have searched on the Wiki and beyond with no success.
Anyway, I want to set up a CaptivePortal page that firstly captures some data to a MySQL database via PHP. I'm perfectly comfortable doing this on a web server but can someone explain if this is possible on PFSense and how it fits into the architecture of the system. Would I have to install mySQL?
Any help/advice you could give would be much appreciated.
Regards
-
You can use php pages for captive portal (just upload them instead of an ordinary html page as login page through the webgui). However you should run the database part on a different system.
-
For security reasons running MySQL on PFSense Firewall is not recommended and should be run from a different machine. With that in mind you could send the information to PHP on another machine that is running PHP/MySQL by using CURL, or POST/GET over HTTP/HTTPS (https is possible since openssl is installed).
To get access to the files you can use Diagnostics->Edit File or use sftp (ftp over ssh) to connect into the PFSense file system. To do this you have to enable secure shell from the PFSense web inteface.
System -> Advanced -> Enable Secure ShellCaptive Portal Paths that may be useful.
PFSense GUI forms for captive portal
/usr/local/captiveportaldatabase it is as actually a text file
/var/db/captiveportal.dbcaptive portal functions
/etc/inc/captiveportal.inc -
mcrane… did you know where is freeradius database file? i install freeradius using pfsense package
-
can anyone tell me where is database real text file situated. Because var/db/captiveportal.db is when users had login.but not users that are not login yet. where http://192.168.xx.xx/services_captiveportal_users.php fetch the data.. thanks in advance
-
//main directory for Freeradius
/usr/local/etc/raddb/users//user database for Freeradius
/usr/local/etc/raddb/users//Package directory for PFSense packages including Freeradius
/usr/local/pkgHowever the above users file in the /usr/local/etc/raddb folder is likely to be overwritten by PFSense.
-
overwritten by PFSense. can u tell me what that mean?
-
On bootup or guichanges regarding the radiusserver pfSense will regenrate these files from scratch using the data from config.xml and restart the service.
-
thank hoba for information