donaldzou / WGDashboard

Simple dashboard for WireGuard VPN written in Python w/ Flask
Apache License 2.0
1.4k stars 202 forks source link

WGDashboard - Internal Server Error #191

Open rtripon opened 2 years ago

rtripon commented 2 years ago

Hello, I've noticed that WGDashboard is failing if I add a second IP address to main network interface.

Internal Server Error The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.

Aug 20 07:33:38 ubuntu python3[95386]: File "/opt/wgdashboard/src/dashboard.py", line 475, in get_conf_status Aug 20 07:33:38 ubuntu python3[95386]: ifconfig = dict(ifcfg.interfaces().items()) Aug 20 07:33:38 ubuntu python3[95386]: File "/usr/local/lib/python3.10/dist-packages/ifcfg/init.py", line 70, in interfaces Aug 20 07:33:38 ubuntu python3[95386]: return Parser(ifconfig=ifconfig).interfaces Aug 20 07:33:38 ubuntu python3[95386]: File "/usr/local/lib/python3.10/dist-packages/ifcfg/parser.py", line 30, in init Aug 20 07:33:38 ubuntu python3[95386]: self.parse(self.ifconfig_data) Aug 20 07:33:38 ubuntu python3[95386]: File "/usr/local/lib/python3.10/dist-packages/ifcfg/parser.py", line 90, in parse Aug 20 07:33:38 ubuntu python3[95386]: raise RuntimeError( Aug 20 07:33:38 ubuntu python3[95386]: RuntimeError: Tried to add broadcast=10.10.90.255 multiple times to ens18, it was already: xxx.xxx.xxx.xxx Aug 20 07:33:38 ubuntu python3[95386]: 192.168.10.1- - [20/Aug/2022 07:33:38] "GET / HTTP/1.1" 500 -

Pashtetickus commented 1 year ago

@rtripon Hi!

First, i imported socket in dashboard.py. Then in def get_conf_status i did something like this:

found = False
for interface in socket.if_nameindex():
    if interface[1] == config_name:
        found = True
return "running" if found else "stopped"

insted of

ifconfig = dict(ifcfg.interfaces().items())
return "running" if config_name in ifconfig.keys() else "stopped"

I also faced a problem with the endpoint and solved it with this #205

buddyqc69 commented 1 year ago

i have fix this with this comments : https://github.com/donaldzou/WGDashboard/issues/225#issuecomment-1606067170

but the error 500 can because you dont have installed wireguard on this server

donaldzou commented 9 months ago

Sorry I know this is super late... Did you install net-tools in your system? You can verify this by typing ifconfig in your terminal