CAPTIVE PORTAL - PASSTHRUMAC via command prompt



  • Hello,
    i've been trying to add a MAC-Address to the allowed MACs via the command prompt in the webgui.
    I tried using the following commands:
    $config['captiveportal']['test']['passthrumac']['1']['action'] = "pass";
    $config['captiveportal']['test']['passthrumac']['1']['mac'] = "00:00:00:00:00:00";
    $config['captiveportal']['test']['passthrumac']['1']['descr'] = "test";
    write_config();

    When executing the commands the MAC shows up in my CP Settings, but when trying to connect my device is redirected to the Login Page.

    I've tried retracing the procedure that is done to add a MAC in the pfsense Source code and realized that it adds some kind of firewall rule to allow that MAC through.

    Is it possible to do the same via php commands?



  • The active settings are "dumped" ones in a while to the config file, so in case of a restart or reboot, all settings can be reconstructed.
    Writing setting "by hand" to te config file doesnt make them active.

    @posto587 said in CAPTIVE PORTAL - PASSTHRUMAC via command prompt:

    Is it possible to do the same via php commands?

    You mentioned the answer already yourself !
    This has to be done :
    @posto587 said in CAPTIVE PORTAL - PASSTHRUMAC via command prompt:

    retracing the procedure that is done to add a MAC in the pfsense Source code and realized that it adds some kind of firewall rule to allow that MAC through.

    So you saw what's need to be done so the MAC is taking into account.

    The captive portal is
    Some ipfw firewall rules.
    Your GUI firewall rules.
    Some glue code.

    A solution might be : add settings to the config file, then stop the portal (don't forget to log everybody out !!) and start the portal again.
    Now your settings will be applied.
    But, because everybody has to logged out first, you would consider this as an option.

    Read also https://www.netgate.com/docs/pfsense/captiveportal/captive-portal-troubleshooting.html