Uploaded image for project: 'FreePBX'
  1. FreePBX
  2. FREEPBX-22665

Firewall will not start if DNS is not working

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 15.0.13
    • Fix Version/s: None
    • Component/s: Firewall
    • Labels:
      None
    • ToDo:
    • Distro:
      FreePBX Distro

      Description

      Trying to diagnose some truly baffling firewall behaviour, finally noticed this in the logs every 5 seconds:

      ```
      Jul 18 06:31:20 pbx php: Unable to see safemode in services.. Sleeping 5 seconds and retrying
      Jul 18 06:31:26 pbx php: Unparseable output from getservices - ["Whoops\\Exception\\ErrorException: dns_get_record(): A temporary server error occurred. in file \/var\/www\/html\/admin\/modules\/firewall\/Smart.class.php on line 349","Stack trace:"," 1. Whoops\\Exception\\ErrorException->() \/var\/www\/html\/admin\/modules\/firewall\/Smart.class.php:349"," 2. dns_get_record() \/var\/www\/html\/admin\/modules\/firewall\/Smart.class.php:349"," 3. FreePBX\\modules\\Firewall\\Smart->getKnown() \/var\/www\/html\/admin\/modules\/firewall\/Smart.class.php:87"," 4. FreePBX\\modules\\Firewall\\Smart->getAllPorts() \/var\/www\/html\/admin\/modules\/firewall\/Firewall.class.php:1992"," 5. FreePBX\\modules\\Firewall->getSmartPorts() \/var\/www\/html\/admin\/modules\/firewall\/bin\/getservices:22"] - returned 1
      ```

      It seems that Smart.class.php line 349 was added with the following commit:

      https://git.freepbx.org/projects/FREEPBX/repos/firewall/commits/efcfe7d495f0231befe7e2bf8fe07d530aff0acf#Smart.class.php

      ```php
      $srvdns = dns_get_record('_sip._udp.'.$d, \DNS_SRV);
      ```

      At the point of the error, $d contains ntt-east.ne.jp. I don't know why "a temporary server error occurred" when trying to query it – it queries just fine using dig – but it prevents the firewall from starting and this seems dangerous.

      I changed it as follows, just to avoid having it crash:

      ```php
      $srvdns = @dns_get_record('_sip._udp.'.$d, \DNS_SRV);
      ```

      The firewall now starts up correctly. I don't know if this is a sufficient fix; it probably needs some error checking or something. I don't really know enough about PHP to know for sure.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  awh awh
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  2 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    NextupJiraPlusStatus

                    Error rendering 'slack.nextup.jira:nextup-jira-plus-status'. Please contact your Jira administrators.