javitonino / jolla-settings-networking-plugin-vpn-wireguard

WireGuard VPN plugin for Sailfish OS
GNU General Public License v3.0
0 stars 0 forks source link

Unable to import a wg.conf #1

Closed pherjung closed 2 years ago

pherjung commented 2 years ago

On my X10 II on 4.4.0.72, I get an error if I import a wg.conf but it works if I insert manually all datas.

[W] unknown:0 - QDBusMarshaller: cannot add a null QDBusVariant
dbus[29649]: Array or variant type requires that type variant be written, but end_dict_entry was written.
The overall signature expected here was 'a{sv}' and we are on byte 3 of that signature.
  D-Bus not built with -rdynamic so unable to print a backtrace
Aborted (core dumped)

Edite: Here are the "problematic" values: Capture d'écran_20221103_001

javitonino commented 2 years ago

Hi! Thanks for the report.

It doesn't look like the values are the problem, nothing weird there. It may be a problem with the structure of the file or the keys, since the parser is currently a bit strict with that (I'm repurposing Python's configparser, which is not an exact match for this config file). The big limitation is that only a single "Peer" can be provided, but it may also have problems with missing values or different casing than expected.

Could you share your config file as well? Of course, please redact any values first!

pherjung commented 2 years ago

Thank you for your work and your answer!

Here is it:

[Interface]
PrivateKey = PRIVATE_KEY
Address = 10.10.0.4/8
DNS = 10.43.0.10
ListenPort = LISTEN_PORT

[Peer]
PublicKey = PUBLIC_KEY
Endpoint = ENDPOINT:LISTEN_PORT
AllowedIPS = 10.0.0.0/8
javitonino commented 2 years ago

Ok, so the problem was that my code assumed that all config file would have a PersistentKeepalive configure :facepalm:

It should be fixed in 0.2 (just released), which also includes some improvements to error reporting, so hopefully it will report errors instead of crashing.

Let me know if this works for you if you get the chance.

pherjung commented 2 years ago

Well it happens. Most important is that the fix is easy to apply and indeed it works as expected. Thank you!