update/cgcs-patch/cgcs-patch/cgcs_patch
Steven Webster 6adc828b84 sw-patch: remove explicit bind on outgoing socket.
This commit fixes an issue seen during a k8s upgrade from 1.18.1
to 1.19.13.  It was noticed that after upgrading kubelet to 1.19.13,
the sw-patch-controller process would continually restart.

It was found via packet tracing and logging that traffic from the
management interface to the localhost address at port 5489 was being
blocked.  This indicated a likely issue in iptables.

Comparing the iptables rules in 1.18.1 to 1.19.13 shows the reason
why:

Chain KUBE-FIREWALL (2 references)
target prot opt source      destination
DROP   all  --  !loopback/8 loopback/8  \
                                ! ctstate RELATED,ESTABLISHED,DNAT

That is, drop all packets _not_ from the loopback interface _to_
the loopback interface that do not have an existing connection
state.

It was found that this rule was added in the following commit:

https://github.com/kubernetes/kubernetes/pull/91569/files

Which was added to address the security concern identified here:

https://github.com/kubernetes/kubernetes/issues/90259

It appears that the PatchMessageHelloAgent periodically sends
messages to both the patch controller's agent address as well
as to the localhost address.  Since the outgoing socket used
for all messages is explicitly bound to the management
address, the traffic to the localhost address will hit the
drop rule noted above.

The solution in this commit is to not explicitly bind the
outgoing socket to the management address, so as to have the
kernel choosed the correct outgoing interface for both
messages.

Story: 2008972
Task: 43244

Testing:

AIO-SX (unicast traffic), AIO-DX, Standard (multicast traffic).
	Ensure sw-patch-controller stays up after k8s upgrade.
	Install a patch on all nodes.

Signed-off-by: Steven Webster <steven.webster@windriver.com>
Change-Id: I93912b934986dc28196c9ba50f2803bf0fe01513
2021-09-08 10:07:08 -04:00
..
api Add flake8-bugbear and address warnings 2020-01-16 13:24:24 -05:00
authapi Fix zuul tox flake8 failures from newer version of hacking 2019-12-16 09:56:09 -06:00
templates cgcs-patch: fix permissions 2019-06-19 12:26:16 -07:00
tests Migrate patch-agent to use DNF for swmgmt 2020-01-13 09:20:06 -05:00
__init__.py Resolve bashate and pep8 warnings 2018-08-08 19:36:58 -05:00
app.py Add pylint support 2018-08-24 09:19:44 -05:00
base.py sw-patch: remove explicit bind on outgoing socket. 2021-09-08 10:07:08 -04:00
certificates.py Resolve bashate and pep8 warnings 2018-08-08 19:36:58 -05:00
config.py Convert sw-patch to use python3 2021-07-28 09:13:22 -04:00
constants.py Introduce patch apply/remove semantic support 2019-10-02 16:59:53 -04:00
exceptions.py Introduce patch apply/remove semantic support 2019-10-02 16:59:53 -04:00
messages.py Clean up pylint W1201 logging-not-lazy in cgcs-patch 2019-12-23 14:51:20 -05:00
patch_agent.py Convert sw-patch to use python3 2021-07-28 09:13:22 -04:00
patch_client.py Convert sw-patch to use python3 2021-07-28 09:13:22 -04:00
patch_controller.py Merge "First system load-delete failed after upgrade SX" 2021-08-17 19:50:29 +00:00
patch_functions.py Convert sw-patch to use python3 2021-07-28 09:13:22 -04:00
patch_signing.py Convert sw-patch to use python3 2021-07-28 09:13:22 -04:00
patch_verify.py Convert sw-patch to use python3 2021-07-28 09:13:22 -04:00
utils.py Add test coverage for cgcs-patch/utils.py 2019-06-28 00:46:14 -04:00