Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wgconf command to generate a Wireguard config file. #5817

Merged
merged 5 commits into from
Jan 31, 2023

Conversation

oskirby
Copy link
Collaborator

@oskirby oskirby commented Jan 31, 2023

Description

This adds a command line tool to render the current device configuration in the form of a Wireguard configuration file that can be used by a 3rd party Wireguard client.

Usage is as follows:

[user@example ~]$ ./src/mozillavpn wgconf
[Interface]
PrivateKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=
Address = 10.112.171.249/32, fc00:bbbb:bbbb:bb01::31:abf8/128
DNS = 10.64.0.1, fc00:bbbb:bbbb:bb01::1

[Peer]
PublicKey = Hzf1JH0UERBRNxBSpTvGPZAREa93LoHtPKsJMwdcrV0=
Endpoint = 89.45.224.41:3406
AllowedIPs = 10.64.0.1/32, fc00:bbbb:bbbb:bb01::1/128, 10.124.0.0/20, 240.0.0.0/4, 208.0.0.0/4, 200.0.0.0/5, 196.0.0.0/6, 194.0.0.0/7, 193.0.0.0/8, 192.0.0.0/9, 192.192.0.0/10, 192.128.0.0/11, 192.176.0.0/12, 192.160.0.0/13, 192.172.0.0/14, 192.170.0.0/15, 192.169.0.0/16, 128.0.0.0/3, 176.0.0.0/4, 160.0.0.0/5, 168.0.0.0/6, 174.0.0.0/7, 173.0.0.0/8, 172.128.0.0/9, 172.64.0.0/10, 172.32.0.0/11, 172.0.0.0/12, 64.0.0.0/2, 32.0.0.0/3, 16.0.0.0/4, 0.0.0.0/5, 12.0.0.0/6, 8.0.0.0/7, 11.0.0.0/8, ::/1, 8000::/2, c000::/3, e000::/4, f000::/5, f800::/6, fe00::/8

[user@example ~]$

Reference

Github issue #3165 (VPN-1988)

Checklist

  • My code follows the style guidelines for this project
  • I have not added any packages that contain high risk or unknown licenses (GPL, LGPL, MPL, etc. consult with DevOps if in question)
  • I have performed a self review of my own code
  • I have commented my code PARTICULARLY in hard to understand areas
  • I have added thorough tests where needed

@oskirby oskirby requested a review from Gela January 31, 2023 09:17
Copy link
Collaborator

@strseb strseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ship it!

@codecov-commenter
Copy link

Codecov Report

Base: 28.16% // Head: 16.83% // Decreases project coverage by -11.34% ⚠️

Coverage data is based on head (1ae07be) compared to base (c957727).
Patch has no changes to coverable lines.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5817       +/-   ##
===========================================
- Coverage   28.16%   16.83%   -11.34%     
===========================================
  Files         342       12      -330     
  Lines       22721      505    -22216     
  Branches    12277      288    -11989     
===========================================
- Hits         6400       85     -6315     
+ Misses      10484      228    -10256     
+ Partials     5837      192     -5645     
Flag Coverage Δ
functional_tests ?
linux_unit_tests ?
lottie_tests 16.83% <ø> (-6.15%) ⬇️
macos_unit_tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lottie/tests/unit/testwindow.cpp 6.66% <0.00%> (-20.84%) ⬇️
lottie/tests/unit/testnavigator.cpp 16.66% <0.00%> (-20.84%) ⬇️
lottie/lib/lottieprivatewindow.cpp 45.61% <0.00%> (-13.81%) ⬇️
lottie/tests/unit/main.cpp 33.33% <0.00%> (-12.13%) ⬇️
lottie/lib/lottieprivatedocument.cpp 62.50% <0.00%> (-8.93%) ⬇️
lottie/tests/unit/testdocument.cpp 7.40% <0.00%> (-5.83%) ⬇️
lottie/lib/lottieprivate.cpp 7.76% <0.00%> (-1.74%) ⬇️
lottie/lib/lottieprivatewindow.h 77.77% <0.00%> (-1.17%) ⬇️
src/apps/vpn/command.cpp
src/apps/vpn/controller.h
... and 329 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@strseb
Copy link
Collaborator

strseb commented Jan 31, 2023

Okay big fan, on 2nd thought - should this give maybe the option to get the config against a new registered device?
Because i'm thinking about i'd run this on my mac to specifically generate a config for a device that cannot run the client, i.e a router, tv etc :)

@oskirby oskirby marked this pull request as ready for review January 31, 2023 14:57
@oskirby
Copy link
Collaborator Author

oskirby commented Jan 31, 2023

@strseb I agree, that sounds even better.

Copy link

@Gela Gela left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you!

Is there a document somewhere for command line arguments or anywhere good we should update to mention this addition?

@oskirby
Copy link
Collaborator Author

oskirby commented Jan 31, 2023

@Gela we don't have any substantive documentation on the command line arguments to the VPN client and this is definitely something that should be improved upon. We do have some stale issues about this lack of documentation (Github issue #962/JIRA ticket VPN-174)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants