DefGuard / wireguard-rs

Rust library providing unified WireGuard interface to native/kernel and userspace implementations
https://github.com/defguard/defguard/
Other
136 stars 14 forks source link

VPN not working - Failed to create interface #65

Open teon opened 3 weeks ago

teon commented 3 weeks ago

On client service:

août 26 13:55:24 laptopWork defguard-service[87894]:   2024-08-26T11:55:24.678582Z  INFO defguard_client::service: Creating interface cnt000048
août 26 13:55:24 laptopWork defguard-service[87894]:     at src/service/[mod.rs:92](http://mod.rs:92/)
août 26 13:55:24 laptopWork defguard-service[87894]:     in defguard_client::service::create_interface with interface_name: "cnt000048"
août 26 13:55:24 laptopWork defguard-service[87894]:     in defguard_client::service::defguard_service
août 26 13:55:24 laptopWork defguard-service[87894]:   2024-08-26T11:55:24.678616Z  INFO defguard_wireguard_rs::wgapi_linux: Creating interface cnt000048
août 26 13:55:24 laptopWork defguard-service[87894]:     at /srv/github/defguard/.cargo/git/checkouts/wireguard-rs-fba7499ea125cbe3/35345d5/src/[wgapi_linux.rs:27](http://wgapi_linux.rs:27/)
août 26 13:55:24 laptopWork defguard-service[87894]:     in defguard_client::service::create_interface with interface_name: "cnt000048"
août 26 13:55:24 laptopWork defguard-service[87894]:     in defguard_client::service::defguard_service
août 26 13:55:24 laptopWork defguard-service[87894]:   2024-08-26T11:55:24.678764Z  INFO defguard_wireguard_rs::wgapi_linux: Configuring interface cnt000048 with config: InterfaceConfiguration { name: "cnt000048", address: "100.110.1.3", port: 18904, peers: [Peer { public_key: XXXXXXXXXX, preshared_key: None, protocol_version: None, endpoint: Some([194.254.218.14:50002](http://194.254.218.14:50002/)), last_handshake: None, tx_bytes: 0, rx_bytes: 0, persistent_keepalive_interval: Some(25), allowed_ips: [IpAddrMask { ip: 100.110.1.0, cidr: 24 }, IpAddrMask { ip: 100.84.0.129, cidr: 28 }, IpAddrMask { ip: 100.84.1.0, cidr: 25 }] }] }
août 26 13:55:24 laptopWork defguard-service[87894]:     at /srv/github/defguard/.cargo/git/checkouts/wireguard-rs-fba7499ea125cbe3/35345d5/src/[wgapi_linux.rs:42](http://wgapi_linux.rs:42/)
août 26 13:55:24 laptopWork defguard-service[87894]:     in defguard_client::service::create_interface with interface_name: "cnt000048"
août 26 13:55:24 laptopWork defguard-service[87894]:     in defguard_client::service::defguard_service
août 26 13:55:24 laptopWork defguard-service[87894]:   2024-08-26T11:55:24.749431Z ERROR defguard_wireguard_rs::netlink: Failed to add WireGuard interface route: Netlink payload error: Invalid argument (os error 22)
août 26 13:55:24 laptopWork defguard-service[87894]:     at /srv/github/defguard/.cargo/git/checkouts/wireguard-rs-fba7499ea125cbe3/35345d5/src/[netlink.rs:454](http://netlink.rs:454/)
août 26 13:55:24 laptopWork defguard-service[87894]:     in defguard_client::service::create_interface with interface_name: "cnt000048"
août 26 13:55:24 laptopWork defguard-service[87894]:     in defguard_client::service::defguard_service
août 26 13:55:24 laptopWork defguard-service[87894]:   2024-08-26T11:55:24.749487Z ERROR defguard_client::service: Failed to configure routing for WireGuard interface cnt000048: Netlink error: Add route error
août 26 13:55:24 laptopWork defguard-service[87894]:     at src/service/[mod.rs:140](http://mod.rs:140/)
août 26 13:55:24 laptopWork defguard-service[87894]:     in defguard_client::service::create_interface with interface_name: "cnt000048"
août 26 13:55:24 laptopWork defguard-service[87894]:     in defguard_client::service::defguard_service

On desktop client:

[2024-08-26][11:55:20][INFO][defguard_client::tray] Tray icon changed
[2024-08-26][11:55:21][INFO][defguard_client::commands] Settings retrieved
[2024-08-26][11:55:21][INFO][defguard_client::commands] Instances retrieved(1)
[2024-08-26][11:55:21][INFO][defguard_client::commands] Tunnels retrieved(0)
[2024-08-26][11:55:21][INFO][defguard_client::commands] Instances retrieved(1)
[2024-08-26][11:55:21][INFO][defguard_client::commands] Tunnels retrieved(0)
[2024-08-26][11:55:21][INFO][defguard_client::commands] Locations retrieved(2)
[2024-08-26][11:55:21][INFO][defguard_client::commands] Fetching latest application version with args: current version 0.4.0 and operating system linux
[2024-08-26][11:55:21][INFO][defguard_client::commands] Latest application version fetched: 0.4.0
[2024-08-26][11:55:24][INFO][defguard_client::utils] Location public key decoded.
[2024-08-26][11:55:24][INFO][defguard_client::utils] Parsed location endpoint.
[2024-08-26][11:55:24][INFO][defguard_client::utils] Parsed allowed IPs for location.
[2024-08-26][11:55:24][INFO][defguard_client::utils] Found free port: 18904 for interface cnt000048.
[2024-08-26][11:55:24][ERROR][defguard_client::utils] Failed to create interface with config InterfaceConfiguration { name: "cnt000048", address: "100.110.1.3", port: 18904, peers: [Peer { public_key: XXXXXXXXXXX, preshared_key: None, protocol_version: None, endpoint: Some([194.254.218.14:50002](http://194.254.218.14:50002/)), last_handshake: None, tx_bytes: 0, rx_bytes: 0, persistent_keepalive_interval: Some(25), allowed_ips: [IpAddrMask { ip: 100.110.1.0, cidr: 24 }, IpAddrMask { ip: 100.84.0.129, cidr: 28 }, IpAddrMask { ip: 100.84.1.0, cidr: 25 }] }] }. Error: status: Internal, message: "Failed to configure routing for WireGuard interface cnt000048: Netlink error: Add route error", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "date": "Mon, 26 Aug 2024 11:55:24 GMT", "content-length": "0"} }
[2024-08-26][11:55:24][ERROR][k0@tauri://localhost/assets/index-423e0080.js:68:7119] Invoking connect FAILED
"Internal error: Failed to create interface with config InterfaceConfiguration { name: \"cnt000048\", address: \"100.110.1.3\", port: 18904, peers: [Peer { public_key: XXXXXXXXX, preshared_key: None, protocol_version: None, endpoint: Some([194.254.218.14:50002](http://194.254.218.14:50002/)), last_handshake: None, tx_bytes: 0, rx_bytes: 0, persistent_keepalive_interval: Some(25), allowed_ips: [IpAddrMask { ip: 100.110.1.0, cidr: 24 }, IpAddrMask { ip: 100.84.0.129, cidr: 28 }, IpAddrMask { ip: 100.84.1.0, cidr: 25 }] }] }. Error: status: Internal, message: \"Failed to configure routing for WireGuard interface cnt000048: Netlink error: Add route error\", details: [], metadata: MetadataMap { headers: {\"content-type\": \"application/grpc\", \"date\": \"Mon, 26 Aug 2024 11:55:24 GMT\", \"content-length\": \"0\"} }"
[2024-08-26][11:55:24][ERROR][k0@tauri://localhost/assets/index-423e0080.js:68:7119] Error handling interface: Internal error: Failed to create interface with config InterfaceConfiguration { name: "cnt000048", address: "100.110.1.3", port: 18904, peers: [Peer { public_key: XXXXXXXXX, preshared_key: None, protocol_version: None, endpoint: Some([194.254.218.14:50002](http://194.254.218.14:50002/)), last_handshake: None, tx_bytes: 0, rx_bytes: 0, persistent_keepalive_interval: Some(25), allowed_ips: [IpAddrMask { ip: 100.110.1.0, cidr: 24 }, IpAddrMask { ip: 100.84.0.129, cidr: 28 }, IpAddrMask { ip: 100.84.1.0, cidr: 25 }] }] }. Error: status: Internal, message: "Failed to configure routing for WireGuard interface cnt000048: Netlink error: Add route error", details: [], metadata: MetadataMap { headers: {"content-type": "application/grpc", "date": "Mon, 26 Aug 2024 11:55:24 GMT", "content-length": "0"} }
equinoxefr commented 3 weeks ago

Hi,

Here's some context: Linux distribution: Manjaro (Archlinux like) Defguard: 0.4.0 Kernel: 6.6.46

The wireguard link is up, we can monitor the status with "wg show" but it's disconnected in defguard client. No route were configured.

Regards