mruoss
I’m working on the FLAME Backend for Kubernetes.
In my current PR, I’d like to allow for better control over the runner pod manifest. The current approach basically offers 2 ways of controlling the runner pod manifest.
In the simpler case you can just define env vars and resource requests/limits for the runner pods. The FLAME backend then creates the runner pod with these values set.
If you need more advanced features like pod affinity (e.g. running on GPU nodes), volumes etc, you can implement a callback in which you build the runner pod manifest in your application and return it to the FLAME backend. The backend then adds soem required env variables, set/overwrite a few values like the pod name, container image, etc. and finally apply it to the cluster to create the runner pod.
Inputs anyone?
Trending in Announcing
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
entone
No feedback at this point, but just wanted to say thank you! I was hoping this would happen quickly!
maennchen
Very cool
Have you thought about using the cluster certificate to verify the tls connections?
Libcluster does this and it should be relatively simple to adapt: libcluster/lib/strategy/kubernetes.ex at 3f1afbdb9ec0929ed99d35e5f875e55f8cbdd851 · bitwalker/libcluster · GitHub
mruoss
I am doing that in the
connectfunction: flame_k8s_backend/lib/flame_k8s_backend/k8s_client.ex at main · mruoss/flame_k8s_backend · GitHubOr is it something else you’re referring to?
maennchen
Oh, I take it back. I misread the code. Why are you even offering
insecure_skip_tls_verifythen?mruoss
If the URL in the SA token is an IP (not a FQDN), hostname verification fails with
:verify_peeras there is no way to verify the hostname in the cert. This is the case e.g. on my local Kind cluster…mruoss
I am very open to better ways of dealing with this, though.
mruoss
So… I’ve created a PR that removes the
insecure_skip_tls_verifyoption in favour of settingserver_name_indicationto:disableifKUBERNETES_SERVICE_HOSTis an IP address (instead of a FQDN).However, I’d really like a “security audit” on this. I think this is as safe as it can be. I mean… no SNI, no hostname check. So we might as well disable it automatically, no?
Then again, I was surprised to see even AKS (Azure) settting
KUBERNETES_SERVICE_HOSTto a FQDN if and only if you add an annotation to your pod!Maybe I should do something like Erlang does for
verify_none: Keep the option in place, but if it is not set and I’m settingserver_name_indicationto:disable, print a warning.Opinions anybody?
Here’s the PR:
https://github.com/mruoss/flame_k8s_backend/pull/5
maennchen
I’m not sure about the perfect solution here either. I’ll message @voltone in the ErlEF security WG if he has any suggestions.
voltone
Setting
server_name_indication: :disablenot only drops te SNI extension from the Client Hello message sent to the server, it also disables hostname verification altogether. So while the client still checks if the server is presenting a certificate that was issued by a trusted CA, it does not check if we have reached the server we intended to reach. That’s arguably better thanverify: :verify_none, but I think we can do better still?What identities does Kubernetes put in the certificate that the server presents, in the Common Name field of the Subject and in the SubjectAltNames extension? If the IP address appears anywhere and you connect with an IP address in the URL, then the default behavior of
ssl(without:server_name_indicationoption) should be to try and match that IP.One way to check what identities are being checked would be to pass the following
:ssloption:customize_hostname_check: [match_fun: fn a, b -> IO.inspect({a, b}); :default end]mruoss
Unfortunately I’m not fluent in Erlang. But I think this is actually a bug in Erlang’s
public_key:pkix_verify_hostname/Nfunction.The certificate presented by the Kubernetes API Server contains the IP address (see the note on the Kubernetes docs.
I can verify that, looking at the
id-ce-subjectAltNameextension in the certificate:Now the IP Address seems to be a binary. But looking at the Erlang code, I think it’s expecting a charlist, no?
length()andlist_to_tuple()are list operations, no?This has been bugging me for so long now (I’m also maintaining the
k8slibrary). If this could be fixed, it would be awesome. WDYT @voltone? I can also open an Erlang issue for this.EDIT: Opened an issue: `public_key:pkix_verify_hostname/N` returns `{:bad_cert, :hostname_check_failed}` when connecting to IP addresses · Issue #7968 · erlang/otp · GitHub