-
Notifications
You must be signed in to change notification settings - Fork 48
Conversation
I'm not sure we can get rid of the hostendpoint controller since it also handles VPN interfaces, which I don't think we can translate to Calico. |
Those tests exist and it seems they pass? See https://github.com/kinvolk/lokomotive/blob/master/test/calico/calico_test.go
I'd still do a manual test, just to be sure 😄 |
Can we restrict the Having two controllers simultaneously can cause conflicts? |
It shouldn't be a huge deal, worst case you get some errors that the resource already exist.
That must be implemented here I guess: https://github.com/kinvolk/calico-hostendpoint-controller/blob/master/run#L98 |
I have two nodes: $ kg nodes
NAME STATUS ROLES AGE VERSION
suraj-lk-cluster-controller-0 Ready <none> 10m v1.18.2
suraj-lk-cluster-pool-1-worker-0 Ready <none> 10m v1.18.2 And I have allowed ssh access only from my home public IP $ kg globalnetworkpolicy ssh -o yaml
apiVersion: crd.projectcalico.org/v1
kind: GlobalNetworkPolicy
metadata:
name: ssh
spec:
applyOnForward: true
ingress:
- action: Allow
destination:
ports:
- 22
protocol: TCP
source:
nets:
- 106.51.107.95
order: 0
preDNAT: true
selector: has(host-endpoint) And after deploying this PR following hostendpoints are created automatically. $ kg hostendpoints -o yaml
apiVersion: v1
items:
- apiVersion: crd.projectcalico.org/v1
kind: HostEndpoint
metadata:
annotations:
labels:
beta.kubernetes.io/arch: amd64
beta.kubernetes.io/os: linux
kubernetes.io/arch: amd64
kubernetes.io/hostname: suraj-lk-cluster-controller-0
kubernetes.io/os: linux
lokomotive.alpha.kinvolk.io/public-ipv4: 139.1.1.63
node.kubernetes.io/controller: "true"
node.kubernetes.io/master: ""
projectcalico.org/created-by: calico-kube-controllers
name: suraj-lk-cluster-controller-0-auto-hep
spec:
expectedIPs:
- 10.88.81.1
- 10.2.82.0
interfaceName: '*'
node: suraj-lk-cluster-controller-0
profiles:
- projectcalico-default-allow
- apiVersion: crd.projectcalico.org/v1
kind: HostEndpoint
metadata:
annotations:
labels:
beta.kubernetes.io/arch: amd64
beta.kubernetes.io/os: linux
kubernetes.io/arch: amd64
kubernetes.io/hostname: suraj-lk-cluster-pool-1-worker-0
kubernetes.io/os: linux
lokomotive.alpha.kinvolk.io/public-ipv4: 139.1.1.91
metallb.universe.tf/my-asn: "65000"
metallb.universe.tf/peer-address: 10.88.81.2
metallb.universe.tf/peer-asn: "65530"
node.kubernetes.io/node: ""
projectcalico.org/created-by: calico-kube-controllers
name: suraj-lk-cluster-pool-1-worker-0-auto-hep
spec:
expectedIPs:
- 10.88.81.3
- 10.2.153.0
interfaceName: '*'
node: suraj-lk-cluster-pool-1-worker-0
profiles:
- projectcalico-default-allow
kind: List
metadata: But I am still able to ssh from non-whitelisted IP: $ ssh core@139.1.1.91
Last login: Fri May 15 12:49:44 UTC 2020 from 136.8.7.17 on pts/0
Flatcar Container Linux by Kinvolk stable (2247.7.0)
Update Strategy: No Reboots
Failed Units: 1
tcsd.service
core@suraj-lk-cluster-pool-1-worker-0 ~ $ What could be wrong here? |
19671f4
to
79e4114
Compare
From https://docs.projectcalico.org/reference/resources/hostendpoint:
and
So maybe we need a deny all rule and then our own allow GNP rules should have precedence. |
79e4114
to
53222be
Compare
53222be
to
f134554
Compare
@surajssd rebase is needed here. Maybe we can just do the update here and don't remove anything for now? |
f134554
to
a7a7213
Compare
Yes, I guess so. Though IIRC, the controller works by using the wildcard in |
The wildcard is not breaking the security but the profile that it adds automatically. |
I'm not sure I understand. Can you please elaborate? |
By wildcard I meant that it is being applied on all the interfaces (see following example, $ kg hostendpoints -o yaml
apiVersion: v1
items:
- apiVersion: crd.projectcalico.org/v1
kind: HostEndpoint
metadata:
annotations:
labels:
beta.kubernetes.io/arch: amd64
beta.kubernetes.io/os: linux
kubernetes.io/arch: amd64
kubernetes.io/hostname: suraj-lk-cluster-controller-0
kubernetes.io/os: linux
lokomotive.alpha.kinvolk.io/public-ipv4: 139.1.1.63
node.kubernetes.io/controller: "true"
node.kubernetes.io/master: ""
projectcalico.org/created-by: calico-kube-controllers
name: suraj-lk-cluster-controller-0-auto-hep
spec:
expectedIPs:
- 10.88.81.1
- 10.2.82.0
interfaceName: '*'
node: suraj-lk-cluster-controller-0
profiles:
- projectcalico-default-allow
- apiVersion: crd.projectcalico.org/v1
kind: HostEndpoint
metadata:
annotations:
labels:
beta.kubernetes.io/arch: amd64
beta.kubernetes.io/os: linux
kubernetes.io/arch: amd64
kubernetes.io/hostname: suraj-lk-cluster-pool-1-worker-0
kubernetes.io/os: linux
lokomotive.alpha.kinvolk.io/public-ipv4: 139.1.1.91
metallb.universe.tf/my-asn: "65000"
metallb.universe.tf/peer-address: 10.88.81.2
metallb.universe.tf/peer-asn: "65530"
node.kubernetes.io/node: ""
projectcalico.org/created-by: calico-kube-controllers
name: suraj-lk-cluster-pool-1-worker-0-auto-hep
spec:
expectedIPs:
- 10.88.81.3
- 10.2.153.0
interfaceName: '*'
node: suraj-lk-cluster-pool-1-worker-0
profiles:
- projectcalico-default-allow
kind: List
metadata: So the wildcard entry for interfaces is not breaking the security. But the ...
profiles:
- projectcalico-default-allow
... Like I have asked in the issue on the upstream projectcalico/calico#3566, how do we manipulate the CR so that we can either disable any policy in there or add a way to speacify a |
1040e1c
to
631fc0c
Compare
Now that we are not removing our hostendpoint controller, I see that the security is intact. $ ssh -v core@17.5.9.7
OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 17.5.9.7 [17.5.9.7] port 22.
debug1: connect to address 17.5.9.7 port 22: Connection timed out
ssh: connect to host 17.5.9.7 port 22: Connection timed out |
631fc0c
to
1cf92df
Compare
I think this PR is ready for final review, and can be merged eventually. What I am confused about is how can we automate testing for this? |
a93b211
to
74c4119
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@iaguis PTAL |
3.14.1 is out now. We should update before merging. |
This commit updates calico from `v3.13.3` to `v3.14.1`. Release Notes: https://github.com/projectcalico/calico/releases/tag/v3.14.1. Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
This commit updates the ClusterRole `calico-kube-controllers` with enhanced permissions. It allows the access to CRD `hostendpoints` and `kubecontrollersconfigurations`. Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
Signed-off-by: Suraj Deshmukh <suraj@kinvolk.io>
74c4119
to
e0a766d
Compare
Is done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @surajssd !
@iaguis PTAL. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
NOTE: See the commits one at a time to understand what this PR does in detail.
Fixes #341
TODOs: