-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
IPSEC backend, continued #637
Conversation
I ran the previous (non-rebased) version for a couple of days with debug logging, pinging among participating nodes and a tcpdump. Everything is fine & stable for me. I've rebased it. Please review/comment. |
I've updated mkutsevol/flannel:amd64 with the current build. |
Switched default esp proposal to Suite-B-GCM-128 and made it configurable instead of hard coded. |
@tomdee hi! Thanks! :D |
Do you plan on using Kubernetes with this? The last time I looked at this the flannel code was fork/exec'ing the swan code. One thing I would love to see is if swan could be put in a pod alongside flanneld for Kubernetes. |
@philips, no, I need it for a standalone thing. |
Is there a plan to merge this? @mkutsevol are you using your implementation in a productive environment or still testing? I am thinking about to fork the current release and merge your commits and try to test it in our testing environment. IPSec or encryption in general is a so necessary point in an infrastructure. |
@nesc58 I'm using this in production for several months now. Stable. |
@mkutsevol thank you. I changed the flannel image and changed the backend type to ipsec. It works. But in combination with kubernetes it doesn't work. The configurations are the same. Nothing changed. The internal routing between an ingress haproxy with ssl termination and an application behind also works. Internal, e.g. The dashboard is accessible e.g. From a busybox pod in another namespace. The routing seems to be okay. I can access it with the URL kubernetes-dashboard.kube-system. So, the dns addon (kube dns) also works. Can you help me? Tomorrow I will test the cluster internal communication. |
@nesc58 I can definitely say that the absence of connectivity is not due to flannel/ipsec code, you should better try to get help on k8s forums. |
@mkutsevol thanks. I will test it soon. And again, thanks for this implementation. |
@mkutsevol Thanks for all your work on this PR, it's a really important feature that lots of people want. I've taken a really quick look at it and have a few comments
|
Hi @tomdee,
Lets discuss some of the available approaches to separate things here.
Using the second approach users can use OS package manager to install strongswan, for coreos and friends the user can make a systemd service that starts a container with strongswan (didn't find an official one though) prior to starting flannel. And that all being said, it turns this work into the fourth? reincarnation of it? :D |
I'll keep thinking this over but my initial though on multiple images vs. putting extra burden on the user to configure it is that we just go for multiple images. Though, I guess it would be nice to have the option of using an OS strongswan package if users really want to do that. |
I've rebased this onto master and pushed to https://github.com/tomdee/flannel/tree/ipsec |
Looking forward to this hitting upstream and have started testing the custom images discussed here in my dev env. will report back if i run into any issues. This is awesome btw! |
What exactly is the status of this? Are we just waiting on ? |
FWIW, we need this functionality. We use weave because it supports encryption ( a requirement for us). We think flannel would be much more stable, and we'd love to switch. |
I'm doing my best to allocate time to this in the nearest future. |
@mkutsevol that's awesome! we'll be happy to be testers when you need that! |
Is there any chance Wireguard could be used / integrated as a swappable lower layer of encryption for the overlay?
|
@RRAlex definitely not in this PR. openswan which is used to control kernel ipsec is used here and the kernel does the magic and 'protocols', 'fast', etc. |
Hi @tomdee,
Basically, I need your opinion on tagging: where VARIANT is one of: We will have more dockerfiles, which is unfortunate, as they will require synchronous changes. But templating dockerfiles seems like an overkill. What's you opinion? Status: I rebased your rebase onto the current master and it's broken and needs rework to adapt not only to the packaging changes, but to the changes in flannel itself. |
Please see |
* As flannel doesn't support multiple networks, this is not needed any more
* Transitional, (WIP) * Support for bundled/remote charon. * Cleanup after removal of CreateBackendData/GetBackendData
* It builds amd64. * Still much to do.
* Added sync.WaitGroup, so spawned processes can correctly shutdown. * Bundled charon daemon correctly shuts down.
* Removed the build of strongswan compeletey. Even alpine linux has it build already. * We package docker with strongswan as a separate image.
* DRYer * Correct stop if hadn't finished init sequence.
@mkutsevol I merged the PR to switch over to Alpine so that should greatly simplify the build and packaging part of this PR. |
I'm wondering if this will be superseded by a Wireguard backend at some point. Wireguard isn't upstreamed yet, but at lot can happen in 6-18 months. Wireguard seems way easier to work with than IPSEC (and all the packing logic) , and someone could probably tweak the ipip backend to use Wireguard. Just my two cents.. |
I think implementing could be as simple as (pseudo code):
|
@klausenbusk See #898 |
Keep up the good work. Either impl is desirable over nothing. |
Indeed doing this with WireGuard means it's a tiny shell script, as opposed to a massive cludge. Let me know if you guys need help doing this. |
But at least all the kernel modules is already in place. Compiling and loading the WG kernel module on CoreOS isn't complicated [1] [2], but how do you automate the compiling? A shell script which run on every boot seems to be the only solution, but that feels a bit hackish, and it would need to block kubelet/flannel from starting until the kernel module is ready. Another solution is torcx, but that isn't ready yet |
Ensure it's shipped for the kernel with the package manager, ensure it's built into the kernel, or just use dkms, which is what's done on ubuntu/debian/arch/fedora/etc. |
CoreOS contains no package manager.
CoreOS does not ship out-of-tree modules. See coreos/bugs#2225
dkms isn't available in CoreOS.. So.. Limited by the OS. |
Shucks. I guess you could make a "policy exception" if you wanted. I'll reiterate that over in the bug you linked, though, so as not to clutter this one. So, I guess you can rig up a wireguard-autobuilder shell script then, like you originally suggested? Hate to come to that, but if that's our only solution... |
IPSec is definitely not the easiest to work with but it's really just a building block for a system that exposes more user friendly concepts. That's why we have the swans and the like. If flannel can use IPSec to implement the concepts it provides then it just ends up being an implementation detail. The implementation can be based on WG but if flannel wraps it anyway, WG's simplicity is not going to matter to the end user. |
@mkutsevol I've rebased this again onto master and pushed it to https://github.com/tomdee/flannel/tree/feature/ipsec Unfortunately, I can't get it to work. The logs look fine to me, but I can't ping when running the e2e test - would you be able to take a look at see what's going wrong? Ping me on slack if you need help getting it running. |
@tomdee, I know, that's 'cos of the routing setup the tests do. |
IPSec support has just been merged to master in #929 🎆 It's still classed as "experimental" but it would be great if everyone could try it out, and provide feedback (and ideally PRs!) on the user experience, the code, the documentation, the tests etc... Docs: https://github.com/coreos/flannel/blob/master/Documentation/backends.md#ipsec |
!THIS IS STILL A WORK IN PROGRESS!
This is based on @eyakubovich @MohdAhmad PR #516
I've packaged it correctly, so you can get a working docker image from this commit.
I've fixed dockerfile only for amd64 for now.doneI've done ikev2 support. I commented #516 (comment) and that is true. But then dead peer detection in v2 won.
Now you can supply config to charon, eg enable debug logging
Just drop logging config to via a volume to /usr/local/strongswan-amd64/etc/strongswan.d/charon-logging.conf
Example available here https://wiki.strongswan.org/projects/strongswan/wiki/LoggerConfiguration
Didn't rebase. Will do when needed.doneI've pushed this build to mkutsevol/flannel:amd64 please test (beware, it is temporary. I'll delete it later)
Please review/comment.