-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modifying Firewall rules to provide Internet Access to T0/T1 #2327
base: develop
Are you sure you want to change the base?
Modifying Firewall rules to provide Internet Access to T0/T1 #2327
Conversation
], | ||
), | ||
], | ||
application_rule_collections=self._get_application_rule_collections(props), |
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.
I'm not sure we gain much by moving these definitions into a function.
class MyMocks(pulumi.runtime.Mocks): | ||
def new_resource(self, args: pulumi.runtime.MockResourceArgs): | ||
resources = [args.name + "_id", args.inputs] | ||
return resources | ||
|
||
def call(self, _: pulumi.runtime.MockCallArgs): | ||
return {} | ||
|
||
|
||
# TODO: These breaks many other tests! | ||
pulumi.runtime.set_mocks( | ||
MyMocks(), | ||
preview=False, | ||
) |
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.
Luckily, you don't need these :). See the test_application_gateway.py
for an example of Pulumi runtime tests without set_mocks
.
class InternetAccess(Enum): | ||
ENABLED = True | ||
DISABLED = False |
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.
If we need this enum, it's probably useful outside just testing. Should it live in types/enums.py
?
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.
I can deploy an SRE, but can't actually connect to anything. At the moment, literally only traffic from workspaces is allowed. None of the container services can connect to the internet, so a user can't get to the remote desktop gateway, for example I misdescribed that a bit. Guacamole can't talk to the microsoft Auth servers over the internet, so it can't properly log you in.
] = [] | ||
|
||
if props.allow_workspace_internet: | ||
application_rule_collections = [] |
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.
Here you remove all the application rules. I think that the problem is, the way the network rules are subsequently defined, only traffic directly from workspaces is allowed out to the internet. This means the various containers (identity, remote desktop gateway etc) can't communicate with the internet, so you can't get to guacamole to be able to connect to the workspaces.
Not all of the containers actually need internet access, but some do.
destination_addresses=["*"], | ||
destination_ports=["*"], | ||
name="allow-internet-access", | ||
protocols=[network.AzureFirewallNetworkRuleProtocol.ANY], | ||
source_addresses=props.subnet_workspaces_prefixes, |
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.
This line defines which source addresses are allowed. At the moment it's just the subnet for workspaces (10.0.2.0/29
), whereas the containers are all in 10.0.1.0/29
.
I guess there are two options.
- Keep most of the application rules (it's just the snapcraft ones we wanted to get rid of)
- Modify this line to allow all source addresses
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.
I've also tried fixing this locally (with option 2 from above) but still can't browse to anything from within the SRE.
Internet access is possible: I can ftp
to ftp.ubuntu.com
from a workspace.
So I think we need to also look at the DNS.
We have a local container that we use for DNS that (among other things) blocks most FQDNs from resolving.
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.
Allowed DNS domains are defined in types.enums.PermittedDomains
.
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.
Hi @craddm , thanks for checking into this. Just to check my understanding, when you tested Option 2 did you have all the application rules enabled + the new network rule? Also, changing the DNS container means modifying data_safe_haven/resources/dns_server/AdGuardHome.mustache.yaml
?
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.
You might need to slightly change AdGuardHome.mustache.yaml
. Currently it forbids everything then allows everything from a specified allowlist. We might need to make the first part configurable as otherwise the rules will be "deny everything" and "allow everything" and I have no idea what that will do!
Have tested a fresh deployment with internet access enabled, and can confirm it works! |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
✅ Checklist
Enable foobar integration
rather than515 foobar
).develop
.🚦 Depends on
The proposed approach adds an extra field to the SRE config file (
allow_workspace_internet
) and based on its value does the following: 1) Iffalse
, business as usual, 2) iftrue
, we remove all the firewall's application rules, we add a network rule allowing connections to the internet, and removeuser_rules
DNS server configuration.🌂 Related issues
Closes #2283
🔬 Tests