BitMaker-hub / NerdMiner_v2

Improved version of first ESP32 NerdMiner
Other
1.37k stars 250 forks source link

NerdMinerAP access point visible even all miners are connected to Wi-Fi and mining #259

Open sany3001 opened 7 months ago

sany3001 commented 7 months ago

I have connected 5 miners. All mining @~78kHs/s. But now I see 2 devices started AP too. Observed using inSSIDer tool (Win).

All miners are running FW 1.6.3.

PSLLSP commented 7 months ago

I have several NerdMiners running and I do not see NerdMinerAP SSID in the air. I experienced that one device lost configuration and entered WiFi configuration mode, I cannot explain it, maybe it overheated or some software error erased configuration. Maybe just a connectivity issue, that device was not able to connect to the mining pool so it switched to configuration mode... Is it possible that a temporary error at mining pool can erase NerdMiner configuration?? I will try to verify this idea...

All your NerdMiners are mining and you still see NerdMinerAP in the air? Could you connect to it?? Then you can find MAC address at Info page. Maybe that your neighbor runs NerdMiners too .;-) Or some smart attacker just created a honeyspot with name NerdMinerAP... You have to try to find device that creates that AP, you can try to switch off all your NerdMiners and check that NerdMinerAP is not visible anymore...

sany3001 commented 7 months ago

I am (not now) running 5 miners LILYGO T-Display S3. All of them were mining when I have seen APs of two or three of them (it varies). All of them have quite big passive heat sink - I didn't noticed their were any kind hot.

However I can see that they are either rebooting or so as all values "total" (in the bottom right corner) were different.

When I have powered them off, all AP have gone.

:-) I have just one neighbor and I would be very surprised if he would be running something like this.

I am using this for those 5: https://www.tindie.com/products/electronictrik/rack-1u-nerdminer/

PSLLSP commented 7 months ago

I configured WiFi scanner on my Linux box. First, I run horst for some time, then for several hours kismet. I use WiFi dongle with chipset RT5370 and external antenna. There are many WiFi devices in this area, about 10 of them are different NerdMiners, mix of devices based on ESP32 and ESP32-S3. I have not captured any evidence, that NerdMinerAP is in the air, all my NerdMiner devices (firmware 1.6.3) are just connected to their WiFi AP and silently mine... Kismet only detected that one device is not immune against some WiFi attack and could be easily disconnected from AP by some magic WiFi packet...

PSLLSP commented 7 months ago

My Kismet scanner found NerdMinerAP; it is a rare event, it took 3 days to capture such event. I am not sure what device is responsible for this event because MAC address of that AP is not associated with any of my devices (I did MAC address inventory during weekend). It is possible that new MAC address is assigned when NerdMiner is in WiFi configuration mode...

I found the device. It is T-Display-S3 and it is mining and in the same time it works as AP and I can connect to NerdMinerAP and check configuration (http://192.168.4.1/info). I have only one such NerdMiner; this board is used in official NerdMiners. The device has two MAC addresses, one is used in client mode and other one in AP mode, these differ in the first byte, one bit difference:

84:FC:E6:12:34:56 - station MAC address 86:FC:E6:12:34:56 - AP MAC address

I confirm this is a real issue. I do not know what was a trigger that activated AP mode. I was touching all NerdMiners during weekend, I was collection MAC addresses, so device was fresh started yesterday. Maybe some condition during startup activated AP mode. This device is connected to "power only" USB port so I cannot access decide console to find more details...

sany3001 commented 6 months ago

I can confirm that is is not permanent situation by me either. I am far from 24/7 monitoring, but today, I have not seen anything in the air yet.

I am only aware that this is feature of ESP32 that it can run AP and STA mode simultaneously. I do not have experience with ESP32 so I cannot add more here.

In my case all devices are also powered only (no data over USB).

PSLLSP commented 6 months ago

I detected NerdMinerAP in the air today. I was no monitoring this issue anymore so I do not know how long NerdMinerAP is active. I was able to connect to http://192.168.4.1/info and found MAC address and client IP. I can ping the device on local WLAN address (like 192.168.132.167). I identified the device, it is ESP-WROOM-32 with UART HL-340. I checked the pool and I see the device is mining. Device doesn't have display, it is "cheap" ESP32 module mining with hashrate about 55 kHps. It is not easy to identify what NerdMiner device is troublemaker; I created a database of MAC addresses of my devices, so I can find what device is troublemaker. It is not visible in any way... This case proves that this issue is not limited to ESP32-S3 devices. I have no idea how this issue was triggered.

sany3001 commented 6 months ago

By chance I have seen today also at least one NerdMinerAP Wi-Fi AP running. I was not investigating (but for sure it was LILIGO T-Display-S3. What I have observed was that at the same time 2 of my 5 miners (all same HW) were not mining (0 hashrate). Both were equipped with small external antenna (the others are not). Both devices were for some reason restarted recently (I didn't do that and there was no power outage). I will remove both antennas to have same HW for all.

I do know nothing about used FW, but I have the feeling that some WifiManager is used. I had some problems with this on another ESP8266 board in the past (mostly disconnections from Wi-Fi). Never solved, never really investigated at that time.

I will try to get more details. It is happening more often by me as I can see. (found it by chance when playing with phone)

What I know for sure is that all miners have weak Wi-Fi signal (hidden under steel). I can temporary move them closer to the router.

sany3001 commented 6 months ago

Not sure if this can be useful info, but I see (from inSSIDer) that when NerdMinerAP was active, it was each time on different channel (have seen 1,3,9).

Now all my devices are close to router. I shall have better control over them (especially restarts and hashrate drops).

randomn4m3 commented 6 months ago

I have noticed the same issue. Is it at least possible to change the password to connect to the NerdMinerAP?

PSLLSP commented 6 months ago

I have noticed the same issue. Is it at least possible to change the password to connect to the NerdMinerAP?

I think you can change WiFi password; you have to modify file src/drivers/storage/storage.h and build your customized binary/firmware... I think it will not affect QR code that is shown on the display because that is just an image...

BTW, what is your hardware? Is it T-Display-S3??


UPDATE. I just checked my airspace and I see that another NerdMiner has this issue, NerdMinerAP is visible in my "airspace". It is ESP-WROOM-32 with UART CP210x; uptime of the miner is 5028 minutes (3.5 days). I think I checked airspace yesterday and there was no NerdMinerAP visible, so it was activated today, I have no idea why. I see the device on mining pool, it mines, no issue... The device has no display and it is not connected to serial port so I cannot check what is happening under the hood... I can access it on IP address 192.168.4.1 (when connected to NerdMinerAP) and with IP address assigned by local DHCP server. This is important!

Lets's assume that IP address assigned to NerdMiner by local DHCP server is 192.168.10.123. In that case I can access http://192.168.10.123/info and I see details about device, MAC address, uptime, I can erase WiFi configuration... When miner doesn't have active NerdMinerAP, I cannot access that page from local network. This "side effect" could be used to find what device has the issue.

Simple script can be run to scan local network, to find NerdMiner in NerdMinerAP mode; run on Linux, scans network 192.168.10.0/24:

for I in {1..254}; do IP="192.168.10.$I"; curl -s "http://$IP/info" | grep -q ">Chip ID<" && echo "$IP - NerdMinerAP detected"; done

In the case you know IP addresses of your NerdMiner devices, similar script can regularly check just few IP addresses, it will run faster:

for I in 123 124 125 211; do IP="192.168.10.$I"; curl -s "http://$IP/info" | grep -q ">Chip ID<" && echo "$IP - NerdMinerAP detected"; done

It is possible to restart device remotely: curl -s "http://192.168.10.123/restart

sany3001 commented 5 months ago

I have in my private project based on MicroPython (esp8266) did following "trick" after connecting my device to WiFi:

print("disabling AP mode")
ap_if = network.WLAN(network.AP_IF)
ap_if.active(False)

Maybe solution for our problem? I cannot test it yet (and for my project I need to make long term observations). I have not yet setup development environment for NerdMiner. If someone will drop here link where to start it will be bonus for me.

PSLLSP commented 5 months ago

My Ethernet switch in local LAN died yesterday. NerdMiners were able to connect to WiFi AP but were not able to connect to the internet or update IP address from DHCP server. My network was "broken" for several hours, at least for 4 hours. I replaced the failed switch (power supply - AC adapter - died). I see that many NerdMiners entered AP mode, there are many devices that mine and broadcast SSID NerdMinerAP after that incident. I assume that when miner cannot reach mining pool or it cannot refresh IP address from DHCP server, it activates AP mode NerdMinerAP... That could be a trigger for this issue.

script to reset NerdMiners

for I in 123 124 125 211; do IP="192.168.10.$I"; echo "restarting $IP"; curl -s "http://$IP/restart" >/dev/null ; done
sany3001 commented 5 months ago

I have currently problem with building code for TTGO-T-Display (https://github.com/BitMaker-hub/NerdMiner_v2/issues/299) but as soon as I will be able to fix that I want to collect evidence for this topic and open ticket on https://github.com/tzapu/WiFiManager to discuss if this is WiFi Manager issue or not. But to open ticket I need to try their last version, otherwise my ticket may be ignored.

sany3001 commented 3 months ago

Looks like this is not bug, but feature of WifiManager: https://github.com/tzapu/WiFiManager/issues/1725. If I will find time, I will try to play with that.