-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add Wireguard VPN integration #9977
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
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
|
added to 4.21.0 milestone @Dav-11 |
|
Ok thank you |
|
@Dav-11 We already have APIs to manage VPN and introducing more APIs would increase the complexity of the system. Have you checked/considered the existent APIs? |
|
@GutoVeronezi
Also, right now the remote-access vpn is not tied to the vpn server, but it seems like that all the vpn server made by a user have the same vpn_users. It would be better for wg to have the user/peer tied to the server instead. I think It would be possible to use the same APIs by adding some fields (both in response and request) and a selector field for the vpn type (l2tp or wireguard). It would also require also to change the params validation based on the value of the vpn_type field. This would change the current APIs. We thought that it would have been better to create new APIs, but if it is preferred to change the current one instead we could try to propose a way to do it that way. Please let me know. |
|
Currently the remote access vpn feature is implemented via strongswan which has lot of limitations. @Dav-11 |
|
@weizhouapache Would this be better ? |
yes @Dav-11 |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9977 +/- ##
============================================
- Coverage 15.80% 4.04% -11.77%
============================================
Files 5627 392 -5235
Lines 492343 32177 -460166
Branches 59694 5679 -54015
============================================
- Hits 77828 1301 -76527
+ Misses 405992 30728 -375264
+ Partials 8523 148 -8375
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
ok, I'll think of a way to modify tha proposed new APIs to allow such beaviour. |
cool, thanks @Dav-11 |
Yes, reusing the existing APIs would reduce the maintenance efforts in the medium and long term. Also, it would prepare the code for new VPN providers, like it was commented. |
|
@Dav-11 thanks for the PR - looks very exciting. I'm yet to review/test/try the PR, can you raise a doc PR? Some questions & suggestions (in-line with @weizhouapache 's remarks)
|
plugins/vpn/wireguard/src/main/java/org/apache/cloudstack/api/response/CreateWgVpnResponse.java
Outdated
Show resolved
Hide resolved
plugins/vpn/wireguard/src/main/java/org/apache/cloudstack/api/response/CreateWgVpnResponse.java
Outdated
Show resolved
Hide resolved
plugins/vpn/wireguard/src/main/java/org/apache/cloudstack/api/response/CreateWgVpnResponse.java
Outdated
Show resolved
Hide resolved
plugins/vpn/wireguard/src/main/java/org/apache/cloudstack/api/response/CreateWgVpnResponse.java
Outdated
Show resolved
Hide resolved
plugins/vpn/wireguard/src/main/java/org/apache/cloudstack/api/response/CreateWgVpnResponse.java
Outdated
Show resolved
Hide resolved
plugins/vpn/wireguard/src/main/java/org/apache/cloudstack/api/response/CreateWgVpnResponse.java
Outdated
Show resolved
Hide resolved
plugins/vpn/wireguard/src/main/java/org/apache/cloudstack/api/response/CreateWgVpnResponse.java
Outdated
Show resolved
Hide resolved
plugins/vpn/wireguard/src/main/java/org/apache/cloudstack/api/response/CreateWgVpnResponse.java
Outdated
Show resolved
Hide resolved
|
@rohityadavcloud I would like to know how much can we edit the current APIs:
Also do you think I should close this PR and open a new one with the new API proposal ? (I am sorry but this is the first PR i do for a community project) |
|
@Dav-11, you can keep this PR and continue improving it, it is better for tracking.
Currently, we are not breaking compatibility (see #8970). Instead of marking a field as
Deleting fields would also break compatibility, so we are back to the first answer. |
|
@Dav-11 to answer your questions, in addition to what Guto has already advised;
Here are few more links for you that you may find useful from the open source hackerbook (CloudStack self-learning course material): |
|
Hello @DaanHoogland I think I may have explained it poorly. What I meant was to have a generic optional object The vpn-specific code would unmarshal the JSON and validate the object. The part about wg was just ana example of waht this json would be in the case of wireguard. I am not certain a solution like this can be implemented in cloudstack, I have done something like this but I was using Go. |
|
@Dav-11 , sounds good, but I don't have a clear vision yet of how that would work for different FWs. A name like Implementations like this are there. Look for the |
|
@DaanHoogland Thank you very much! No problem changing the parameter name, I agree that it is too generic. I will look into the |
|
@Dav-11 , I'm sure something went wrong with your branches. You are having 298 commits in this PR. |
|
Yes, |
|
I resetted the PR and it closed the PR, will it be reopened with the first commit ? |
|
@Dav-11 |
|
I made a commit just to keep this open. |
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
|
@Dav-11 , you can rebase your branch on main. In case it was off an older commit on main that would just be also apache rules require the license header in each source file. |
|
@blueorangutan package |
|
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
I am deeply sorry but I have been busy on other projects and it seems like it will be like that for the foreseeable future. If anyone would like to keep on working on this and wants to know more about what we did (which is not much) I will happily answer to emails or in person if we meet at next CCC. Sorry again and have a nice day. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 13625 |
Description
This PR adds the possibility to create wireguard VPNs as an alternative to the currently available L2TP-IPsec tunnels.
Changes in details:
wireguard_vpn-> contains details on each tunnel (similar to theremote_access_vpntable)wireguard_vpn_peer-> contains details on each peer for the tunnel (similar tovpn_userstable)sequenceDiagram actor user participant mgmt as management server box VR participant uc as update_config.py participant conf as /etc/wireguard/wg0.conf participant wg_srv as [email protected] end user ->> mgmt : (1) CreateWgPeer activate mgmt mgmt ->> mgmt: (2) [OPT] gen keys mgmt ->> mgmt: (3) gen addresses mgmt ->> mgmt: (4) save to DB mgmt ->> uc: (5) add_wg_user(wg0_user.json) activate uc uc ->> conf: (6) regenerate uc ->> wg_srv: (7) systemctl restart uc -->>- mgmt: (8) ok mgmt -->>- user: (9) wg0.confTypes of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?