pi-hole / web

Pi-hole Dashboard for stats and more
https://pi-hole.net
Other
2.02k stars 560 forks source link

List all clients from UI #679

Closed DL6ER closed 6 years ago

DL6ER commented 6 years ago

@borpin commented on Fri Feb 02 2018

In raising this issue, I confirm the following (please check boxes, eg [X]) Failure to fill the template will close your issue:

How familiar are you with the codebase?:

1


[ISSUE] Expected Behaviour: It would be useful to be able to list all clients that are requesting DNS lookup through Pi-hole not just Top 10. It would show if a particular client was configured to use Pi-hole correctly as well as looking for rouge clients.

My C is not great but looking at the code I believe https://github.com/pi-hole/FTL/blob/master/request.c#L457 is where this lookup is handled.

If the function was made more general to include the 'count' as a parameter, it looks as if the function could be made more general (even offer a UI to display more items) or simply use 0 to display all clients in the logs.

This template was created based on the work of udemy-dl.

DL6ER commented 6 years ago

I moved this issue as this is already available from FTL, so it is no issue there:

>top-clients (50)

will show up to 50 clients. This is described in the README of FTL.

It is also already available through our API, e.g.: http://pi.hole/admin/api.php?topClients=90

There are just no settings for the number of shown entries on the dashboard.

borpin commented 6 years ago

Excellent, thanks. That API call will give me what I want. Would still suggest it as enhancement to the UI.

DL6ER commented 6 years ago

The dashboard is complete re-engineered at this time. We might get a chance to look into this. @Mcat12

I'll close this as your issue got resolved and we don't discuss feature requests here.

AzureMarker commented 6 years ago

I've been thinking about how to support these web interface-side configuration changes. We could shove them in setupVars.conf, but that's might not be the best place. We could also store them in cookies, but then that would be browser specific. We could try storing them in an API config file?

DL6ER commented 6 years ago

Yes, saving stuff in setupVars.conf grew organically and kind of escalated. We should clearly separate this.

dschaper commented 6 years ago

If you do make a new config, let's start it out with some structured format, the setupVars is kind of a pain to deal with since it's freeform text and not something a little easier to parse. No real preference on the language used but something that either is declarative key/value with a list of known keys or structured json/yaml/whatever. Looking at setupVars and trying to migrate it to a structure is a lot of code.

PromoFaux commented 6 years ago

What about something like this?

{
    "API": {
        "API_GET_UPSTREAM_DNS_HOSTNAME": true,
        "API_GET_CLIENT_HOSTNAME": true,
        "API_EXCLUDE_DOMAINS": false,
        "API_EXCLUDE_CLIENTS": false,
        "API_QUERY_LOG_SHOW": "all",
        "API_PRIVACY_MODE": false
    },
    "DHCP":{
        "DHCP_ACTIVE": true,
        "DHCP_START": "192.168.0.50",
        "DHCP_END": "192.168.0.254",
        "DHCP_ROUTER": "192.168.0.1",
        "DHCP_LEASETIME": 24,
        "PIHOLE_DOMAIN": "local",
        "DHCP_IPv6": false    
    },
    "General":{
        "PIHOLE_INTERFACE": "eth0",
        "IPV4_ADDRESS": "192.168.0.2",
        "IPV6_ADDRESS": "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx",
        "DNSMASQ_LISTENING": "local",
        "UPSTREAM_DNS": ["8.8.8.8","8.8.4.4","2620:0:ccc::2","2620:0:ccd::2"],
        "DNS_FQDN_REQUIRED": true,
        "DNS_BOGUS_PRIV": true,
        "DNSSEC": false,
        "QUERY_LOGGING": true,
        "INSTALL_WEB": true,
        "LIGHTTPD_ENABLED": true
    },
    "Web":{
        "CUSTOMBLOCKPAGE":false,
        "TEMPERATUREUNIT": "C",
        "WEBUIBOXEDLAYOUT": "boxed" 
    }
}
PromoFaux commented 6 years ago

Or this:

---
API:
  API_GET_UPSTREAM_DNS_HOSTNAME: true
  API_GET_CLIENT_HOSTNAME: true
  API_EXCLUDE_DOMAINS: false
  API_EXCLUDE_CLIENTS: false
  API_QUERY_LOG_SHOW: all
  API_PRIVACY_MODE: false
DHCP:
  DHCP_ACTIVE: true
  DHCP_START: 192.168.0.50
  DHCP_END: 192.168.0.254
  DHCP_ROUTER: 192.168.0.1
  DHCP_LEASETIME: 24
  PIHOLE_DOMAIN: local
  DHCP_IPv6: false
General:
  PIHOLE_INTERFACE: eth0
  IPV4_ADDRESS: 192.168.0.2
  IPV6_ADDRESS: xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx
  DNSMASQ_LISTENING: local
  UPSTREAM_DNS:
  - 8.8.8.8
  - 8.8.4.4
  - 2620:0:ccc::2
  - 2620:0:ccd::2
  DNS_FQDN_REQUIRED: true
  DNS_BOGUS_PRIV: true
  DNSSEC: false
  QUERY_LOGGING: true
  INSTALL_WEB: true
  LIGHTTPD_ENABLED: true
Web:
  CUSTOMBLOCKPAGE: false
  TEMPERATUREUNIT: C
  WEBUIBOXEDLAYOUT: boxed
AzureMarker commented 6 years ago

More user-friendly (TOML):

[API]
exclude_clients = false
exclude_domains = false
get_client_hostname = true
get_upstream_dns_hostname = true
privacy_mode = false
query_log_show = "all"

[DHCP]
active = true
start_ip = "192.168.0.50"
end_ip = "192.168.0.254"
ipv6 = false
lease_time = 24
router_ip = "192.168.0.1"
local_domain = "local"

[General]
dnsmasq_listening = "local"
dnssec = false
dns_bogus_priv = true
dns_fqdn_required = true
ipv4_address = "192.168.0.2"
ipv6_address = "xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx"
blocking_interface = "eth0"
query_logging = true
upstream_dns = [
  "8.8.8.8",
  "8.8.4.4",
  "2620:0:ccc::2",
  "2620:0:ccd::2"
]

[Web]
installed = true
web_server = true
custom_block_page = false
temperature_unit = "C"
web_layout = "boxed"