Mitch (KH6MP) and I were chatting today on WW. The topic of unstable Pis came up. I mentioned some observations, and was encouraged to share this with the group:
For those of you who have noticed pnx-mono.exe crashing (i.e. not running/not connected to P25NX), it's due to the admin interface being accessible to the evil public Internet.
Fellow Canadian hoser Steve (VE3XF) and I both noticed this crashing issue. Setting a nightly crontab to reboot the Pi fixed the issue, but why schedule a reboot? That's not a fix. It's like putting a rag under your fridge, because it keeps leaking. Why not fix the leak?
In this case, the script kiddy hax0rs (or port scanning) was causing the pnx-mono.exe web interface to lock up. Firewalling it completely solves the issue.
On the Pi, implement these firewall rules: (Remove the ' ' quotes from my commands)
'sudo /sbin/iptables -A INPUT -p tcp -s
44.128.0.0/16 --sport 1024:65535 -j ACCEPT --dport 8080'
This rule allows an IP or subnet (
44.128.0.0/16 for this example) to connect from client ports 1024-65535, to the pnx-mono web daemon on port 8080. Replace
44.128.0.0/16 with your own subnets or static IP addresses. Make multiple lines if needed.
After you've added your access list, proceed to add this:
'sudo /sbin/iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d 0/0 -j DROP --dport 8080'
Anything else other than the IP(s) or subnet(s) you've allowed in the first line, will be dropped.
Steve and I have been running the iptables rules for the last month or so, and zero crashes since. 100% stable now. So yes, the pnx-mono.exe crashing was absolutely related to unwanted traffic hitting the web interface.
Make sure you put the ACCEPT rules first, then add the REJECT entry. The kernel has to interpret them in a certain order. You'll have to add them to a script that runs at boot time, or manually enter them each time you reboot.
To see a listing of your current iptables rules, run the command: 'sudo iptables -L -n -v'
To flush the rules, if you make a mistake: 'sudo iptables -P INPUT ACCEPT'
Then: 'sudo iptables -F'
Hope this helps those who were experiencing lockups.
Shaun VE4AI (Alien Invasion)
3024003 / 3024004