Restrict Internet Access

Is there any way to restrict internet access for the deployed container?
20 Replies
Percy
Percy2y ago
Project ID: 33c47f57-f4aa-4640-9b44-cd0a3f034b71
Percy
Percy2y ago
Project ID: 33c47f57-f4aa-4640-9b44-cd0a3f034b71
nootrality
nootralityOP2y ago
33c47f57-f4aa-4640-9b44-cd0a3f034b71
Brody
Brody2y ago
can you elaborate?
nootrality
nootralityOP2y ago
i'm running some untrusted code in a sandbox, i'd like to restrict internet access
Brody
Brody2y ago
restrict what? restrict how? im afraid that its a very vague question
nootrality
nootralityOP2y ago
i'm running a server which is executing arbitrary user code for evaluations (we have a coding interview product). i want to make sure this code isn't making requests to the internet. i've designed my service in such a way that it doesn't need to make any calls to the internet, so what i'd like to do is completely disable internet access for the server.
Brody
Brody2y ago
ah okay you want to disable outbound internet traffic, correct?
nootrality
nootralityOP2y ago
this would be equivalent to --network none in docker correct
Brody
Brody2y ago
railway provides no firewall, this would have to be something you do with iptables inside the container
nootrality
nootralityOP2y ago
i think to configure iptables i need a privileged container, is this provided? yeah iptables access is restricted by docker unless you pass in specific flags
Brody
Brody2y ago
a quick google search provides this command for ubuntu that denys all outgoing traffic ufw default deny outgoing
nootrality
nootralityOP2y ago
ok will keep looking. thank you brody!
Brody
Brody2y ago
its also possible that railway's docker deamon does allow iptables use in the containers, cant hurt to try but whatever the solution, it has to be done in the container image
nootrality
nootralityOP2y ago
makes sense! thanks
Brody
Brody2y ago
no problem, id be intrested to know how this works out for you too!
nootrality
nootralityOP2y ago
yeah seems like the containers aren't run with the right privileges to support iptables:
> [base 5/11] RUN iptables -A OUTPUT -m owner --uid-owner code -j REJECT:
#9 0.428 getsockopt failed strangely: Operation not permitted
> [base 5/11] RUN iptables -A OUTPUT -m owner --uid-owner code -j REJECT:
#9 0.428 getsockopt failed strangely: Operation not permitted
` i'll come up with something else
Brody
Brody2y ago
youre part of a team right? you could always shoot an email to railway, theyd probably have some ideas on what you could do
nootrality
nootralityOP2y ago
yeah, part of team where do i do that?
Want results from more Discord servers?
Add your server