AdGuardHome icon indicating copy to clipboard operation
AdGuardHome copied to clipboard

Temporarily disable with API (and via UI)

Open stuartshapiro opened this issue 6 years ago • 41 comments

In order to make this work, we need to change how the "Disable protection" button looks like.

Use the same approach as for the "Block" button in the Query Log: image

There's a fixed list of options that can be used:

  • Pause for 30 seconds
  • Pause for 1 minute
  • Pause for 10 minutes
  • Pause for 1 hour
  • Pause until tomorrow

When the protection is paused temporarily, "Enable protection" button becomes a countdown: image

Original feature request text (replaced by @ameshkov)

Hello -- I'm trying to figure out if there's a way to disable AdGuard Home temporarily within the API. For example, Pi-hole allows disabling for some number of seconds through theirs (http://pi.hole/admin/api.php?disable=300). Unless I'm missing something, I've only figured out how to switch on vs off or make a script that switches it off, sleeps for a certain number of seconds, and then switches it back on.

Thanks!

stuartshapiro avatar Jan 05 '20 19:01 stuartshapiro

Yeah, there's no such API method at the moment, start-sleep-stop is the only way.

ameshkov avatar Jan 06 '20 19:01 ameshkov

Thanks!

stuartshapiro avatar Jan 06 '20 23:01 stuartshapiro

Can we close this issue? I doubt that we really need a new API method to temporarily disable the filtering.

szolin avatar Jan 29 '20 11:01 szolin

It depends on the users. If there will be upvotes, we'll consider it.

Generally, I'd better keep all feature requests open until we are 100% sure that we won't do it.

ameshkov avatar Jan 29 '20 11:01 ameshkov

i would like to see this feature too!

Klizzy avatar Feb 06 '20 22:02 Klizzy

I'd like this feature too

lolgast1987 avatar Apr 17 '20 08:04 lolgast1987

I would really like this feature too. The scenario is like this: I can easily turn on/off AdGuard Home from the web interface, but my wife/kids are not so technical. I could then just make a shortcut on their iphone to turn off the filtering for a short time (say 5 minutes) to test if AdGuard is blocking the website they want to visit. What do you think?

SwissOS avatar Apr 29 '20 09:04 SwissOS

Guys, please add upvotes then (upvote reaction on the issue)

ameshkov avatar Apr 29 '20 09:04 ameshkov

Alternative UI solution https://github.com/AdguardTeam/AdGuardHome/issues/997 https://github.com/AdguardTeam/AdGuardHome/issues/1203 https://github.com/AdguardTeam/AdGuardHome/issues/1450

but my wife/kids are not so technical.

@danielp123 I understand but you may able to create account for them and add a timed allow list with single rule to unblock all domains for 5min. In this cause; i'm not prefer to see AGH become too simple tool.

Aikatsui avatar Apr 30 '20 06:04 Aikatsui

@ameshkov Along with this feature request to temporarily disable filtering via API, and a good reason for making this feature, would be to integrate this "Temporarily disable AdGuard Home DNS filtering protection" API feature into AdGuard for Windows, AdGuard browser extensions, etc.

I am a long time user of AdGuard for Windows. Quite often, I have to temporarily disable the AGH DNS filtering because it causes problems on kids iPad games and certain things that other users may need to do from time to time.

This may be a tricky request though, in that regard.

WildByDesign avatar May 01 '20 13:05 WildByDesign

@ameshkov – I know this issue has gone to a bunch of different places, but I've been using:

curl -X POST "http://[URL]/control/dns_config" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"protection_enabled\": false}"

to enable and disable filtering. Unfortunately, I've noticed that even though filtering is now disabled, the domain is cached as blocked so you have to wait for the cache to clear before the domain will work again. Is this a separate issue that I should file or is there a different API call to turn AdGuard Home off?

Thanks for everything, it's a great piece of software.

stuartshapiro avatar May 01 '20 17:05 stuartshapiro

domain is cached as blocked

@shapiro125 Do you mean browser's cache? Please try requesting the host name via nslookup or dig - what are the results?

szolin avatar May 06 '20 12:05 szolin

@szolin – dig is showing it correctly each time, it appears to be a browser cache issue. If the request is blocked, my browser will continue to block it even after disable adguard. Once it's disabled, the browser will still resolve the domain even after adguard is re-enabled.

I know it's working as expected (according to the dig results), so don't know what to do about it. I'm coming from Pi-hole, where their disable seemed to work instantly in browser without cache problems. Thanks!

stuartshapiro avatar May 08 '20 00:05 stuartshapiro

. I'm coming from Pi-hole, where their disable seemed to work instantly in browser without cache problems

Maybe they just set small TTL values. You may set cache_ttl_max: 10 in AGH yaml config, and your browser will "forget" it after 10 seconds.

szolin avatar May 08 '20 08:05 szolin

@szolin you mean blocked_response_ttl?

ameshkov avatar May 08 '20 08:05 ameshkov

or blocked_response_ttl, yes Note: cache_ttl_max is available only in beta

szolin avatar May 08 '20 08:05 szolin

Oh, interesting. I noticed blocked_response_ttl is set for 10 seconds and, yup, disabling and waiting 10 seconds works.

What are the performance implications for making that shorter?

stuartshapiro avatar May 11 '20 19:05 stuartshapiro

What are the performance implications for making that shorter?

Your devices will make DNS queries for blocked resources more often. Tbh, there are no really serious performance implications, especially if we're talking about AGH that's hosted in the local network and not on some public server.

ameshkov avatar May 11 '20 21:05 ameshkov

I'd love this too. Just noticed that Adguard was disabled for the past day or so because I had forgotten to re-enable it. It would be great to have an option in the UI as well.

hoshsadiq avatar Jun 29 '20 20:06 hoshsadiq

@hoshsadiq #1879

Aikatsui avatar Jul 13 '20 06:07 Aikatsui