DnsServer icon indicating copy to clipboard operation
DnsServer copied to clipboard

[Enhancement] Add note/comment to Allow/Block/etc.

Open scottcopus opened this issue 2 years ago • 7 comments

[Enhancement / Feature Request] Ability to add/edit/delete a note/comment to areas like Allow/Block or other areas.

scottcopus avatar Aug 07 '23 14:08 scottcopus

Thanks for the feature request. Will try to add it.

ShreyasZare avatar Aug 08 '23 07:08 ShreyasZare

Hi @ShreyasZare and happy new year! I would also like to vote for this feature request, since it's hard to follow a longer custom block and allow list without comments.

Maybe it would be possible to add a comment per line in the exported file that which can be imported afterwards? Like: www.google.com # This blocks a Google Domain

Also it could be useful to comment at any line, so a comment could be written for multiple domains. I guess this wouldn't work for for now since when a text file is imported it's alphabetically sorted. Maybe instead the sorting could be disabled? #### The next three domains are blocked #### www.tracking1.com www.tracking2.com www.tracking3.com

Just some ideas, for sure it's up to you how it's going to be implemented. I just have to say that editing the text file is much more easy than clicking through multiple sub-menus on the WebUI, that's why I export and import my custom lists for any change. Maybe a view of the text files via WebUI could be useful (similar to AdguardHome) where all domains are shown and an entry could be added at any line.

brokoler avatar Jan 08 '24 22:01 brokoler

Hi @ShreyasZare and happy new year! I would also like to vote for this feature request, since it's hard to follow a longer custom block and allow list without comments.

Maybe it would be possible to add a comment per line in the exported file that which can be imported afterwards? Like: www.google.com # This blocks a Google Domain

Also it could be useful to comment at any line, so a comment could be written for multiple domains. I guess this wouldn't work for for now since when a text file is imported it's alphabetically sorted. Maybe instead the sorting could be disabled? #### The next three domains are blocked #### www.tracking1.com www.tracking2.com www.tracking3.com

Just some ideas, for sure it's up to you how it's going to be implemented. I just have to say that editing the text file is much more easy than clicking through multiple sub-menus on the WebUI, that's why I export and import my custom lists for any change. Maybe a view of the text files via WebUI could be useful (similar to AdguardHome) where all domains are shown and an entry could be added at any line.

Happy new year to you too. It may take a while for this feature to be available since the data for those Allow and Block features are stored in a tree data structure and are not text files.

If you are comfortable with using local files then I would recommend that you maintain a local file with the domain name and use # char for comments and then use the local file's path as the URL for block list in the Settings > Blocking section.

Note that the URL path for the local file must use the file:// scheme. For example, on Linux the URL should look like file:///home/folder/myblocklist.txt and on Windows it should look like file:///c:/folder/myblocklist.txt.

ShreyasZare avatar Jan 09 '24 07:01 ShreyasZare

@ShreyasZare I'm trying to set things up via Docker, and my compose file has this

volumes:
  ...
  - ${PWD}/technitium/whitelist.txt:/home/whitelist.txt:ro

I then add !file:///home/whitelist.txt in the Allow / Block List URLs section. It says it's added successfully after I save, but when I look at the logs I see

[2024-01-26 11:14:46 Local] DNS Server is reading allow list from: file:///home/whitelist.txt
[2024-01-26 11:14:46 Local] DNS Server failed to read allow list from: file:///home/whitelist.txt
System.IO.FileNotFoundException: Could not find file '/etc/dns/blocklists/66e03d3a9785c0813c4cda6acbac21bdf48d2d776c83ee1995d5145c87451aeb'.
File name: '/etc/dns/blocklists/66e03d3a9785c0813c4cda6acbac21bdf48d2d776c83ee1995d5145c87451aeb'
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode, Func`4 createOpenException)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Func`4 createOpenException)
   at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at DnsServerCore.Dns.ZoneManagers.BlockListZoneManager.ReadListFile(Uri listUrl, Boolean isAllowList, Queue`1& exceptionDomains) in Z:\Technitium\Projects\DnsServer\DnsServerCore\Dns\ZoneManagers\BlockListZoneManager.cs:line 124

so it obviously did not load successfully.


Things I've tried:

  • Added 777 permissions to the file.
  • Tried mapping the file to different paths.
  • Removed :ro from the mapping.

I've tried multiple paths, and the file schema hasn't worked for me. The only thing that did work was

volumes:
  ...
  - ${PWD}/technitium/whitelist.txt:/opt/technitium/dns/www/whitelist.txt:ro

and referencing it via !http://localhost:5380/whitelist.txt.


Haven't found any examples of utilizing a local file, just files from the web. Does using the file schema still work? If so, can you provide a verified example?

the0neWhoKnocks avatar Jan 26 '24 19:01 the0neWhoKnocks

@the0neWhoKnocks Yes, the file schema works. Its tested on Windows and Linux but not tested with Docker though. I would suggest to check if you can open the file from within the docker container using vi. If its opening with vi then it should work with DNS server too. Let me know how this test goes.

ShreyasZare avatar Jan 27 '24 05:01 ShreyasZare

Hi @ShreyasZare and happy new year! I would also like to vote for this feature request, since it's hard to follow a longer custom block and allow list without comments. Maybe it would be possible to add a comment per line in the exported file that which can be imported afterwards? Like: www.google.com # This blocks a Google Domain Also it could be useful to comment at any line, so a comment could be written for multiple domains. I guess this wouldn't work for for now since when a text file is imported it's alphabetically sorted. Maybe instead the sorting could be disabled? #### The next three domains are blocked #### www.tracking1.com www.tracking2.com www.tracking3.com Just some ideas, for sure it's up to you how it's going to be implemented. I just have to say that editing the text file is much more easy than clicking through multiple sub-menus on the WebUI, that's why I export and import my custom lists for any change. Maybe a view of the text files via WebUI could be useful (similar to AdguardHome) where all domains are shown and an entry could be added at any line.

Happy new year to you too. It may take a while for this feature to be available since the data for those Allow and Block features are stored in a tree data structure and are not text files.

If you are comfortable with using local files then I would recommend that you maintain a local file with the domain name and use # char for comments and then use the local file's path as the URL for block list in the Settings > Blocking section.

Note that the URL path for the local file must use the file:// scheme. For example, on Linux the URL should look like file:///home/folder/myblocklist.txt and on Windows it should look like file:///c:/folder/myblocklist.txt.

Keeping local files up to date does sound a little complicated for me in the long run I guess.

What I'm missing on the WebUI is an option to categorize related domains and add a comment for each domain / for a block of domains on the Allow and Block list.

I have whitelisted and blocked around 200 custom domains in summary, when exporting the these the entries are listed in alphabetical order with all other domains added. Just a little hard to keep track on this and understand for which purpose which domain was allowed or blocked after a few months.

Right now I'm making some local notes, but it would be a welcome change to have this information directly in Technitium and if the comments would be part of the import / export of the custom lists.

I understand the problem though, that it might not be that easy to implement based on the actual structure.

brokoler avatar Jan 27 '24 09:01 brokoler

Keeping local files up to date does sound a little complicated for me in the long run I guess.

What I'm missing on the WebUI is an option to categorize related domains and add a comment for each domain / for a block of domains on the Allow and Block list.

I have whitelisted and blocked around 200 custom domains in summary, when exporting the these the entries are listed in alphabetical order with all other domains added. Just a little hard to keep track on this and understand for which purpose which domain was allowed or blocked after a few months.

Right now I'm making some local notes, but it would be a welcome change to have this information directly in Technitium and if the comments would be part of the import / export of the custom lists.

I understand the problem though, that it might not be that easy to implement based on the actual structure.

@brokoler Yes, having built-in support for comments will be useful to maintain lists. The current view is actually a way to browse the tree structure similar to how you browse files on disk. The records does support comments since its the same record objects that are used in Zones but the GUI needs to have some option to edit them.

ShreyasZare avatar Jan 27 '24 09:01 ShreyasZare