[Enhancement] Implement option to always use host channel for communications instead of direct channel
- Dominant language
- Python
- Stars
- 581
- Forks
- 397
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 9
Description
So, I spent some time reading the agent source code. I pretty much see the way forward for me to preserve functionality, whilst ensuring that I have no failures logged to Azure Firewall due to the agent defaulting to using the direct channel for communications, is by having a configuration option to force this. This is essential for tightly controlled environments such as mine, where we want to avoid the firewall ever having denials, whilst balancing functionality with avoidance of creating holes for C2.
I think I can mitigate this by using `python3-dnf-plugin-post-transaction-actions` to run a post-update script which patches the agent files to force host channel for communications always.
I _think_ that this diff would mitigate my issue, but I need to test it out, I have not tested it yet.
```
--- /usr/lib/python3.9/site-packages/azurelinuxagent/common/protocol/wire.py 2022-03-11 23:38:57.000000000 +0000
+++ wire.py 2025-02-06 21:56:43.812843947 +0000
@@ -1203,9 +1203,9 @@
host_channel = lambda: self.__send_request_using_host_channel(host_func)
if HostPluginProtocol.is_default_channel:
- primary_channel, secondary_channel = host_channel, direct_channel
+ primary_channel, secondary_channel = host_channel, host_channel
else:
- primary_channel, secondary_channel = direct_channel, host_channel
+ primary_channel, secondary_channel = host_channel, host_channel
ret = primary_channel()
if ret is not None:
```
--------------------------ORIGINAL POST BELOW THIS LINE---------------------------
Hi,
We have many Virtual Machines running RHEL 9, with the Azure Agent for Linux. All internet bound traffic for these Virtual Machines is forced via Azure Firewall. We want to know:
- How can we determine these hostnames with the ARM API so that we can whitelist them in Azure Firewall from our Terraform IaC?
- What are they used for?
- Can we disable these connections in the configuration file?
Examples of traffic:
HTTPS TCP 443 md-ssd-jcm3fxdzs4rh.z22.blob.storage.azure.net
HTTPS TCP 443 md-ssd-vtg1sd1nrnqr.z1.blob.storage.azure.net
Contributor guide
Assessment
This issue has not been assessed yet.