Skip to content
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

Block non-HTTP connections to external IPs #466

Merged
merged 1 commit into from
Dec 3, 2024
Merged

Block non-HTTP connections to external IPs #466

merged 1 commit into from
Dec 3, 2024

Conversation

dhinus
Copy link
Member

@dhinus dhinus commented Dec 3, 2024

I'm not sure what kind of network connections PAWS users need from their
notebooks, but I assume most will be HTTP/S connections to external
websites or APIs, or Git repositories served over HTTP/S.

Connections to UDP ports 53 (DNS) and 123 (NTP) are also legitimate.

Blocking other types of ports and protocols should prevent several forms
of malicious traffic that could originate from PAWS.

Bug: T381373

@vivian-rook vivian-rook force-pushed the T381373 branch 3 times, most recently from 1bd9307 to 7e0803d Compare December 3, 2024 12:39
@topranks
Copy link

topranks commented Dec 3, 2024

Hey! As discussed on irc you should probably also allow UDP port 52 (dns) and 123 (ntp) as well. Other than that it doesn't seem unreasonable to lock things down to TCP 80/443, but it can be wider than that if we know what's needed.

vivian-rook
vivian-rook previously approved these changes Dec 3, 2024
@vivian-rook
Copy link
Collaborator

Looks like it isn't taking...

W1203 13:25:57.832715 4141109 warnings.go:70] unknown field "spec.egress[5].to[0].ports"
Error: UPGRADE FAILED: cannot patch "singleuser" with kind NetworkPolicy: NetworkPolicy.extensions "singleuser" is invalid: spec.egress[5].to[0]: Required value: must specify a peer

@dhinus
Copy link
Member Author

dhinus commented Dec 3, 2024

I think it wants an ipBlock (I was hoping it was optional). Pushing a fix shortly.

@vivian-rook
Copy link
Collaborator

I think we can drop the 'to' clause and it seems pretty happy. Can't curl an ftp server at any rate

@vivian-rook
Copy link
Collaborator

That change seems to allow access everywhere. Let me try something.

@dhinus
Copy link
Member Author

dhinus commented Dec 3, 2024

@vivian-rook try the latest version I just pushed

@vivian-rook
Copy link
Collaborator

Oh the one I pushed last appears to be working, I'm going to push it again

I'm not sure what kind of network connections PAWS users need from their
notebooks, but I assume most will be HTTP/S connections to external
websites or APIs, or Git repositories served over HTTP/S.

Connections to UDP ports 53 (DNS) and 123 (NTP) are also legitimate.

Blocking other types of ports and protocols should prevent several forms
of malicious traffic that could originate from PAWS.

Bug: T381373
@vivian-rook
Copy link
Collaborator

vivian-rook commented Dec 3, 2024

Ok, I think we're good here. ssh and ftp aren't connecting externally, ssh is connecting internally, OpenRefine and Rstudio seem to work, pwb can do some things. I think we're good. We'll see if any less obvious stuff comes up. Thank yinz!

@vivian-rook vivian-rook merged commit f79c585 into main Dec 3, 2024
4 checks passed
@vivian-rook vivian-rook deleted the T381373 branch December 3, 2024 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants