ndejong / pfsense_fauxapi

REST based API interface for pfSense 2.3.x and 2.4.x to facilitate devops

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pfSense 2.4.4-p3 - URL table alias updating broken (simple fix)

eli-kaplan opened this issue · comments

Upon updating pfSense from 2.4.4 to 2.4.4-p3 I noticed that calling that alias_update_urltables seemed to no longer trigger any server-side activity. I updated FauxAPI to the latest package version, and the issue was not resolved, so I did a bit of digging, and found the issue:

In /etc/inc/fauxapi/fauxapi_pfsense_interface.inc (line 707), the following logic is used to retrieve URL table aliases:

if (
            array_key_exists('aliases', $config) and
            is_array($config['aliases']) and
            array_key_exists('aliases', $config['aliases'])) {
                foreach ($config['alias']['alias'] as $alias) {
                    if (preg_match('/urltable/i', $alias['type'])) {
...

However, it seems that either this is a typo, or pfSense 2.4.4-p3 (or one of the intermediate versions) changed the configuration path for aliases, so the list of aliases now resides at $config['aliases']['alias']. Updating the above conditional to the following fixes this issue, and restores URL table updating functionality:

if (
            array_key_exists('aliases', $config) and
            is_array($config['aliases']) and
            array_key_exists('alias', $config['aliases'])) {
                foreach ($config['aliases']['alias'] as $alias) {
                    if (preg_match('/urltable/i', $alias['type'])) {

I am not sure if this is specific to 2.4.4-p3 - however, this is the configuration path used to retrieve URL table aliases in
the installed version of /etc/rc.update_urltables, which FauxAPI's alias_update_urltables() is based off of.

fix does not work in pfsense 2.5.1

Yep - this is a bug - working on a new version that will patch this