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

build: Add --network option #555

Closed
wants to merge 1 commit into from

Conversation

KyleFromKitware
Copy link

@KyleFromKitware KyleFromKitware commented Mar 20, 2020

This option allows builds to have network access inside the chroot.

Copy link
Member

@Conan-Kudo Conan-Kudo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a good idea. This makes it difficult to have custom resolv.conf in the environment, and may result in broken setups if the host resolv.conf is not a real file.

@Conan-Kudo
Copy link
Member

In addition, I want resolv.conf to not be present by default in chroot environments. I use chroot environments and intentionally add a small bit of friction to make it so internet access works.

In general, package builds should not have internet access, and overriding this behavior should be exceptional, not normal.

@adrianschroeter
Copy link
Member

this is an incompatible change and reproducible builds must work without external resources. So we won't merge it that way.

However, we could offer this optional via an additional parameter, similar to --vm-net.

@KyleFromKitware
Copy link
Author

Lack of /etc/resolv.conf does not completely block internet access, only DNS resolution (which is admittedly a big part of it.) Programs inside the chroot can still connect directly to IP addresses. If you want to truly block internet access, you need to take away their socket privileges.

However, we could offer this optional via an additional parameter, similar to --vm-net.

I agree this might be better. What do you think the name should be?

@adrianschroeter
Copy link
Member

adrianschroeter commented Mar 24, 2020 via email

@KyleFromKitware
Copy link
Author

Ideally --network ... but it should also work with other modes like kvm in that case.

I thought about this, but VMs would be tricky to support, especially if the host is using dnsmasq or systemd-resolved. Those both point /etc/resolv.conf to 127.0.0.1, which would not have the same meaning inside the VM. Perhaps we could say that --network support is limited to chroot for now?

@adrianschroeter
Copy link
Member

adrianschroeter commented Mar 24, 2020 via email

@KyleFromKitware
Copy link
Author

IMHO you should use KVM esp together with network mode, because you don't really know
what kind of code get downloaded and executed. (Except it is your own code)

In my case, yes, the code is trusted. I also fear that using KVM would have a performance penalty (though probably not as much as outright emulation.)

@Conan-Kudo
Copy link
Member

IMHO you should use KVM esp together with network mode, because you don't really know
what kind of code get downloaded and executed. (Except it is your own code)

In my case, yes, the code is trusted. I also fear that using KVM would have a performance penalty (though probably not as much as outright emulation.)

There's not much of a performance penalty. You certainly won't notice it in package builds beyond the additional ~3-5 seconds to boot up the VM.

@KyleFromKitware
Copy link
Author

We're getting a little off topic here. Let's take this back to the email thread, and I'll leave this open until I reach a verdict.

@KyleFromKitware
Copy link
Author

I have attempted to use KVM and have not had much success. I will go back to attempting to add a --network option to chroot.

@KyleFromKitware KyleFromKitware changed the title init_buildsystem: Copy /etc/resolv.conf into chroot build: Add --network option Mar 25, 2020
@KyleFromKitware
Copy link
Author

OK, this change now conditionally copies /etc/resolv.conf from the root if --network is specified.

This option allows builds to have network access inside the chroot.
@adrianschroeter
Copy link
Member

there is meanwhile a --vm-network switch, so closing this one.

@KyleFromKitware
Copy link
Author

What's the status on this? Are we still expected to use KVM for network support? I never did manage to get KVM to work in my setup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants