• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Webserver client ip not correct
#1
Hello all!

After a failed SD card I now got my Raspberry pi 3 up and running raspbian stretch using the dev branch "5ea8fa5".

I'm having a problem with the whitelist function.
The daemon recognizes the clients that attempting to connect as from ip "0.0.0.0" and therefore ofcourse get rejected by my whitelist.

Have been scrolling through the commits on github but haven't found anything regarding this.

Haven't seen any post regarding this so it's most likely something with my setup.


Code:
[Aug 21 20:36:40:465482] pilight-daemon: INFO: rejected client, ip: 0.0.0.0, port: 55274
 
Reply
#2
Can you post your config?

What you are saying is that all clients get recognized as "0.0.0.0" instead of their real IP? And this happens for the webgui as well?
 
Reply
#3
Yes certainly, here it comes.

As for now my whitelist is just wildcards and then it works.
Running with -D a connecting client still shows up as 0.0.0.0.

Oh sorry, actually all clients I have for the moment are communicating through the webgui.

I maybe can wireshark the packets comming to my browser.
I don't know how packets with destination 0.0.0.0 are handled.



Code:
{
    "devices": {
        "KitchenWindow": {
            "protocol": [ "nexa_switch" ],
            "id": [{
                "id": 12507630,
                "unit": 3
            }],
            "state": "off"
        },
        "KitchenLED": {
            "protocol": [ "kaku_dimmer", "nexa_switch" ],
            "id": [{
                "id": 15485022,
                "unit": 1
            }],
            "state": "off",
            "dimlevel": 15,
            "dimlevel-minimum": 3
        },
        "BedroomWindow": {
            "protocol": [ "nexa_switch" ],
            "id": [{
                "id": 12507630,
                "unit": 5
            }],
            "state": "off"
        },
        "LivingroomCorner": {
            "protocol": [ "nexa_switch" ],
            "id": [{
                "id": 12507630,
                "unit": 6
            }],
            "state": "off"
        },
        "LivingroomWindow": {
            "protocol": [ "nexa_switch" ],
            "id": [{
                "id": 12507630,
                "unit": 7
            }],
            "state": "off"
        },
        "BedroomBig": {
            "protocol": [ "kaku_switch" ],
            "id": [{
                "id": 12408662,
                "unit": 14
            }],
            "state": "off"
        },
        "AllLightsOn": {
            "protocol": [ "generic_switch" ],
            "id": [{
                "id": 100
            }],
            "state": "off"
        },
        "AllLightsOff": {
            "protocol": [ "generic_switch" ],
            "id": [{
                "id": 101
            }],
            "state": "off"
        },
        "MobileHomeLabel": {
            "protocol": [ "generic_label" ],
            "id": [{
                "id": 102
            }],
            "label": "Connected",
            "color": "green"
        },
        "CustomPython": {
            "protocol": [ "generic_switch" ],
            "id": [{
                "id": 103
            }],
            "state": "on"
        },
        "TabletSwipe": {
            "protocol": [ "generic_switch" ],
            "id": [{
                "id": 106
            }],
            "state": "off"
        },
        "PythonFailCount": {
            "protocol": [ "generic_label" ],
            "id": [{
                "id": 104
            }],
            "label": "0",
            "color": "green"
        },
        "rpi_tmp": {
            "protocol": [ "cpu_temp" ],
            "id": [{
                "id": 1
            }],
            "temperature": 59.397,
            "poll-interval": 10
        },
        "AutoLights": {
            "protocol": [ "generic_switch" ],
            "id": [{
                "id": 105
            }],
            "state": "off"
        },
        "Travel_Schedule": {
            "protocol": [ "generic_switch" ],
            "id": [{
                "id": 107
            }],
            "state": "on"
        },
        "LivingroomFan": {
            "protocol": [ "nexa_switch" ],
            "id": [{
                "id": 12507630,
                "unit": 10
            }],
            "state": "off"
        },
        "HallwayDoor": {
            "protocol": [ "kaku_dimmer" ],
            "id": [{
                "id": 12507630,
                "unit": 11
            }],
            "state": "off",
            "dimlevel": 15,
            "dimlevel-minimum": 4
        },
        "BedroomWindow_Jul": {
            "protocol": [ "kaku_switch" ],
            "id": [{
                "id": 12408662,
                "unit": 15
            }],
            "state": "off"
        },
        "KitchenWindow_Jul": {
            "protocol": [ "nexa_switch" ],
            "id": [{
                "id": 12507630,
                "unit": 13
            }],
            "state": "off"
        },
        "CurrentDateTime": {
            "protocol": [ "datetime" ],
            "id": [{
                "longitude": 17.0150,
                "latitude": 58.7548
            }],
            "year": 2017,
            "month": 4,
            "day": 18,
            "hour": 22,
            "minute": 12,
            "second": 1,
            "weekday": 7,
            "dst": 1
        }
    },
    "rules": {
        "AllLightsOff": {
            "rule": "IF AllLightsOff.state == on THEN switch DEVICE LivingroomCorner AND LivingroomWindow AND BedroomWindow AND KitchenLED AND KitchenWindow AND BedroomBig AND HallwayDoor AND LivingroomFan TO off",
            "active": 1
        },
        "AllLightsOn": {
            "rule": "IF AllLightsOn.state == on THEN switch DEVICE LivingroomCorner AND LivingroomWindow AND BedroomWindow AND KitchenLED AND KitchenWindow AND BedroomBig AND HallwayDoor TO on",
            "active": 1
        },
        "AllLightsOnMomentary": {
            "rule": "IF AllLightsOn.state == on THEN switch DEVICE AllLightsOn TO off AFTER 2 SECOND",
            "active": 1
        },
        "AllLightsOffMomentary": {
            "rule": "IF AllLightsOff.state == on THEN switch DEVICE AllLightsOff TO off AFTER 2 SECOND",
            "active": 1
        },
        "MobileLabelOff": {
            "rule": "IF CustomPython.state == off THEN label DEVICE MobileHomeLabel TO Disconnected COLOR red",
            "active": 1
        },
        "MobileLabelOn": {
            "rule": "IF CustomPython.state == on THEN label DEVICE MobileHomeLabel TO Connected COLOR green",
            "active": 1
        },
        "AutoOn": {
            "rule": "IF CustomPython.state == on AND AutoLights.state == on THEN switch DEVICE KitchenWindow AND LivingroomWindow AND LivingroomCorner AND BedroomWindow AND BedroomBig AND HallwayDoor TO on",
            "active": 1
        },
        "AutoOff": {
            "rule": "IF CustomPython.state == off AND AutoLights.state == on THEN switch DEVICE AllLightsOff TO on FOR 1 SECOND",
            "active": 1
        },
        "TabletSwipeMomentary": {
            "rule": "IF TabletSwipe.state == on THEN switch DEVICE TabletSwipe TO off AFTER 1 SECOND",
            "active": 1
        },
        "TabletSwipe_On_Hall": {
            "rule": "IF TabletSwipe.state == on THEN switch DEVICE HallwayDoor TO on",
            "active": 1
        },
        "TabletSwipe_On_All": {
            "rule": "IF TabletSwipe.state == on THEN switch DEVICE KitchenWindow AND LivingroomCorner AND LivingroomWindow AND BedroomWindow TO on",
            "active": 1
        },
        "Schedule_Off":{
            "rule": "IF Travel_Schedule.state == on AND CurrentDateTime.second == 0 AND CurrentDateTime.minute == 07 AND CurrentDateTime.hour == 23 THEN switch DEVICE BedroomWindow_Jul AND KitchenWindow_Jul AND LivingroomWindow TO off",
            "active": 1
        },
        "Schedule_On":{
            "rule": "IF Travel_Schedule.state == on AND CurrentDateTime.second == 0 AND CurrentDateTime.minute == 37 AND CurrentDateTime.hour == 6 THEN switch DEVICE BedroomWindow_Jul AND KitchenWindow_Jul AND LivingroomWindow TO on",
            "active": 1
        }
    },
    "gui": {
        "KitchenWindow": {
            "name": "Kitchen Window",
            "group": [ "Lights" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "KitchenWindow_Jul": {
            "name": "Kitchen Window Jul",
            "group": [ "Lights" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "KitchenLED": {
            "name": "Kitchen LED",
            "group": [ "Lights" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "BedroomWindow": {
            "name": "Bedroom Window",
            "group": [ "Lights" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "BedroomWindow_Jul": {
            "name": "Bedroom Window Jul",
            "group": [ "Lights" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "LivingroomCorner": {
            "name": "Livingroom Corner",
            "group": [ "Lights" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "TabletSwipe": {
            "name": "Surfplattan Swipe",
            "group": [ "Settings" ],
            "media": [ "all" ],
            "readonly": 1
        },
        "LivingroomWindow": {
            "name": "Livingroom Window",
            "group": [ "Lights" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "BedroomBig": {
            "name": "Bedroom Big",
            "group": [ "Lights" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "LivingroomFan": {
            "name": "Livingroom Fan",
            "group": [ "Lights" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "HallwayDoor": {
            "name": "Hallen",
            "group": [ "Lights" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "AllLightsOn": {
            "name": "All Lights On",
            "group": [ "Lights" ],
            "media": [ "all" ],
            "readonly": 0,
            "confirm": 1
        },
        "AllLightsOff": {
            "name": "All Lights Off",
            "group": [ "Lights" ],
            "media": [ "all" ],
            "readonly": 0,
            "confirm": 1
        },
        "AutoLights": {
            "name": "Auto control lights",
            "group": [ "Settings" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "Travel_Schedule": {
            "name": "Auto Schema Bortrest",
            "group": [ "Settings" ],
            "media": [ "all" ],
            "readonly": 0
        },
        "MobileHomeLabel": {
            "name": "Mobile",
            "group": [ "Settings" ],
            "media": [ "all" ]
        },
        "CustomPython": {
            "name": "Mobile Home (PING)",
            "group": [ "Settings" ],
            "media": [ "all" ],
            "readonly": 1
        },
        "PythonFailCount": {
            "name": "Python Ping Fail Count",
            "group": [ "Settings" ],
            "media": [ "all" ]
        },
        "rpi_tmp": {
            "name": "Raspberry Pi Temperature",
            "group": [ "Settings" ],
            "media": [ "all" ],
            "temperature-decimals": 1
        },
        "CurrentDateTime": {
            "name": "Time & Date",
            "group": [ "Settings" ],
            "media": [ "all" ]
        }

    },
    "settings": {
        "port": 5000,
        "log-level": 6,
        "pid-file": "/var/run/pilight.pid",
        "log-file": "/var/log/pilight.log",
        "webserver-enable": 1,
        "webserver-root": "/usr/local/share/pilight/",
        "webserver-http-port": 5050,
        "webserver-cache": 1,
        "whitelist": "*.*.*.*",
        "gpio-platform": "raspberrypi3",
        "firmware-gpio-miso": 13,
        "firmware-gpio-mosi": 12,
        "firmware-gpio-reset": 10,
        "firmware-gpio-sck": 14,
        "ntp-servers": [ "0.europe.pool.ntp.org", "1.europe.pool.ntp.org", "2.europe.pool.ntp.org"]
    },
    "hardware": {
        "433gpio": {
            "sender": 0,
            "receiver": 4
        }
    },
    "registry": {
        "pilight": {
            "version": {
                "current": "7.0"
            }
        }
    }
}
 
Reply
#4
0.0.0.0 identifies the (sub-)network not the device, you can use that address if no (older) Windows Computers are part of the network as Windows did formerly used that address as Broadcast Address.

I assume that your network mask is something like 255.255.255.0, thus 0.0.0.0 is not reachable.

Gesendet von iPhone mit Tapatalk
 
Reply
#5
Ah my device doesn't have that IP.

But I was troubleshooting why my clients got rejected, they all have a valid IP in the same subnet as the Pi hosting pilight.
But the problem disappears if put "all wildcards" as "whitelist".
So then I looked in the log and saw that pilight print out the IP of the connecting client as "0.0.0.0".
But I don't know where that comes from, that's not the IP of the client.
 
Reply
#6
It was indeed a bug in the new webserver code. It has now been fixed and you can either manually compile pilight or install the nightly tomorrow.
 
Reply
#7
Thank you, that indeed did the trick Smile
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  [SOLVED] Triggering generic_switch leads to segfault Ulrich.Arnold 19 1,271 10-23-2019, 09:03 AM
Last Post: Ulrich.Arnold
  ][solved]Segfault when retrieving big chunked http message Niek 21 6,079 11-29-2018, 03:17 PM
Last Post: curlymo
  [Solved] config.json not updated Niek 6 1,594 12-31-2017, 03:19 PM
Last Post: curlymo
  [Solved] callback not executing when dns lookup fails Niek 1 717 10-08-2017, 11:44 AM
Last Post: curlymo
  [Solved] Rules switching state based on another device state not working apartmedia 6 2,547 09-27-2017, 01:41 PM
Last Post: apartmedia
  [Solved] connection to main pilight daemon lost TopdRob 20 4,439 09-17-2017, 04:30 PM
Last Post: curlymo
  [Solved] dimmer protocol kaku_dimmer does not react on dimmervalue apartmedia 25 4,271 09-16-2017, 10:29 PM
Last Post: apartmedia
  [Solved] Webgui not working in IE Ulrich.Arnold 7 1,868 09-12-2017, 05:22 PM
Last Post: Ulrich.Arnold
  [Solved] Sunriseset v7 fails after update and gives negative values PPacman 7 1,745 09-06-2017, 06:25 PM
Last Post: curlymo
  [Solved] Illegal Instruction? PekkaLahtela 50 11,925 09-06-2017, 01:18 PM
Last Post: apartmedia

Forum Jump:


Browsing: 1 Guest(s)