Unbound redirect to a picture



  • hi

    i am using unbound (Thx to the Dev's) to block some bad domains like ads.com

    i am using the redirect rules to directing the query to 127.0.0.1

    local-zone: "ads.com" redirect
    local-data: "ads.com A 127.0.0.1"
    

    everything works so far great but in the browser
    now it looks ugly if your on a page with frames and inside there is 404not found messages.

    is there any way to display just a white 1x1px image, and not 404notfound mesages, or so without putting any webserver aditional to pfsense?

    regards



  • strange….

    my new redirecting test:

    local-zone: "ads.com" redirect
    local-data: "ads.com A 127.0.0.1/1x1.gif"
    

    or

    local-zone: "ads.com" redirect
    local-data: "ads.com A https://127.0.0.1/1x1.gif"
    

    i tried to redirect it to another host but the i cant start unbound cause the logs of unbound pints out this:

    Mar  7 21:52:19 pfsense unbound: [57058:0] error: Bad local-data RR ads.com A 127.0.0.1/1x1.gif
    Mar  7 21:52:19 pfsense unbound: [57058:0] fatal error: Could not set up local zones
    Mar  7 21:52:25 pfsense unbound: [73875:0] warning: did not exit gracefully last time (57058)
    Mar  7 21:52:25 pfsense unbound: [73994:0] error: error parsing local-data 'ads.com A https://127.0.0.1/1x1.gif': Syntax error, could not parse the RR's rdata
    

    any idea how to redirect to http(s)://host/image.gif ?

    regards


  • Banned

    OMG. This is a DNS server. You need to set up a webserver to serve 1x1.gif as default (index) page, not stick whacky invalid stuff into DNS server A records!

    P.S. On that note, 127.0.0.1 is not a good choice for this purpose since you'd obviously have to have the webserver running on all the client machines.


  • LAYER 8 Global Moderator

    While its not a issue redirecting say anything.ads.com to some webserver.  if your just hitting say http://something.ads.com/ your webserver could serve up default page say index.html that only has a 1x1.jpg or something.

    What about if the url is say https://something.ads.com/somepath/dir/ad.html ?  Since this does not exist on whatever webserver you point to your webserver would normally return 404, and your browser might bark that the SSL on the https isn't trusted.  So you would need to make sure your browsers trust whatever ssl cert your using..

    Its normally easier to just run a ad blocking addon in your browser to block ads.  Or just have your dns not return anything vs redirecting to something else.


  • Rebel Alliance Developer Netgate

    @johnpoz:

    What about if the url is say https://something.ads.com/somepath/dir/ad.html ?  Since this does not exist on whatever webserver you point to your webserver would normally return 404, and your browser might bark that the SSL on the https isn't trusted.  So you would need to make sure your browsers trust whatever ssl cert your using..

    That's still up to the web server. It's quite easy in Apache to have it answer any request with a specific file via mod_rewrite or similar. Other web server software probably has a similar mechanism. Beyond the scope of the forum here, but it turns up easy in a google search, or just look at what CMS packages like Wordpress use in their .htaccess files.


Log in to reply