Hi all,
I'm using dnsmasq to create an ad/media blocker. Whenever it receives a request for any listed domain I want to return a specific IP that points to a dummy webserver. That part works.
It's the dummy webserver that has me stumped. I'd like it to return 0 bytes, status 200 for every connection to port 80.
nc seems like a good candidate but I can't get it right.
Anybody have a nc one-liner or other alternative that would accomplish this?
Thanks for any ideas, Mike Wright
On Sat, 2022-12-03 at 13:40 -0800, Mike Wright wrote:
I'm using dnsmasq to create an ad/media blocker. Whenever it receives a request for any listed domain I want to return a specific IP that points to a dummy webserver. That part works.
It's the dummy webserver that has me stumped. I'd like it to return 0 bytes, status 200 for every connection to port 80.
I took the approach (using BIND) to return a null result (domain doesn't exist) for banned advert sources.
On 3 Dec 2022, at 21:40, Mike Wright nobody@nospam.hostisimo.com wrote:
Hi all,
I'm using dnsmasq to create an ad/media blocker. Whenever it receives a request for any listed domain I want to return a specific IP that points to a dummy webserver. That part works.
It's the dummy webserver that has me stumped. I'd like it to return 0 bytes, status 200 for every connection to port 80.
nc seems like a good candidate but I can't get it right.
Anybody have a nc one-liner or other alternative that would accomplish this?
I Use apache httpd, its very low over head to serve static content. From memory I recall it used approx. 100k bytes of memory.
Barry
Thanks for any ideas, Mike Wright _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
Mike,
ruby -run -e httpd . -p 5000
P.
On 2022-12-04 21:01, Barry wrote:
On 3 Dec 2022, at 21:40, Mike Wright nobody@nospam.hostisimo.com wrote:
Hi all,
I'm using dnsmasq to create an ad/media blocker. Whenever it receives a request for any listed domain I want to return a specific IP that points to a dummy webserver. That part works.
It's the dummy webserver that has me stumped. I'd like it to return 0 bytes, status 200 for every connection to port 80.
nc seems like a good candidate but I can't get it right.
Anybody have a nc one-liner or other alternative that would accomplish this?
I Use apache httpd, its very low over head to serve static content. From memory I recall it used approx. 100k bytes of memory.
Barry
Thanks for any ideas, Mike Wright _______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
On Sat, 2022-12-03 at 13:40 -0800, Mike Wright wrote:
It's the dummy webserver that has me stumped. I'd like it to return 0 bytes, status 200 for every connection to port 80.
You mightn't need to have a webserver pretend to answer their queries, my approach of using a domain doesn't exist DNS response works well for me. Web browsers instantly failed to do anything related to the advert, and carried on doing everything else that they could.
If you do want a webserver to respond in some way, it doesn't necessary have to be a 200 response. You could have a 0 byte 404 response, that should work just as effectively, and be easy to implement it.
I tried that long ago, just having the webserver respond to any access directed to it, and they'd always get a 404 as they'd never be requesting anything it had.
But for me it didn't prove to be any advantage over the domain blocking, other than the logs satisfying my curiosity about what had been going on (or failing to go on, so to speak).
On 12/4/22 03:33, Tim via users wrote:
On Sat, 2022-12-03 at 13:40 -0800, Mike Wright wrote:
It's the dummy webserver that has me stumped. I'd like it to return 0 bytes, status 200 for every connection to port 80.
You mightn't need to have a webserver pretend to answer their queries, my approach of using a domain doesn't exist DNS response works well for me. Web browsers instantly failed to do anything related to the advert, and carried on doing everything else that they could.
If you do want a webserver to respond in some way, it doesn't necessary have to be a 200 response. You could have a 0 byte 404 response, that should work just as effectively, and be easy to implement it.
I tried that long ago, just having the webserver respond to any access directed to it, and they'd always get a 404 as they'd never be requesting anything it had.
But for me it didn't prove to be any advantage over the domain blocking, other than the logs satisfying my curiosity about what had been going on (or failing to go on, so to speak).
Thanks Tim,
I'd tried that approach before but it left me with 404 errors splattered across web pages. Probably as annoying as the ads they replaced.
On Sun, 2022-12-04 at 08:50 -0800, Mike Wright wrote:
I'd tried that approach before but it left me with 404 errors splattered across web pages. Probably as annoying as the ads they replaced.
Zero pixel transparent gif as the webserver's 404 page.
But my other approach (domain doesn't exist) produces no visible artefacts and doesn't need a webserver.
On Sat, Dec 3, 2022 at 4:41 PM Mike Wright nobody@nospam.hostisimo.com wrote:
Anybody have a nc one-liner or other alternative that would accomplish this?
Some of my best projects started out as a one-liner. ;)
I'm using Pihole now. It acts as a DNS and returns 0.0.0.0 as the address . What if you set dnsmasq to do this with no web server needed?