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

Loading filters into opensnitch #298

Closed
BullShark opened this issue Aug 22, 2020 · 10 comments
Closed

Loading filters into opensnitch #298

BullShark opened this issue Aug 22, 2020 · 10 comments
Labels
feature a whole new feature
Milestone

Comments

@BullShark
Copy link

How can I load these filters into opensnitch?

https://github.com/AdguardTeam/AdguardFilters

@xenDE
Copy link
Contributor

xenDE commented Aug 22, 2020

Your link has DNS blacklist and Content Filter Lists for HTML.
Use an Adblocker, not a firewall.

@BullShark
Copy link
Author

An adblocker doesn't usually block all traffic, just the browser. You mean use my own dns server?

@xenDE
Copy link
Contributor

xenDE commented Aug 22, 2020

It's DNS Blocking.

Your Link is from the https://adguard.com/ project.
https://pi-hole.net/ is another DNS Blocking project.

both you can install on your own server, for example, a cheap raspberry pi.

@BullShark
Copy link
Author

I have a dedicated Linux vps. And I've been reading up on the different dns servers available. Bind is the known good one for Linux, but I don't think it supports all the encryption stuff. Also I'm looking into CoreDNS, Adguard. dnscrypt-proxy encrypted all of my dns even though my system doesn't support doh yet. It has great filtering, and the logging that can be turned on makes it easy to see what needs to be allowed and denied. I'm probably going to still need the dnscrypt-proxy to connect to my own server instead of public available servers because my system doesn't support the doh yet. But for filtering, it has some presets, and it's very good, dns with wildcards and ip blocking both.

@xenDE
Copy link
Contributor

xenDE commented Aug 23, 2020

use local unbound, adguard, gustavo-iniguez-goya/opensnitch what ever you want to achieve.

please close this issue, its not an opensnitch related problem.

@gustavo-iniguez-goya
Copy link
Collaborator

gustavo-iniguez-goya commented Dec 11, 2020

I've been thinking lately in allow to load lists of suspicious/malware/ads IPs.

I think we could use lists like these ones: https://iplists.firehol.org/

But instead of creating new app rules (which would penalize performance a lot), we would have a section in the Rules tab, and the lists would be loaded into the kernel directly.

x

@gustavo-iniguez-goya
Copy link
Collaborator

gustavo-iniguez-goya commented Dec 19, 2020

I'm testing this feature, using lists from https://firebog.net/ (hosts format):

Loading blockfilter: /etc/opensnitchd/blocklists/domains/ads-and-tracking-extended.txt
domains loaded:  247650
Loading blockfilter: /etc/opensnitchd/blocklists/domains/adservers.txt
domains loaded:  341462
Loading blockfilter: /etc/opensnitchd/blocklists/domains/firstparty-trackers-hosts.txt
domains loaded:  397282
Loading blockfilter: /etc/opensnitchd/blocklists/domains/multiparty-trackers-hosts.txt
domains loaded:  408554
Loading blockfilter: /etc/opensnitchd/blocklists/domains/oisd.txt
domains loaded:  1351070
Loading blockfilter: /etc/opensnitchd/blocklists/domains/zzz-adaway-hosts.txt
domains loaded:  1351494

Total domains loaded:  1351494 Duplicated: 295552

some logs while running:

a.et.nytimes.com check took: 1.396µs
domain blocklisted:  a.et.nytimes.com 2
a.et.nytimes.com check took: 1.332µs
domain blocklisted:  a.et.nytimes.com 3
als-svc.nytimes.com check took: 1.44µs
domain blocklisted:  als-svc.nytimes.com 2
als-svc.nytimes.com check took: 1.296µs
domain blocklisted:  als-svc.nytimes.com 3
no: thumbor.forbes.com 1351494
no: thumbor.forbes.com 1351494
domain blocklisted:  geolocation.forbes.com 0
domain blocklisted:  geolocation.forbes.com 1

Pros:

  • It has almost no performance penalty in terms of speed
  • checking a domain costs less than 2µs.

Cons:

  • lists loaded on memory.
  • many applications are starting to use DoH, etc.
  • depending on what lists you load, you can break many sites.

I think this approach is much better than creating app rules with the ads script of the repository.

Would be useful?

@NRGLine4Sec
Copy link
Contributor

Yes it is useful, for example to block ads from Spotify.

Presently, I do it with some rules prefix by 000-deny-, but it could be definitively useful to do it with a list.

@gustavo-iniguez-goya gustavo-iniguez-goya added this to the 1.4.0 milestone Feb 11, 2021
gustavo-iniguez-goya added a commit that referenced this issue Feb 25, 2021
Initial support to filter connections using lists of domains.

The lists must be in hosts format:
- 0.0.0.0 www.domain.com
- 127.0.0.1 www.domain.com

From the rules editor, create a new rule, and select
[x] To this lists of domains

Select a directory with files in hosts format, select [x] Priority rule,
select [x] Deny and click on Apply.

An example of a list in hosts format:
https://www.github.developerdan.com/hosts/lists/ads-and-tracking-extended.txt

Note: you can also add a list of domains to allow, not only domains to
block.

TODOs:
- support for URLs besides directories (local lists).
- support for scheduled updates of the above URLs.

related #298
@gustavo-iniguez-goya
Copy link
Collaborator

Feature added, you can read more about it here:
26671de

basically create a new rule like described in the commit, create a directory where you want, and drop a list there:

$ mkdir ~/adslists/; cd ~/adslists/
$ wget https://www.github.developerdan.com/hosts/lists/ads-and-tracking-extended.txt

You can combine these lists with other fields, for example to limit a program to connect only to a certain list of domains.

If you can build it from sources and test it would be useful.

Also if you test it and have any extension to block ads using chrome/ium (uBlock origin or others), I'd interested to know if you see requests being blocked by opensnitch that in theory should be blocked by that extensions....

@gustavo-iniguez-goya
Copy link
Collaborator

All the instructions on how to use it have been added to the wiki: https://github.com/evilsocket/opensnitch/wiki/block-lists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a whole new feature
Projects
None yet
Development

No branches or pull requests

4 participants