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

WireGuard on Antrea implementation #2243

Closed
4 tasks done
xliuxu opened this issue Jun 7, 2021 · 2 comments
Closed
4 tasks done

WireGuard on Antrea implementation #2243

xliuxu opened this issue Jun 7, 2021 · 2 comments
Labels
kind/design Categorizes issue or PR as related to design.

Comments

@xliuxu
Copy link
Contributor

xliuxu commented Jun 7, 2021

Describe what you are trying to solve
This proposal summarizes the first version of WireGuard on Antrea. Refer to #2204 for the proposal.

In the first version, we want to implement WireGuard on default encap mode as existing features such as EgressPolicy will not be affected.

Describe how your solution impacts user flows
Users can enable WireGuard in configmap by setting enableWireGuard: true to enable WireGuard encryption.

Describe the main design/architecture of your solution

Control Plane

antrea-init

antrea-init should be able to load WireGuard kernel module and save the status.

antrea-agent

Node controller should check whether WireGuard is enabled in configmap. If yes the following steps should take place.

  • setup up WireGuard interface, including setting up MTU, private key, listening port, setting rp_filter to 2
  • expose the public key by annotation.
  • list and watch all kubernetes Node resource, read set PublicKey, AllowedIPs, Endpoint as WireGuard peer.

Data plane

On the Node, antrea-agent will realize whether WireGuard is enabled and mark packets accordingly.

// If wireguard is enabled
// table=70
- priority=200,ip,nw_dst=remote_cidr, actions=mod_dl_src:gw0_mac,mod_dl_dst:vMAC,load:remote_node_ip->NXM_NX_TUN_IPV4_DST[],resubmit(,72)
+ priority=200,ip,nw_dst=remote_cidr, actions=mod_dl_src:local_gw_mac,mod_dl_dst:vMAC,load:remote_node_ip->NXM_NX_TUN_IPV4_DST[],load:tunnel_pkt_mark->NXM_NX_PKT_MARK[],resubmit(,72)

// If EgressPolicy rules are present
// table 72
- priority=200 ip,in_port=local_pods mod_dl_src:gw0_mac,mod_dl_dst:vMAC,snat_ip->NXM_NX_TUN_IPV4_DST,goto:72
+ priority=200 ip,in_port=local_pods mod_dl_src:gw0_mac,mod_dl_dst:vMAC,snat_ip->NXM_NX_TUN_IPV4_DST,set_field:1234->pkt_mark,goto:72

Routing change:
Add a new routing table to handle packets with the specific pkt_mark. The default route should be the WireGuard tunnel.
e.g.

// ip rule 
0:	from all lookup local
1000:	from all fwmark 0x4d2 lookup 10
32766:	from all lookup main
32767:	from all lookup default
// route in table 10
default dev antrea-wg scope link src 172.16.10.12

Work breakdown

  • antrea-init load kernel module
  • antrea-agent setting up WireGuard interface and watch/reconcile changes
  • openflow entries change
  • routing rule/table change

Alternative solutions that you considered
N/A

Test plan
Add E2E tests to verify all features when WireGuard is enabled. We can use user-space implementation of WireGuard to run tests in kind clusters.

Additional context
Any other relevant information.

@xliuxu xliuxu added the kind/design Categorizes issue or PR as related to design. label Jun 7, 2021
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 23, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 23, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 23, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 23, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 23, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 23, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 24, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 25, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 25, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 25, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 25, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 25, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 28, 2021
of antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 29, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 30, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 30, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 30, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jun 30, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jul 2, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jul 2, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jul 2, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jul 7, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jul 7, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jul 7, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jul 7, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jul 8, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jul 12, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Jul 22, 2021
This PR implements antrea-io#2243. Currently WireGuard only support with antrea encap mode.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 24, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 24, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 25, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 25, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 25, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 25, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 25, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 25, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 25, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 26, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 27, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 27, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 27, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
xliuxu added a commit to xliuxu/antrea that referenced this issue Aug 27, 2021
This PR implements antrea-io#2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
tnqn pushed a commit that referenced this issue Aug 27, 2021
This PR implements #2243. Change tunnel traffic encryption option
to enum type. The options contains none (default), ipsec and wireguard.

Signed-off-by: Xu Liu <[email protected]>
@tnqn
Copy link
Member

tnqn commented Aug 27, 2021

@xliuxu Thanks for your work. Please use github keyword "Closes #XXXX" in your future PRs so they can close issues automatically on merge.

#2297 implemented this, closing this issue.

@tnqn tnqn closed this as completed Aug 27, 2021
@xliuxu
Copy link
Contributor Author

xliuxu commented Aug 27, 2021

Thank you @tnqn!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/design Categorizes issue or PR as related to design.
Projects
None yet
Development

No branches or pull requests

2 participants