Skip to content

Commit

Permalink
Test patch to allow FQDNs/multiple IPs for URL Aliases
Browse files Browse the repository at this point in the history
This patch modifies /etc/inc/pfsense-utils.inc
Tested on a couple of systems - but could use more testing!
  • Loading branch information
luckman212 committed May 21, 2018
1 parent 5fed4bf commit 08769cb
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions src/etc/inc/pfsense-utils.inc
Expand Up @@ -2337,13 +2337,36 @@ function parse_aliases_file($filename, $type = "url", $max_items = -1, $kflc = f
if (!empty($tmp_str)) {
$tmp = $tmp_str;
}
$valid = (($type == "url" || $type == "urltable") && (is_ipaddr($tmp) || is_subnet($tmp))) ||
(($type == "url_ports" || $type == "urltable_ports") && is_port_or_range($tmp));
if ($valid) {
$items[] = $tmp;
if (count($items) == $max_items) {
switch ($type) {
case "url":
case "urltable":
if (is_ipaddr($tmp) || is_subnet($tmp)) {
$items[] = $tmp;
break;
}
if (is_fqdn($tmp)) {
exec("/usr/local/bin/dig " . ${tmp} . " A " . ${tmp} . " AAAA +short", $results, $retval);
if ($retval == 0) {
foreach ($results as $ip) {
if (is_ipaddr($ip)) {
$items[] = $ip;
}
}
}
}
break;
case "url_ports":
case "urltable_ports":
if (is_port_or_range($tmp)) {
$items[] = $tmp;
}
break;
default:
/* unknown type */
break;
}
if (count($items) == $max_items) {
break;
}
}
}
Expand Down

0 comments on commit 08769cb

Please sign in to comment.