From 07cf2c4b20230ddedee1bf9dddc1e7cd407385f5 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Thu, 5 Feb 2015 10:02:24 -0200 Subject: Packages repo cleanup: - Drop support for pfSense < 2 - Remove archive/, old files can be reached using git - Remove old and unused packages - Move stale files from config subdir to a package subdir --- config/dnsblacklist/dnsblacklist.inc | 106 ------------ config/dnsblacklist/dnsblacklist.tmp | 217 ------------------------ config/dnsblacklist/dnsblacklist.tmp.old | 276 ------------------------------- config/dnsblacklist/dnsblacklist.xml | 110 ------------ 4 files changed, 709 deletions(-) delete mode 100644 config/dnsblacklist/dnsblacklist.inc delete mode 100644 config/dnsblacklist/dnsblacklist.tmp delete mode 100644 config/dnsblacklist/dnsblacklist.tmp.old delete mode 100644 config/dnsblacklist/dnsblacklist.xml (limited to 'config/dnsblacklist') diff --git a/config/dnsblacklist/dnsblacklist.inc b/config/dnsblacklist/dnsblacklist.inc deleted file mode 100644 index d9c7f364..00000000 --- a/config/dnsblacklist/dnsblacklist.inc +++ /dev/null @@ -1,106 +0,0 @@ -10^x|1024->2^x] - $s=array('B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB'); - $e=floor(log($bytes,$convention)); - return round($bytes/pow($convention,$e),2).' '.$s[$e]; -} - - - - -function dnsblacklist_sync_package() -{ - global $config; -} - - -function dnsblacklist_install_command() -{ - - global $config; - conf_mount_rw(); - config_lock(); - - if (!is_dir('/usr/local/www/packages/')) { - exec("mkdir /usr/local/www/packages/"); - } - - if (!is_dir('/usr/local/www/packages/dnsblacklist/')) { - exec("mkdir /usr/local/www/packages/dnsblacklist/"); - } - - //extract the blacklist - exec("cp /tmp/blacklists.tar.gz /usr/local/www/packages/dnsblacklist/blacklists.tar.gz"); - chdir("/usr/local/www/packages/dnsblacklist/"); - exec("tar xvf blacklists.tar.gz"); - exec("rm /tmp/blacklists.tar.gz"); - exec("rm /usr/local/www/packages/dnsblacklist/blacklists.tar.gz"); - - //rename PHP files from .tmp to .php - exec("cp /tmp/dnsblacklist.tmp /usr/local/www/packages/dnsblacklist/dnsblacklist.php"); - unlink_if_exists("/tmp/dnsblacklist.tmp"); - - //write_rcfile(array( - // "file" => "phpservice.sh", - // "start" => "/usr/local/bin/php /usr/local/pkg/phpservice.php >> /var/log/phpservice.log &", - // "stop" => "rm /tmp/phpmonitor.pid" - // ) - //); - - //dnsblacklist_sync_package(); - //$handle = popen("/usr/local/etc/rc.d/phpservice.sh start", "r"); - //pclose($handle); - - conf_mount_ro(); - config_unlock(); -} - - -function dnsblacklist_deinstall_command() -{ - conf_mount_rw(); - $handle = popen("/usr/local/etc/rc.d/dnsblacklist.sh stop", "r"); - unlink_if_exists("/usr/local/pkg/dnsblacklist.xml"); - unlink_if_exists("/usr/local/pkg/dnsblacklist.inc"); - exec("rm -R /usr/local/www/packages/dnsblacklist/blacklists"); - exec("rm -R /usr/local/www/packages/dnsblacklist"); - conf_mount_ro(); -} - -?> diff --git a/config/dnsblacklist/dnsblacklist.tmp b/config/dnsblacklist/dnsblacklist.tmp deleted file mode 100644 index 73464608..00000000 --- a/config/dnsblacklist/dnsblacklist.tmp +++ /dev/null @@ -1,217 +0,0 @@ -"; - //echo "\$category['$value'] = 'zzz';
\n"; - //$x++; - //} - //unset($x); - //echo "
";
-	//print_r($_POST["blacklist"]);
-	//echo "
"; - //foreach($_POST["blacklist"] as $key => $value) { - //echo "name: ".$value."
"; - //$x++; - //} - -if (count($_POST)>0) { - - conf_mount_rw(); - - $dnsmasqfile = "/usr/local/etc/dnsmasq.conf"; - $targetfile = "/usr/local/etc/dnsmasq.blacklist.conf"; - $includestring = "conf-file=/usr/local/etc/dnsmasq.blacklist.conf"; - $dnsmasqconf = "/usr/local/etc/dnsmasq.conf"; - - //clear previous values - $ent = array(); - foreach($category as $key => $value) { - $ent[$key] = '0'; - } - $config['installedpackages']['dnsblacklist']['config'][0] = $ent; - //write_config(); - - //truncate the dnsmasq.blacklist.conf file - if (file_exists($targetfile)) { - $fh = fopen($targetfile, 'w'); - fclose($fh); - } - - if ($_POST['enable'] == 1) { - //echo "enabled"; - $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 1; - } - else { - //echo "disabled"; - $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 0; - } - - //add the include entry for dnsmasq.blacklist.conf to dnsmasq.conf - if (file_exists($dnsmasqfile)) { - $getdnsmasq = file_get_contents($dnsmasqfile); - if(stristr($getdnsmasq,'conf-file=/usr/local/etc/dnsmasq.blacklist.conf') === TRUE) { - //include found no need to add it - } - else { - $myfhandle = fopen($dnsmasqconf, 'r+'); - fwrite($myfhandle, $includestring); - fclose($myfhandle); - } - } - else { - $my2fhandle = fopen($dnsmasqconf, 'x+'); - fwrite($my2fhandle, $includestring); - fclose($my2fhandle); - } - - //build the dnsmasq.blacklist.conf - if (count($_POST["blacklist"]) > 0) { - foreach($_POST["blacklist"] as $value) { - //set the current selected values - $blackfile = "blacklists/$value/domains"; - $config['installedpackages']['dnsblacklist']['config'][0][$value] = 1; - //if enabled write the selected categories to the dnsmasq.blacklist.conf - if ($config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] == 1) { - $fh2 = fopen($targetfile, 'a'); - $fh = fopen($blackfile,'r'); - while($line=fgets($fh)) { - //remove all characters other than alpha numeric period and dash - preg_match("/([a-zA-Z0-9.-]*)/i", $line, $arraymatches); - $line = $arraymatches[1]; - fwrite($fh2, "address=/" .$line. "/74.125.45.100". "\n"); - } - fclose($fh); - fclose($fh2); - } - } - } - - write_config(); - services_dnsmasq_configure(); - sleep(1); - $savemsg_dnsb = "DNS Blacklist settings have been saved. "; - conf_mount_ro(); -} -?> - - -

Services: DNS Blacklist

-
- -\n"; -} -else { - echo "\n"; -} -?> - -Enable DNS Blacklist

- -\n"; - if ($config['installedpackages']['dnsblacklist']['config'][0][$key] == 1) { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } - else { - echo "\n"; - echo "\n"; - echo "\n"; - echo "\n"; - } - echo "\n"; - $x++; -} -echo "
- - -Below is a scroll-box filled with categories you can select to be added to your blacklist.

Each category has a list of known domains/sites that will be denied access by users of this network. -

(Note: Using all categories at once will require 300Mb of free memory. The adult category is rather memory intensive, requiring 200Mb.) -


- - -
-\n"; -foreach($category as $key => $value) { - $domain_count = line_number("blacklists/$key/domains"); - echo "
".$value['name_en']."".$value['desc_en']."($domain_count domains)".$value['name_en']."".$value['desc_en']."($domain_count domains)
\n"; - -?> - -
-
- - "Edit Category", ); -////$tmp_category = str_replace(" ", " ", $category); -//echo "\n"; -?> - -"; -?> - - - - -
- - - - - diff --git a/config/dnsblacklist/dnsblacklist.tmp.old b/config/dnsblacklist/dnsblacklist.tmp.old deleted file mode 100644 index 24d34412..00000000 --- a/config/dnsblacklist/dnsblacklist.tmp.old +++ /dev/null @@ -1,276 +0,0 @@ -"; - //echo "\$category['$value'] = 'zzz';
\n"; - //$x++; - //} - //unset($x); - //echo "
";
-	//print_r($_POST["blacklist"]);
-	//echo "
"; - //foreach($_POST["blacklist"] as $key => $value) { - //echo "name: ".$value."
"; - //$x++; - //} - -if (count($_POST)>0) { - $dnsmasqfile = "/usr/local/etc/dnsmasq.conf"; - $targetfile = "/usr/local/etc/dnsmasq.blacklist.conf"; - $includestring = "conf-file=/usr/local/etc/dnsmasq.blacklist.conf"; - $dnsmasqconf = "/usr/local/etc/dnsmasq.conf"; - //clear previous values - foreach($category as $key => $value) { - $config['installedpackages']['dnsblacklist']['config'][0][$key] = ''; - } - if ($_POST['enable'] == 1) { - //echo "enabled"; - $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 1; - } - else { - //echo "disabled"; - $config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] = 0; - } - //add the include entry for dnsmasq.blacklist.conf to dnsmasq.conf - if (file_exists($dnsmasqfile)) { - $getdnsmasq = file_get_contents($dnsmasqfile); - if(stristr($getdnsmasq,'conf-file=/usr/local/etc/dnsmasq.blacklist.conf') === TRUE) { - //include found no need to add it - } - else { - $myfhandle = fopen($dnsmasqconf, 'r+'); - fwrite($myfhandle, $includestring); - fclose($myfhandle); - } - } - else { - $my2fhandle = fopen($dnsmasqconf, 'x+'); - fwrite($my2fhandle, $includestring); - fclose($my2fhandle); - } - //truncate the dnsmasq.blacklist.conf file - if (file_exists($targetfile)) { - $fh = fopen($targetfile, 'w'); - fclose($fh); - } - //build the dnsmasq.blacklist.conf - if (count($_POST["blacklist"]) > 0) { - foreach($_POST["blacklist"] as $value) { - //set the current selected values - $blackfile = "blacklists/$value/domains"; - $config['installedpackages']['dnsblacklist']['config'][0][$value] = 1; - //if enabled write the selected categories to the dnsmasq.blacklist.conf - if ($config['installedpackages']['dnsblacklist_settings']['config'][0]['enable'] == 1) { - $fh2 = fopen($targetfile, 'a'); - $fh = fopen($blackfile,'r'); - while($line=fgets($fh)) { - fwrite($fh2, "address=/" .trim($line). "/74.125.45.100". "\n"); - } - fclose($fh); - fclose($fh2); - } - } - } - write_config(); - services_dnsmasq_configure(); - sleep(1); - $savemsg_dnsb = "DNS Blacklist settings have been saved."; -} -?> - - -

Services: DNS Blacklist

-
- -\n"; -} -else { - echo "\n"; -} -?> - -Enable DNS Blacklist

- -\n"; - if ($config['installedpackages']['dnsblacklist']['config'][0][$key] == 1) { - // echo "\n"; - } - else { - // echo " \n"; - } - echo "\n"; - $x++; -} -echo "
- - -Below is a scroll-box filled with categories you can select to be added to your blacklist.

Each category has a list of known domains/sites that will be denied access by users of this network. -

(Note: Using all categories at once will require 300Mb of free memory. The adult and porn categories are rather memory intensive, requiring 200Mb together.) -


- -function ListFiles($dir) { - - if($dh = opendir($dir)) { - - $files = Array(); - $inner_files = Array(); - - while($file = readdir($dh)) { - if($file != "." && $file != ".." && $file[0] != '.') { - if(is_dir($dir . "/" . $file)) { - array_push($files, $dir); - //$inner_files = ListFiles($dir . "/" . $file); - //if(is_array($inner_files)) $files = array_merge($files, $inner_files); - } else { - //array_push($files, $dir . "/" . $file); - } - } - } - - closedir($dh); - return $files; - } -} - - -foreach (ListFiles('/usr/local/www/packages/dnsblacklist/') as $key=>$file){ - echo $file ."
\n"; -} - - - -
-\n"; -foreach($category as $key => $value) { - $domain_count = line_number("blacklists/$key/domains"); - //echo "name: ".$key."
"; - echo "
$key$value($domain_count domains)$key$value($domain_count domains)
\n"; -*/ -?> - -
-
- - "Edit Category", ); -////$tmp_category = str_replace(" ", " ", $category); -//echo "\n"; -?> - - - - - - -
- - - - - diff --git a/config/dnsblacklist/dnsblacklist.xml b/config/dnsblacklist/dnsblacklist.xml deleted file mode 100644 index 75314810..00000000 --- a/config/dnsblacklist/dnsblacklist.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - DNS Blacklist - Describe your package requirements here - Currently there are no FAQ items provided. - DNS Blacklist Settings - 0.2.4 - Settings - /usr/local/pkg/dnsblacklist.inc - - DNS Blacklist - DNS Blacklist settings. -
Services
- dnsblacklist.xml - /packages/dnsblacklist/dnsblacklist.php -
- - - Settings - /packages/dnsblacklist/dnsblacklist.php - - - - installedpackages->package->$packagename->configuration->dnsblacklist - - /usr/local/pkg/ - 0755 - https://packages.pfsense.org/packages/config/dnsblacklist/dnsblacklist.xml - - - /usr/local/pkg/ - 0755 - https://packages.pfsense.org/packages/config/dnsblacklist/dnsblacklist.inc - - - /tmp/ - 0755 - https://packages.pfsense.org/packages/config/dnsblacklist/dnsblacklist.tmp - - - /tmp/ - 0755 - https://files.pfsense.org/packages/blacklists.tar.gz - - - - Variable One - var1 - Enter the variable one here. - input - - - Variable Two - var1 - Enter the variable one here. - input - - - - - - dnsblacklist_sync_package(); - - - dnsblacklist_sync_package(); - - - dnsblacklist_install_command(); - - - dnsblacklist_deinstall_command(); - -
\ No newline at end of file -- cgit v1.2.3