Akkadius / glass-isc-dhcp

Glass - ISC DHCP Server Interface
MIT License
704 stars 144 forks source link

Empty statistics #21

Open gbomacfly opened 6 years ago

gbomacfly commented 6 years ago

Hello,

I followed your installation instructions, except for nodejs, because I had this already:

root > /opt/glass-isc-dhcp # node -v
v8.11.4

Everything went fine, the files in the options are the correct ones (double checked), but in the webpanel everything is at value zero. my subnet is shown correctly, but there is nothing in the statistics (No data available in table)

I'm on Debian latest (Linux gboslave 4.9.0-7-amd64 #1 SMP Debian 4.9.110-3+deb9u2 (2018-08-13) x86_64 GNU/Linux)

Have I done something wrong? Thank you in advance!

Here are the configuration files and more info:

root > /opt/glass-isc-dhcp # dhcpd --version
isc-dhcpd-4.3.5

root > /opt/glass-isc-dhcp # cat config/glass_config.json 
{
  "admin_user": "xxx",
  "admin_password": "xxx",
  "leases_file": "/var/lib/dhcp/dhcpd.leases",
  "log_file": "/var/log/dhcpd.log",
  "config_file": "/etc/dhcp/dhcpd.conf",
  "shared_network_critical_threshold": "95",
  "shared_network_warning_threshold": "0",
  "slack_webhook_url": "",
  "slack_alert_channel": "",
  "leases_per_minute_threshold": "50",
  "ip_ranges_to_allow": [
    ""
  ],
  "email_alert_to": "",
  "sms_alert_to": "",
  "ws_port": 8080
}
root > /opt/glass-isc-dhcp # cat /etc/dhcp/dhcpd.conf 
authoritative;
log-facility local7;
get-lease-hostnames true;
option domain-name "local";
option domain-name-servers 192.168.178.2, 192.168.178.1;
ping-check true;
next-server 192.168.178.2;

default-lease-time 600;
max-lease-time 7200;

subnet 192.168.178.0 netmask 255.255.255.0 {
        range 192.168.178.100 192.168.178.199;
        option broadcast-address 192.168.178.255;
        option subnet-mask 255.255.255.0;
        option routers 192.168.178.1;
}
host gboslave {
        hardware ethernet 70:45:D2:19:4E:4B;
        fixed-address 192.168.178.2;
        option host-name "gboslave";
}

--- and about 40 other fixed-ip hosts

I'm starting like:

root > /opt/glass-isc-dhcp # npm start

> dhcpd-glass@0.0.0 start /opt/glass-isc-dhcp
> node ./bin/www

[Glass Server] Watching leases file '/var/lib/dhcp/dhcpd.leases'
[Glass Server] Config watcher initialized
[Glass Server] DHCP log watcher initialized
[Glass Server] Websocket server starting on port: 8080
[Glass Server] Bootup complete
[Glass Server] Leases file loaded
[Glass Server] OUI Database Loaded
Akkadius commented 6 years ago

Hey @gbomacfly !

One thing I would check is if you can open your (debug) network tab in your browser to see if you see any errors in console or the network tab and report them here.

If you could shoot a screenshot of what you see and then do you have active leases/devices being picked up by Glass? Let me know

gbomacfly commented 6 years ago

Hi @Akkadius first, thanks for your help. In the network tab seems all ok. Bit inthe console tab are many errors about

Uncaught ReferenceError: socket is not defined and Mixed Content: The page at 'https://sub.domain.de/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://sub.domain.de:8080/'. This request has been blocked; this endpoint must be available over WSS.

OK, my Apache2 serves the page via a proxy, I think there is the error

root > /opt/glass-isc-dhcp # cat /etc/apache2/sites-enabled/05_sub.domain.de.conf 
<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerName sub.domain.de

    ServerAdmin macfly@german-bash.org
    DocumentRoot /var/www/dns/htdocs

    ErrorLog /var/www/dns/logs/error.log
    CustomLog /var/www/dns/logs/access.log combined

    SSLCertificateFile /etc/letsencrypt/live/domain.de/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/domain.de/privkey.pem

    Include /etc/letsencrypt/options-ssl-apache.conf

    ProxyVia Off
    ProxyPreserveHost On
    ProxyRequests off
    ProxyPass / http://127.0.0.1:3000/
    ProxyPassReverse / http://127.0.0.1:3000/

    <Proxy *>
        AuthType Basic
        AuthName "Willkommen bei ISC DHCP!"
        AuthUserFile /var/www/htpasswd
        Require valid-user
        Order deny,allow
        Allow from all
    </Proxy>
</VirtualHost>
</IfModule>

I'll go searching about WSS...

Akkadius commented 6 years ago

Yeah the websocket connection for realtime data streaming operates on 8080, this is recently configurable. It looks like if you want to proxy websockets this is doable as well with an apache extension

https://httpd.apache.org/docs/2.4/mod/mod_proxy_wstunnel.html

gbomacfly commented 6 years ago

Thanks for your help!

OK, thats a new terrain for me. I tried now:

a2enmod proxy_wstunnel

Then I added the following lines in the config: ProxyPass "/" "ws://sub.domain.de/"

and restarted apache.

The Problem remains the same, but the ws-error is gone.

Log shows me:

Uncaught ReferenceError: socket is not defined at websockets_subscribe_event (glass-websockets.js:11) at handle_websocket_subscription_navigation (glass-core.js:112) at HTMLDocument. (glass-core.js:70) at HTMLDocument.dispatch (jquery.min.js:3) at HTMLDocument.r.handle (jquery.min.js:3) at Object.trigger (jquery.min.js:3) at HTMLDocument. (jquery.min.js:3) at Function.each (jquery.min.js:2) at n.fn.init.each (jquery.min.js:2) at n.fn.init.trigger (jquery.min.js:3) and

Uncaught ReferenceError: socket is not defined at check_websocket_connection (glass-websockets.js:4) at glass-websockets.js:66

gbomacfly commented 6 years ago

OK, there was a shield in the Chrome adressbar, asking for insecure connections. I accepted, but it still gives me errors:

WebSocket connection to 'ws://subdomain.domain.de:8080/' failed: Error in connection establishment: net::ERR_CONNECTION_CLOSED

Mixed Content: The page at '' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws:/'. This endpoint should be available via WSS. Insecure access is deprecated. Connecting to a non-secure WebSocket server from a secure origin is deprecated.

I have this line in my apacheconfig, but I think this is not correct: ProxyPass "/" ws://subdomain.domain.de:8080

I should switch to wss, right? How can I add this feature?