cloudflare / cloudflare/boringtun
Fails to create API socket when /var/lib/wireguard does not exist
- Dominant language
- Rust
- Stars
- 7.2k
- Forks
- 532
- PR merge metrics
- No merged PRs in 30d
Description
This fails to work without sudo, or unless you prepare the wireguard socket dir manually. Ideally this directory would also be a configurable, which could live in userspace.
```
$ ls -lah /var/run/wireguard/
ls: cannot access '/var/run/wireguard/': No such file or directory
(wg-EWQAmZez) admin@uk3-ph-inf-netjoin-1:~/wg$ ~/.cargo/bin/boringtun-cli -l info -f lol
2024-01-21T12:03:33.061427Z ERROR boringtun_cli: Failed to initialize tunnel, error: ApiSocket(Os { code: 2, kind: NotFound, message: "No such file or directory" })
at /home/admin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/boringtun-cli-0.6.0/src/main.rs:160
$ sudo mkdir /var/run/wireguard/
$ ~/.cargo/bin/boringtun-cli -v trace -f lol
2024-01-21T12:06:39.473411Z ERROR boringtun_cli: Failed to initialize tunnel, error: ApiSocket(Os { code: 13, kind: PermissionDenied, message: "Permission denied" })
at /home/admin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/boringtun-cli-0.6.0/src/main.rs:160
$ sudo chown -R root /var/run/wireguard/
$ sudo chown -R root:root /var/run/wireguard/
$ sudo chmod -R 777 /var/run/wireguard/
$ ~/.cargo/bin/boringtun-cli -v trace -f lol
2024-01-21T12:08:05.658893Z INFO boringtun_cli: BoringTun started successfully
at /home/admin/.cargo/registry/src/index.crates.io-6f17d22bba15001f/boringtun-cli-0.6.0/src/main.rs:178
```
Contributor guide
Research direction
Start in boringtun-cli/src/main.rs around line 160, where the reported API socket initialization error occurs, and reproduce the failure when /var/run/wireguard does not exist. Determine the expected behavior for a missing or userspace-configurable socket directory; done means the CLI can initialize without manually creating and broadly chmod-ing the directory, with the relevant behavior covered by a test if the existing test structure supports it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100