Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pfBlockerNG v2.1.1_6 #253

Merged
merged 5 commits into from
Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion net/pfSense-pkg-pfBlockerNG/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PORTNAME= pfSense-pkg-pfBlockerNG
PORTVERSION= 2.1.1
PORTREVISION= 5
PORTREVISION= 6
CATEGORIES= net
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' => '[email protected]'
);

$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')) {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}

Expand All @@ -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
Expand Down Expand Up @@ -5602,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'];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,26 @@ 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' => '[email protected]'
);

$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");
Expand Down