From 9b40b6f89bb7a9edb23d33c6316845634af6cc8c Mon Sep 17 00:00:00 2001 From: BBcan177 Date: Thu, 12 Jan 2017 10:36:54 -0500 Subject: [PATCH 1/5] Update pfblockerng.inc * Fix EasyList parsing * Modify DNSBL Certificate creation --- .../usr/local/pkg/pfblockerng/pfblockerng.inc | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng.inc b/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng.inc index a784ee7a712d..8785d6dccb39 100644 --- a/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng.inc +++ b/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng.inc @@ -932,9 +932,25 @@ EOF; // Create DNSBL SSL certificate if (!file_exists ("{$pfb['dnsbl_cert']}")) { - $log = "New DNSBL Cert Created.\n"; + $log = "\nNew DNSBL cert created"; pfb_logger("{$log}", 1); - exec("/usr/bin/openssl req -new -x509 -keyout {$pfb['dnsbl_cert']} -out {$pfb['dnsbl_cert']} -days 3650 -nodes"); + + $dn = array ( 'countryName' => 'CA', + 'stateOrProvinceName' => 'ST_DNSBL', + 'localityName' => 'LN_DNSBL', + 'organizationName' => 'ON_DNSBL', + 'organizationalUnitName'=> 'OU_DNSBL', + 'commonName' => 'CN_DNSBL', + 'emailAddress' => 'dnsbl@example.com' + ); + + $pkey = openssl_pkey_new(); + $csr = openssl_csr_new($dn, $pkey); + $cert = openssl_csr_sign($csr, NULL, $pkey, 3650); + + openssl_pkey_export($pkey, $privatekey); + openssl_x509_export($cert, $publickey); + @file_put_contents("{$pfb['dnsbl_cert']}", "{$privatekey}{$publickey}", LOCK_EX); } if ($pfbupdate || !is_service_running('dnsbl')) { @@ -3334,7 +3350,7 @@ function sync_package_pfblockerng($cron='') { // On 'category match', parse EasyList feed if (isset($easylist)) { - if (substr($line, 24, 19) == 'easylist_adservers.' || + if (substr($line, 88, 19) == 'easylist_adservers.' || substr($line, 91, 28) == 'easyprivacy_trackingservers.') { $e_found = TRUE; } @@ -3464,21 +3480,20 @@ function sync_package_pfblockerng($cron='') { $line = trim($line); // Parser for EasyList, enable collect of selected EasyList categories - if (isset($easylist) && (strpos($line, '! *** easylist:') !== FALSE) || - strpos($line, '! *** Fetched from:') !== FALSE) { + if (isset($easylist) && strpos($line, '! *** Fetched from:') !== FALSE) { // Skip all previous Easylist entries // Collect EasyList feed - if (substr($line, 24, 19) == 'easylist_adservers.') { + if (substr($line, 88, 19) == 'easylist_adservers.') { if (in_array('ea', $easylist) ? $e_skip = FALSE : $e_skip = TRUE); } - elseif (substr($line, 24, 25) == 'easylist_adservers_popup.') { + elseif (substr($line, 88, 25) == 'easylist_adservers_popup.') { if (in_array('eap', $easylist) ? $e_skip = FALSE : $e_skip = TRUE); } - elseif (substr($line, 30, 16) == 'adult_adservers.') { + elseif (substr($line, 94, 16) == 'adult_adservers.') { if (in_array('aa', $easylist) ? $e_skip = FALSE : $e_skip = TRUE); } - elseif (substr($line, 30, 22) == 'adult_adservers_popup.') { + elseif (substr($line, 94, 22) == 'adult_adservers_popup.') { if (in_array('aap', $easylist) ? $e_skip = FALSE : $e_skip = TRUE); } @@ -3491,7 +3506,7 @@ function sync_package_pfblockerng($cron='') { } // End of useable EasyList feed - elseif (substr($line, 24, 20) == 'easylist_thirdparty.') { + elseif (substr($line, 88, 20) == 'easylist_thirdparty.') { break; } // End of useable EasyPrivacy feed From 58306c7d12a3d9f62b6ab065ab2dc83bd22ca0d7 Mon Sep 17 00:00:00 2001 From: BBcan177 Date: Thu, 12 Jan 2017 10:44:14 -0500 Subject: [PATCH 2/5] Update pfblockerng_install.inc * On installation, re-create DNSBL certificate --- .../pkg/pfblockerng/pfblockerng_install.inc | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng_install.inc b/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng_install.inc index cfb45c9b6da1..b9032d89338b 100644 --- a/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng_install.inc +++ b/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng_install.inc @@ -259,6 +259,30 @@ EOF; unset($pfb_conf); update_status(" done.\n"); + // Create new DNSBL Certificate + update_status("Creating DNSBL Certificate..."); + $dn = array ( 'countryName' => 'CA', + 'stateOrProvinceName' => 'ST_DNSBL', + 'localityName' => 'LN_DNSBL', + 'organizationName' => 'ON_DNSBL', + 'organizationalUnitName'=> 'OU_DNSBL', + 'commonName' => 'CN_DNSBL', + 'emailAddress' => 'dnsbl@example.com' + ); + + $pkey = openssl_pkey_new(); + $csr = openssl_csr_new($dn, $pkey); + $cert = openssl_csr_sign($csr, NULL, $pkey, 3650); + + openssl_pkey_export($pkey, $privatekey); + openssl_x509_export($cert, $publickey); + @file_put_contents("{$pfb['dnsbl_cert']}", "{$privatekey}{$publickey}", LOCK_EX); + update_status(" done.\n"); + + update_status("Starting DNSBL Service..."); + restart_service('dnsbl'); + update_status(" done.\n"); + update_status("Starting DNSBL Service..."); restart_service('dnsbl'); update_status(" done.\n"); From edccdd545ead02f2704925bacc0e5bacc047df7f Mon Sep 17 00:00:00 2001 From: BBcan177 Date: Thu, 12 Jan 2017 10:46:44 -0500 Subject: [PATCH 3/5] Update Makefile Bump makefile --- net/pfSense-pkg-pfBlockerNG/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/pfSense-pkg-pfBlockerNG/Makefile b/net/pfSense-pkg-pfBlockerNG/Makefile index 95d21b947a77..c061eaf26b5f 100644 --- a/net/pfSense-pkg-pfBlockerNG/Makefile +++ b/net/pfSense-pkg-pfBlockerNG/Makefile @@ -2,7 +2,7 @@ PORTNAME= pfSense-pkg-pfBlockerNG PORTVERSION= 2.1.1 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= net MASTER_SITES= # empty DISTFILES= # empty From 4fb0dd3660892d55d58f4735be4f885208db26a6 Mon Sep 17 00:00:00 2001 From: BBcan177 Date: Thu, 12 Jan 2017 10:49:00 -0500 Subject: [PATCH 4/5] Update pfblockerng_install.inc * Remove duplicated code --- .../files/usr/local/pkg/pfblockerng/pfblockerng_install.inc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng_install.inc b/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng_install.inc index b9032d89338b..200c13fd0912 100644 --- a/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng_install.inc +++ b/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng_install.inc @@ -278,10 +278,6 @@ EOF; openssl_x509_export($cert, $publickey); @file_put_contents("{$pfb['dnsbl_cert']}", "{$privatekey}{$publickey}", LOCK_EX); update_status(" done.\n"); - - update_status("Starting DNSBL Service..."); - restart_service('dnsbl'); - update_status(" done.\n"); update_status("Starting DNSBL Service..."); restart_service('dnsbl'); From 0c7e9931bf5727e9aafec0f7ccf16d7ed33225b6 Mon Sep 17 00:00:00 2001 From: BBcan177 Date: Sun, 15 Jan 2017 17:42:09 -0500 Subject: [PATCH 5/5] Update pfblockerng.inc * Fix XMLRPC - Sync of General Settings as defined by user --- .../files/usr/local/pkg/pfblockerng/pfblockerng.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng.inc b/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng.inc index 8785d6dccb39..a0a92767d5b3 100644 --- a/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng.inc +++ b/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng.inc @@ -5617,7 +5617,7 @@ function pfblockerng_do_xmlrpc_sync($sync_to_ip, $port, $protocol, $username, $p $xml = array(); // If User Disabled, remove 'General Tab Customizations' from Sync - if (!isset($config['installedpackages']['pfblockerngsync']['config']['syncinterfaces'])) { + if ($config['installedpackages']['pfblockerngsync']['config'][0]['syncinterfaces'] != 'on') { if (isset($config['installedpackages']['pfblockerng'])) { $xml['pfblockerng'] = $config['installedpackages']['pfblockerng']; }