Add iptable rule to drop traffic to 127.0.0.1 that isn't originated from the host. This is necessitated by the fact that we set `net.ipv4.conf.all.route_localnet` to 1.
### Implementation details
and that the rule is removed when service stopped.
Ran a few agent functional tests with the rpm including the task iam role test to make sure the local traffic forwarding to task credential endpoint isn't affected.
New tests cover the changes: yes
Description for the changelog
Drop traffic to 127.0.0.1 that isn't originated from the host.
Licensing
This contribution is under the terms of the Apache 2.0 License:
Summary
Add iptable rule to drop traffic to 127.0.0.1 that isn't originated from the host. This is necessitated by the fact that we set `net.ipv4.conf.all.route_localnet` to 1. ### Implementation detailsAdd following iptable rule when starting up:
Remove the rule upon stop. Some refactor in unit test code to reduce duplicate code and use assert/require from testify library.
Testing
Unit tests added/updated.
Built the rpm and verified that the expected iptable rule is added after the sevice start:
and that the rule is removed when service stopped. Ran a few agent functional tests with the rpm including the task iam role test to make sure the local traffic forwarding to task credential endpoint isn't affected.
New tests cover the changes: yes
Description for the changelog
Drop traffic to 127.0.0.1 that isn't originated from the host.
Licensing
This contribution is under the terms of the Apache 2.0 License: