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

Teleporter import adds "default" to all domainlist_by_group.json entries. #3020

Open
djadair opened this issue May 9, 2024 · 0 comments
Open

Comments

@djadair
Copy link

djadair commented May 9, 2024

Versions

  • Pi-hole version is v5.18.2 (Latest: v5.18.2)
  • web version is v5.21 (Latest: v5.21)
  • FTL version is v5.25.2 (Latest: v5.25.2)

Platform

  • OS and version: Photon 5.0
  • Platform: esxi / docker

Expected behavior

Create new pihole docker instance and import teleporter file from existing instance.
All black/white list domains should be assigned to proper groups.

Actual behavior / bug

Each whitelist domain is assigned to "Default" as well as the desired group.
See: Reddit thread

Steps to reproduce

Steps to reproduce the behavior:

  1. Stop pihole docker container.
  2. Remove all existing config
  3. Start container.
  4. Load transporter file that contains both whitelists and multiple groups.
  5. Each whitelist will be a member of both "Default" and groups specified in json file.

Debug Token

Screenshots

Additional context

Work-around seems to be to load the transporter file twice.

Debug log includes diff of transporter.php that corrected the issue. By processing the domainlist_by_group.json file LAST the group membership works properly.

root@photon-5 [ ~ ]# diff -Naur teleporter.orig teleporter.php
--- teleporter.orig     2024-05-08 20:07:55.000000000 +0000
+++ teleporter.php      2024-05-09 02:45:02.254828282 +0000
@@ -451,14 +451,6 @@
                 $importedsomething = true;
             }

-            if ((isset($_POST['whitelist']) || isset($_POST['regex_whitelist'])
-                || isset($_POST['blacklist']) || isset($_POST['regex_blacklist']))
-                && $file->getFilename() === 'domainlist_by_group.json') {
-                $num = archive_restore_table($file, 'domainlist_by_group', $flushtables);
-                echo 'Processed black-/whitelist group assignments ('.$num.noun($num).")<br>\n";
-                $importedsomething = true;
-            }
-
             if (isset($_POST['adlist']) && $file->getFilename() === 'adlist_by_group.json') {
                 $num = archive_restore_table($file, 'adlist_by_group', $flushtables);
                 echo 'Processed adlist group assignments ('.$num.noun($num).")<br>\n";
@@ -550,6 +542,18 @@
             }
         }

+        foreach (new RecursiveIteratorIterator($archive) as $file) {
+
+            if ((isset($_POST['whitelist']) || isset($_POST['regex_whitelist'])
+                || isset($_POST['blacklist']) || isset($_POST['regex_blacklist']))
+                && $file->getFilename() === 'domainlist_by_group.json') {
+                $num = archive_restore_table($file, 'domainlist_by_group', $flushtables);
+                echo 'Processed black-/whitelist group assignments ('.$num.noun($num).")<br>\n";
+                $importedsomething = true;
+            }
+
+       }
+
         // do we need a full restart of Pi-hole or reloading the lists?
         if ($fullpiholerestart) {
             pihole_execute('restartdns');
@djadair djadair changed the title Transporter import adds "default" to all domainlist_by_group.json entries. Teleporter import adds "default" to all domainlist_by_group.json entries. May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant