Restrict Internet Access

Is there any way to restrict internet access for the deployed container?
20 Replies
Percy
Percy13mo ago
Project ID: 33c47f57-f4aa-4640-9b44-cd0a3f034b71
Percy
Percy13mo ago
Project ID: 33c47f57-f4aa-4640-9b44-cd0a3f034b71
nootrality
nootrality13mo ago
33c47f57-f4aa-4640-9b44-cd0a3f034b71
Brody
Brody13mo ago
can you elaborate?
nootrality
nootrality13mo ago
i'm running some untrusted code in a sandbox, i'd like to restrict internet access
Brody
Brody13mo ago
restrict what? restrict how? im afraid that its a very vague question
nootrality
nootrality13mo 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
Brody13mo ago
ah okay you want to disable outbound internet traffic, correct?
nootrality
nootrality13mo ago
this would be equivalent to --network none in docker correct
Brody
Brody13mo ago
railway provides no firewall, this would have to be something you do with iptables inside the container
nootrality
nootrality13mo 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
Brody13mo ago
a quick google search provides this command for ubuntu that denys all outgoing traffic ufw default deny outgoing
nootrality
nootrality13mo ago
ok will keep looking. thank you brody!
Brody
Brody13mo 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
nootrality13mo ago
makes sense! thanks
Brody
Brody13mo ago
no problem, id be intrested to know how this works out for you too!
nootrality
nootrality13mo 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
Brody13mo 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
nootrality13mo ago
yeah, part of team where do i do that?
Brody
Brody13mo ago
contact@railway.app 🙂
Want results from more Discord servers?
Add your server
More Posts