diff options
author | Ermal <eri@pfsense.org> | 2011-01-26 18:40:22 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2011-01-26 18:40:22 +0000 |
commit | 422b8b4ef0b856425569284073b4181c25cfe305 (patch) | |
tree | b86de64084ab9ed45e87a0f7dad2585bed5023d4 /etc/inc | |
parent | c3c7fc062708bb80d926aa4ca3abbffa31617762 (diff) | |
download | pfsense-422b8b4ef0b856425569284073b4181c25cfe305.zip pfsense-422b8b4ef0b856425569284073b4181c25cfe305.tar.gz |
Switch to filterdns new and shiny for taking care of dns in CP.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/captiveportal.inc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index 12701ab..76f7a5b 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -1072,16 +1072,20 @@ function captiveportal_allowedip_configure_entry($ipent) { */ function setup_dnsfilter_entries() { global $g, $config; + $cp_filterdns_filename = "{$g['varetc_path']}/filterdns-captiveportal.conf"; - $fd = fopen($cp_filterdns_filename, "w"); - if (is_array($config['captiveportal']['allowedhostname'])) - foreach ($config['captiveportal']['allowedhostname'] as $hostnameent) - fwrite($fd, $hostnameent['hostname'] . "\n"); - fclose($fd); + $cp_filterdns_conf = ""; + if (is_array($config['captiveportal']['allowedhostname'])) { + foreach ($config['captiveportal']['allowedhostname'] as $hostnameent) { + $cp_filterdns_conf .= "ipfw $hostnameent 3 /etc/rc.captiveportal_configure\n"; + $cp_filterdns_conf .= "ipfw $hostnameent 4 /etc/rc.captiveportal_configure\n"; + $cp_filterdns_conf .= "ipfw $hostnameent 7 /etc/rc.captiveportal_configure\n"; + $cp_filterdns_conf .= "ipfw $hostnameent 8 /etc/rc.captiveportal_configure\n"; + } + } + file_put_contents($cp_filterdns_filename, $cp_filterdns_conf); killbypid("{$g['tmp_path']}/dnswatch-cpah.pid"); - // For some reason the killbypid() is not working. Brute force if needed. - exec("/bin/ps awux | grep -v /usr/bin/grep | grep dnswatch-cpah.pid | /usr/bin/awk '{ print \$2 }' | /usr/bin/xargs kill"); - mwexec("/usr/local/sbin/dnswatch {$g['tmp_path']}/dnswatch-cpah.pid 300 /etc/rc.captiveportal_configure {$cp_filterdns_filename}"); + mwexec("/usr/local/sbin/filterdns -p {$g['tmp_path']}/dnswatch-cpah.pid -i 300 -c {$cp_filterdns_filename} -d 1"); } function captiveportal_allowedhostname_configure() { @@ -1511,4 +1515,4 @@ function portal_ip_from_client_ip($cliip) { return false; } -?>
\ No newline at end of file +?> |